Rivo FX is a free, MIT-licensed library for FiveM resources, in Lua 5.4 and TypeScript, built to stop the bugs every script ends up writing by hand.
It brings the Effect model to FiveM: errors as typed values, fibers that clean up after themselves, services through Layers, and a schema check on everything that crosses a trust boundary. On top of that it adds the FiveM pieces scripts get wrong most often: validated net events, typed RPC, cleanup on drop, asset loads that cannot hang, and in-game devtools.
Free · MIT · Lua 5.4 and TypeScript · ESX/QBCore/Qbox/Standalone
Download & Docs
GitHub (source and releases):
Documentation:
Features
-
Net events that validate first: a handler never sees a payload that fails its schema
-
Per-player, per-event rate limits on by default
-
RPC with timeouts, cancellation and typed errors that keep their type on the client
-
Scopes that close on resource stop and player drop: entities deleted, models released, handlers interrupted
-
Asset loads with timeouts and typed errors, no more
HasModelLoadedwait loops -
One player, money and job API over ESX, QBCore, Qbox and standalone
-
Typed oxmysql queries, schema-typed state bags and KVP
-
Metrics, tracing and
/fxdevin-game devtools -
Lua and TypeScript speak the same protocol: a Lua client can call a TS server RPC and the other way round
Validated net events
Fx.net.handle checks every payload against its schema before your handler runs, and rate limits each player per event. Rejected payloads become security events you can log or batch to a webhook.
Typed errors across the wire
Raise NotEnoughMoney on the server and it arrives on the client as NotEnoughMoney, so catchTag works across the network. Calls time out and cancel the handler. Defects never leak details to clients.
Assets and cleanup
Model, anim dict, ptfx, texture dict, scaleform and audio bank loads all have timeouts and fail with AssetNotFound or AssetTimeout instead of freezing a thread. Anything spawned inside a player or resource scope is cleaned up when that player drops or the resource stops.
Frameworks
Fx.framework.auto picks the right layer for your server. getPlayer, getMoney, addMoney, removeMoney, setJob and player/job events work the same on ESX, QBCore, Qbox and standalone, and removeMoney fails with InsufficientFunds rather than going below zero.
Devtools, metrics and tracing
Type /fxdev in game for a live view of every resource using Rivo FX, on the server and on your own client: fibers, traces as a waterfall, failures with their full cause, and every metric. A client RPC call and the server handler it reached share one trace. Access is gated by the rivo_fx.devtools ACE, checked server side.
Metrics are also served in Prometheus format behind a token, for Grafana or any scraper.
Use it without learning Effect
Already have a codebase? Fx.runAwait runs an effect from any Citizen thread and returns the value, or raises the error so pcall works:
CreateThread(function()
local hash = Fx.runAwait(Fx.assets.model('adder', { timeout = 5000 }))
-- spawn something
end)
Moving an existing resource over? The migration guide has before and after code for net events, ox_lib, ESX and QBCore callbacks, framework money, oxmysql, asset loading, threads and NUI.
Compatibility
Framework: Standalone
ESX: Compatible
QBCore: Compatible
Qbox: Compatible
Database: Optional (oxmysql for Fx.db)
Required dependencies: None
Runtime: Lua 5.4 (lua54 'yes'), or TypeScript via @rivolabs/fx
Source protection: None, MIT licensed
Performance
The library loads into each resource’s own runtime, the way ox_lib does, so no exports sit on the hot path. Fibers are coroutines on a runner inside your resource, not Citizen threads, so a parked fiber costs nothing. Timers share one thread per resource that sleeps until the next one is due. Devtools poll only while open.
Installation
- Download
rivo_fx.zipfrom the latest release and unzip it into your resources folder asrivo_fx. ensure rivo_fxbefore any resource that uses it.- In your resource’s
fxmanifest.lua:
fx_version 'cerulean'
game 'gta5'
lua54 'yes'
dependency 'rivo_fx'
shared_script '@rivo_fx/init.lua'
For TypeScript resources: npm install @rivolabs/fx effect
Included
rivo_fxresource (library,/fxdevdevtools, metrics endpoint)@rivolabs/fxfor JS/TS and@rivolabs/fx-nuifor NUI pages- LuaLS type definitions
- Examples and full documentation
Links
GitHub: GitHub - RivoLabs/rivo_fx: Effect-style typed errors, fibers, Layers and Schema for FiveM, in Lua and TypeScript. Validated net events, typed RPC, metrics, tracing and in-game devtools. · GitHub
Docs: Introduction | Rivo FX
Discord: Rivo Software
Issues and pull requests are welcome on GitHub. Security reports go through GitHub private reporting.
| Code is accessible | Yes |
| Subscription-based | No |
| Lines (approximately) | ~6300 |
| Requirements & dependencies | None (oxmysql optional) |
| Support | Yes |










