{"id":"crecentez/netlink","name":"netlink","scope":"crecentez","platform":"roblox","description":"A structured networking module for Roblox that simplifies RemoteEvents, RemoteFunctions, middleware, and rate limiting.","version":"1.1.0","latest":"1.1.0","versions":["1.1.0"],"license":"MIT","licenseRating":"safe","licenseCaveats":[],"licenseVerified":true,"dependencies":{},"integrity":"4f93b968cc52ac8e83565678a8f4d110f554920957f6fb812753dd6ddfda68e7","likes":0,"downloads":0,"install":"forest install crecentez/netlink","url":"https://forest.dev/p/roblox/crecentez/netlink","files":"https://api.forest.dev/ai/package/roblox/crecentez/netlink/files","readme":"# NetLink\r\n\r\nA structured networking module for Roblox that simplifies RemoteEvents, RemoteFunctions, middleware, and rate limiting.\r\n\r\nDesigned for intermediate Roblox developers to handle client-server communication reliably, removing the need to manually set up and manage remote events, functions, and middleware.\r\n\r\n---\r\n\r\n## Features\r\n\r\n- Unified API for events and functions\r\n- Optional middleware pipeline\r\n- Built-in per-player rate limiting\r\n- Async invoke support via internal Promise\r\n- Connection ownership and cleanup\r\n- Server-internal BindableEvent / BindableFunction support\r\n- Unreliable events\r\n- Runtime event creation\r\n\r\n---\r\n\r\n## Latest Changes (V 1.1.0)\r\n\r\n - Added unreliable event support\r\n - Added runtime event/function creation\r\n - Added support for wally\r\n\r\n---\r\n\r\n## Installation\r\n\r\nPlace `NetLink.lua` in a shared location (e.g. `ReplicatedStorage.Modules.NetLink`).\r\n\r\nRequire it where needed:\r\n\r\n```lua\r\nlocal NetLink = require(ReplicatedStorage.Modules.NetLink)\r\n```\r\n\r\n---\r\n\r\n## Lifecycle\r\n\r\nThe NetLink has a strict lifecycle: \r\n1. `NetLink.Configure(...)`\r\n2. `NetLink.Load()`\r\n3. Listen / Fire / Invoke\r\n\r\n`Load` must be called on the server before any client or server usage.\r\n\r\n---\r\n\r\n## Server Usage\r\n### Configuration\r\n```lua\r\nNetLink.Configure({\r\n    RemoteEvents = { \"Damage\", \"Notify\" },\r\n    RemoteFunctions = { \"GetStats\" },\r\n    DebugMode = true,\r\n    UseMiddleware = true\r\n})\r\n```\r\n### Loading\r\n```lua\r\nNetLink.Load()\r\n```\r\n### Listening\r\n```lua\r\nNetLink.Listen(self, \"Damage\", function(_, player, amount)\r\n    print(player, amount)\r\nend)\r\nNetLink.ListenUnreliable(self, \"Fire\", function(_, player, direction)\r\n    print(`{player.Name} is trying to fire at direction {direction}`)\r\nend)\r\n```\r\n### Invoking\r\n```lua\r\nNetLink.OnInvoke(self, \"GetStats\", function()\r\n    return NetLink.GetStats()\r\nend)\r\n```\r\n\r\n---\r\n\r\n## Client Usage\r\n### Fire Event\r\n```lua\r\nNetLink.FireServer(\"Damage\", 10)\r\nNetLink.FireServerUnreliable(\"Fire\", Vector3.new(1, 1, 1))\r\n```\r\n\r\n### Invoke Function\r\n```lua\r\nlocal result = NetLink.InvokeServer(\"GetStats\", 2)\r\n```\r\n\r\n### Async Invoke\r\n```lua\r\nNetLink.InvokeServerAsync(\"GetStats\", 2)\r\n    :andThen(function(result)\r\n        print(result)\r\n    end)\r\n    :catch(function(err)\r\n        warn(err)\r\n    end)\r\n```\r\n\r\n---\r\n\r\n## Middleware\r\n\r\nMiddleware is validation-only.\r\n - Receives `{ Player, Name, Args }`\r\n - Return `false` to block execution\r\n - Failures are silent unless `DebugMode` is enabled\r\n - Must be enabled in configuration\r\n```lua\r\nNetLink.UseMiddleware(function(ctx)\r\n    if ctx.Name == \"Damage\" and ctx.Args[1] > 100 then\r\n        return false\r\n    end\r\n    return true\r\nend)\r\n```\r\n\r\n---\r\n\r\n## Rate Limiting\r\n\r\nRate limiting is server-side only.\r\n```lua\r\nNetLink.SetRateLimit(\"Damage\", 5, 1)\r\n```\r\nLimits each player to 5 calls per second for the given remote.\r\nThis is intended for abuse reduction, not exploit prevention.\r\n\r\n---\r\n\r\n## Bindables\r\n\r\nBindableEvents and BindableFunctions are server-internal tools.\r\n\r\nThey are useful for decoupling server systems without remotes.\r\nThey are created and bound via the same NetLink API but are not replicated.\r\n\r\n---\r\n\r\n## Stats\r\n```lua\r\nlocal stats = NetLink.GetStats()\r\n```\r\nProvides live counters for diagnostics and monitoring.\r\n\r\n---\r\n\r\n## Stability\r\n\r\nPublic API is stable as of v1.1.0\r\nInternal implementation is not part of the API and may change\r\n\r\n---\r\n\r\n## License\r\nMIT License © 2025 Crecentez / Lunoxi Studios","readmeTruncated":false}