@laot/bridge
v1.3.4
Published
LTBridge CLI for fetching and bundling FiveM modules.
Maintainers
Readme
LTBridge
A next-generation FiveM Script Bridge & Module Manager designed to be incredibly fast, clean, and bloat-free.
Unlike traditional monolithic libraries that force every script to load hundreds of unused functions into memory, LTBridge acts as a smart build tool. It lets you maintain a central repository of your favorite utilities (like Inventory, Framework, Notify) and compiles only the exact code you actually use right into your FiveM resource.
By eliminating slow cross-resource exports and memory bloat, LTBridge helps you build highly independent, lightning-fast scripts with a perfect development experience.
✨ Why LTBridge?
- AOT Compilation: Our Ahead-of-Time compiler bundles everything in under ~200 milliseconds, meaning zero waiting.
- Instant Intellisense: Generates an
api.luastub file automatically. You get full autocomplete for everything as you type (LT.Inventory.AddItem). - Smart Dependencies: If a module needs another module, LTBridge automatically brings it in. No more missing functions.
- Live Watcher: Just run
ltbridge build -wand start coding. It detects what you type, bundles the necessary modules instantly, and updates yourfxmanifest.luaon the fly.
📦 Installation
Install the CLI tool globally using npm:
npm install -g @laot/bridgeOr run it directly via npx:
npx @laot/bridge [command]🚀 Quick Start
Initialize your project:
ltbridge initFollow the quick prompts to set up your preferences.
Start the Watcher:
ltbridge build -wThe watcher will run silently in the background and do all the heavy lifting.
Just Code: Use it in your script immediately. Everything else is automatic.
local name, lastname = LT.Framework.GetPlayerName()
For the full walkthrough, see Quick Start on GitBook.
⚙️ Configuration (ltbridge/config.json)
When you run init, LTBridge creates a simple JSON config.
| Setting | Default | Description |
| --- | --- | --- |
| version | CLI version | Written by the tool; used to detect CLI upgrades and refresh API stubs. |
| bundle | false | Combine everything into 3 clean files (shared, client, server). Set to true for bundle mode. |
| debug | false | Turn this on if you want to see internal debug prints from the modules. |
| minify | false | Enables code optimization and global variable randomization for maximum performance. |
| modules | [] | List of installed modules. The tool manages this automatically. |
When you run init, LTBridge walks you through build mode, minify, debug, and an optional VS Code Lua ignoreDir setting.
🛠️ Commands
Full command reference with examples: CLI Commands on GitBook.
| Command | Alias | Description |
| --- | --- | --- |
| ltbridge | - | Interactive Menu: Manage your modules visually. |
| ltbridge init | - | Set up LTBridge in a new project (interactive prompts, then initial build). |
| ltbridge api | - | Regenerate ltbridge/api.lua IDE stubs only. |
| ltbridge build | sync | Build the project manually (use -w for live auto-build). |
| ltbridge add <name> | - | Add a specific module manually (e.g., Target/*). |
| ltbridge remove <name>| - | Remove a module. |
| ltbridge why <name> | explain | See exactly why a module was automatically included. |
| ltbridge list | - | View installed and available modules. |
| ltbridge prune | - | Clean up unused modules from your code. |
🤝 Contributing
Got a cool function or utility? We'd love to have it! The system is designed so anyone can easily add new modules without touching complex configs.
- Fork the repository.
- Create a folder in
modules/(e.g.,modules/@MyCategory/MyFunction). - Write your code:
- Put your code in
client.lua,server.lua, orshared.lua. - Write standard EmmyLua comments (
--- @param,--- @return) for intellisense.
- Put your code in
- Submit a Pull Request: We will review and merge it.
🧠 Smart Annotations (@ltbridge)
If you are developing modules, you can use special comments to tell the compiler what to do. The compiler reads these, applies them, and then completely deletes the comments from the final build.
--- @ltbridge export: CustomName- Change the exported name of the function.--- @ltbridge alias: AnotherName- Create an alternative name for the same function.--- @ltbridge global- Expose the function directly to the rootLTobject (e.g.,LT.SetResource).
🙏 Credits
A huge thanks to the community_bridge project for the inspiration behind some core concepts, and luamin.js for the minification engine.
💡 Tip: To stop your IDE from trying to read the bundled output files (which can cause duplicate intellisense warnings), add this to your VSCode settings (
.vscode/settings.json):"Lua.workspace.ignoreDir": ["**/ltbridge/modules/**"]See also: IDE Setup on GitBook for autocomplete and workspace configuration.
