Getting Started
Install the bridge as a shared FiveM resource and run your RAGE:MP gamemode with @-imports.
This guide explains how to install ragemp-fivem-bridge as a shared FiveM resource and run your RAGE:MP gamemode using @ imports.
Prerequisites
Before you start, make sure you have:
- A working FiveM server.
- An existing RAGE:MP gamemode.
- Access to your FiveM
resourcesfolder. - A built version of your TypeScript gamemode, if your project uses TypeScript.
Download the bridge
Download ragemp-fivem-bridge-vx.x.x.zip from the latest release.
Unzip the archive and place the extracted ragemp-fivem-bridge folder inside your FiveM resources folder.
git clone https://github.com/adriantandara/ragemp-fivem-bridge.gitpnpm installpnpm build:resource- Copy the resource from
/dist/ragemp-fivem-bridgetoresources
Create your gamemode resource
Inside the resources folder, create a new folder for your gamemode. For example:
resources/gamemodeThen create an fxmanifest.lua file inside resources/gamemode:
fx_version 'cerulean'
game 'gta5'
server_scripts {
'@ragemp-fivem-bridge/server.js',
'server/index.js'
}
client_scripts {
'@ragemp-fivem-bridge/client.js',
'client/index.js'
}The @ragemp-fivem-bridge/... imports load the bridge before your gamemode scripts.
Copy your RAGE:MP gamemode files
Copy your built RAGE:MP gamemode files into resources/gamemode.
If your gamemode is written in TypeScript, build it first, then copy the compiled output.
If your gamemode is not written in TypeScript, rename the folders before copying them:
- Rename
packagestoserver. - Rename
client_packagestoclient.
Your copied files should be placed here:
resources/gamemode/server
resources/gamemode/clientConfigure NUI/CEF support
Inside resources/gamemode, create a ui folder.
Then create a host.html file inside resources/gamemode/ui:
<!doctype html>
<html>
<body>
<script src="https://cfx-nui-ragemp-fivem-bridge/ui/_bridge.js"></script>
</body>
</html>This file enables mp.browsers.new(...) to work through FiveM NUI.
Start the bridge and gamemode
Add both resources to your server.cfg:
ensure ragemp-fivem-bridge
ensure gamemodeKeep this order. The bridge must start before your gamemode.
Final folder structure
After completing the setup, your gamemode resource should look like this:
Next steps
You can now start your FiveM server and test your RAGE:MP gamemode through the bridge.
If the resource does not start correctly, check your server console for script loading errors and confirm that ragemp-fivem-bridge is started before gamemode.