Skip to content

Installation

Install tLib, reach the hub in a browser with no configuration, and depend on tLib from your own resource.

Download

Take the latest release from GitHub Releases. A source checkout is not enough — only the release carries the built NUI page and server bundle. To work from source, see Building from source in the repository README.

Extract

Put the tLib folder in your server's resources directory.

Start the resource

Add this to server.cfg, above every resource that depends on tLib:

txt
ensure tLib

Who counts as an admin

tLib has two ACEs and reads nothing else. Grant them in server.cfg, or type the same lines into the live server console:

txt
add_ace identifier.license:00000000000000000000000000000000000000ab tlib.admin allow
add_ace group.admin tlib.superadmin allow
ACELevelWhat it gets
tlib.admin1Admin rows in the tLib menu, admin panels, marketplace install and uninstall.
tlib.superadmin2Everything above, plus whatever a resource reserves for level 2.

A principal can be a licence identifier, a group.*, a Discord role your framework defines — anything FXServer accepts. add_principal is not needed.

tlib_menu_refresh and tlib_menu_permissions are server-console only and say so in chat if a player tries them. tlib_demo and every <resource>_diag command use FXServer's own per-command ACE instead, so a player who should have one needs add_ace <principal> command.tlib_demo allow — tlib.admin does not cover them.

Browser access, with nothing to configure

The hub — one page linking every tLib app that has a web surface — is served on the FiveM server port, the port your players already connect through:

txt
http://<your server>:<server port>/tLib/

Your server port is whatever endpoint_add_tcp declares — 30120 on a default install. tLib prints the address when it starts, so you never have to work it out. Nothing to open, nothing to forward, no convar.

Each app answers under its own resource name, because on the server port the first part of the path is the resource name:

AppPath
The hub/tLib/
tRadio's dispatch panel/tRadio/
tRadio's admin panel/tRadio/admin
tDB's admin UI/tDB/

Paths are case-insensitive, so /tradio/admin works too. Start at the hub and follow the links rather than typing these — it always lists what is actually running.

What this door cannot do

  • No WebSocket. tRadio's dispatch panel falls back to long-polling. It works, with roughly five times the latency — measured at 58 ms against 11 ms, median.
  • 8 KB per message from the browser. A larger one drops the connection, so a big upload through an admin panel can fail.
  • No PocketBase realtime. tDB's SSE subscriptions do not work here. Its admin UI and REST API do.
  • No legacy paths. /dispatch and /db redirect on the listener only; here, use the addresses in the table.
  • Adding a listener moves Discord login and the desktop app's automatic updates onto it. Both are absolute URLs tLib publishes, and those name one door — the listener's whenever one is configured, this one otherwise.

set tlib_http_ingress false turns this door off entirely, for tLib and for every app mounted on it.

None of those limits apply to tLib's own listener, which is the route to take for a dispatch panel that is worked all day, or for a custom domain.

Depend on tLib

lua
dependencies { 'tLib' }

shared_scripts {
    '@tLib/imports.lua',   -- only if you use the import modules
}

Exports need the dependency line alone:

lua
exports['tLib']:ShowToast(nil, 'success', 'tLib is running', 'Installed correctly.')

The menu is declared, not built imperatively — pages on the server, handlers on the client. See Exports and Menu Consumers.

The import modules need @tLib/imports.lua and nothing else. Each one loads the first time you touch it:

lua
local value = tlib.kvp.getString('my_key', 'default')

Advanced: tLib's own listener

Skip this unless you need it. Everything above already works, in game and in a browser. tLib's own listener is a second door to exactly the same apps, and it is the full-capability one: WebSocket, lower latency, no 8 KB message limit, and an origin a reverse proxy can sit in front of.

Take it if you are running a dispatch panel all day, hosting a tRadio federation, or putting the hub behind a custom domain or HTTPS. The cost is a port to open — on the machine and in NAT — and, for anything other than a bare IP, an address to declare.

Nothing binds until you ask. With neither tlib_http_port nor tlib_http_host set, tLib opens no socket of its own at all; setting either one is what turns this door on. If your server.cfg already has them from an earlier version, nothing changes — the listener binds on the same port it always did.

Open the port

7777/tcp on the host firewall, plus NAT port-forwarding if the server is behind a router. On a hosting panel it is an entry under Network, Ports or Allocations, and a new allocation needs the whole server restarted, not just the resource.

Then the convars, above ensure tLib. They are read once, when the resource starts, so a set below it is read on the next restart and not before:

txt
set tlib_http_port 7777
set tlib_http_public_url "http://123.45.67.89:7777"

ensure tLib
# ...then everything that depends on it
ensure tRadio

Use set, not setr. Only the server reads these.

On this door the apps keep the router's flat paths, and the hub itself is at the root:

AppAddress
The hub:7777/
tRadio's dispatch panel:7777/tRadio/
tRadio's admin panel:7777/tRadio/admin
tDB's admin UI:7777/tDB/

The dispatch panel used to live at /dispatch and tDB's admin UI at /db. Both still answer on this door, with a permanent redirect to the addresses above, so an old bookmark keeps working. The server-port door is new, so it publishes no legacy path — use the current ones there.

What to put in tlib_http_public_url

It is the address you type in a browser, not the address tLib listens on. The listener is tlib_http_port on every interface; this line only decides what tLib tells clients to use. Leave it out and tLib detects your public IP, which is right for a bare IP on a home connection and wrong for a hostname, a reverse proxy, a game-panel host or a tunnel.

The scheme and port are inferred from the shape of what you write:

You settLib advertises
(nothing)http://<detected-ip>:7777
localhosthttp://localhost:7777
123.45.67.89http://123.45.67.89:7777
123.45.67.89:8080http://123.45.67.89:8080
radio.example.comhttps://radio.example.com — no port
http://radio.example.comhttp://radio.example.com
https://example.com/radiohttps://example.com/radio

A bare domain becomes https with no port, because a name only reaches your server if DNS points at it — which means a proxy or tunnel terminating TLS on 443, where :7777 would be wrong. A bare IP stays on the port, because no certificate fits a bare IP.

A custom domain or HTTPS

tlib_http_public_url is advertised, never bound, and tLib provisions no certificate. Terminate TLS at a reverse proxy or a tunnel, forward to the listener's plain HTTP, and set the convar to the public address you end up with. Forward WebSocket upgrades as well, or the dispatch panel loads and then fails every connection.

Convars is the full reference for all five HTTP settings.

Still stuck? Support can answer it directly.

Was this page helpful?