Creating Resources
Learn the structure and best practices for creating FiveM resources.
Resource Structure​
A well-organized resource follows this structure:
my-resource/
├── fxmanifest.lua # Resource metadata
├── client/
│ ├── main.lua
│ └── utils.lua
├── server/
│ ├── main.lua
│ └── database.lua
├── shared/
│ └── config.lua
└── README.md
Manifest File (fxmanifest.lua)​
The manifest defines your resource:
fx_version 'cerulean'
game 'gta5'
author 'Your Name'
description 'My Awesome Resource'
version '1.0.0'
shared_scripts {
'shared/config.lua',
}
client_scripts {
'client/main.lua',
'client/utils.lua',
}
server_scripts {
'server/main.lua',
'server/database.lua',
}
dependencies {
'mysql-async', -- if needed
}
Shared Configuration​
Create a shared config file for both client and server:
-- shared/config.lua
Config = {}
Config.Debug = true
Config.ServerAddress = 'http://localhost:3306'
return Config
Naming Conventions​
- Use descriptive resource names (e.g.,
my-awesome-job, notstuff) - Use camelCase for function names:
function playerJoined() - Use snake_case for file names:
player_utils.lua
Resource Versioning​
Use semantic versioning (MAJOR.MINOR.PATCH):
version '1.2.3' -- 1 = major, 2 = minor, 3 = patch
Publishing Your Resource​
- Test thoroughly on a local server
- Create a README with clear instructions
- Upload to GitHub or a community repository
- Share with the FiveM community