How to Set Up a FiveM Development Environment on Windows
Want to write your own FiveM scripts? This guide sets up a complete local development environment with a local server, VS Code, and the workflow experienced developers use.
Writing FiveM scripts directly on a live production server is painful — every change forces a server restart while players are online, and testing in an unpredictable live environment makes debugging much harder. The professional approach is to set up a local development environment: a complete FiveM server running on your own machine where you can write, test, and iterate on scripts without impacting anyone.
This guide builds a complete local dev environment on Windows from scratch.
What You Will Install
- MySQL — local database for your development server
- HeidiSQL — visual database management
- FiveM server artifacts — the actual server software running locally
- Visual Studio Code — the standard code editor for FiveM development
- Git — version control and resource downloading
- A framework — QBCore or ESX as your scripting target
Step 1: Install MySQL Locally
Your local FiveM server needs a database. Install MySQL Community Server on your development machine:
- Download MySQL Community Server from
dev.mysql.com/downloads/mysql/ - Run the installer and select Developer Default (installs everything needed)
- During configuration, set a root password — write it down
- Complete the installation — MySQL starts automatically as a Windows service
Verify it is running by opening MySQL Workbench or the MySQL Command Line Client and connecting with your root credentials.
Step 2: Install HeidiSQL
HeidiSQL gives you a visual way to manage your local database:
- Download HeidiSQL from
heidisql.com - Install it, open it, and create a new session:
- Network type: MySQL (TCP/IP)
- Hostname:
127.0.0.1 - Port:
3306 - User:
root - Password: your root password
- Connect and create a new database called
fivem_dev
Step 3: Download FiveM Server Artifacts
- Go to
artifacts.fivem.netand download the latest recommended Windows build - Create the following folder structure:
C:/FXServer/
├── server/ ← extract artifacts here
└── server-data/ ← your config and resources go here
Extract the downloaded artifacts ZIP into C:/FXServer/server/.
Step 4: Clone the Base Server Data
The cfx-server-data repository gives you a working base server.cfg and essential default resources:
git clone https://github.com/citizenfx/cfx-server-data C:/FXServer/server-data
Step 5: Configure server.cfg
Open C:/FXServer/server-data/server.cfg and set these values:
sv_hostname "Local Dev Server"
sv_maxclients 8
# Get from keymaster.fivem.net
sv_licenseKey "YOUR_LICENSE_KEY"
# Local MySQL connection
set oxmysql_connection_string "mysql://root:your_password@localhost/fivem_dev?charset=utf8mb4"
# Resources
ensure oxmysql
ensure qb-core
# ... add more as you install them
You still need a FiveM license key even for a local server. Get a free one from keymaster.fivem.net.
Step 6: Install oxmysql
git clone https://github.com/overextended/oxmysql C:/FXServer/server-data/resources/[ox]/oxmysql
Step 7: Install Your Framework
For QBCore:
git clone https://github.com/qbcore-framework/qb-core C:/FXServer/server-data/resources/[qb]/qb-core
Import the SQL file in HeidiSQL:
- File → Run SQL File → select
C:/FXServer/server-data/resources/[qb]/qb-core/qb-core.sql
Add to server.cfg:
ensure qb-core
Step 8: Create a Start Script
Create C:/FXServer/start.bat to launch your local server easily:
@echo off
title FiveM Dev Server
C:/FXServer/server/FXServer.exe +exec server.cfg
pause
Double-click this file to start your local server. The pause keeps the window open if it crashes so you can read the error.
Step 9: Install Visual Studio Code
- Download VS Code from
code.visualstudio.com - Install it and open it
- Install these extensions from the Extensions panel (Ctrl+Shift+X):
- Lua by sumneko — syntax highlighting, linting, and autocomplete for Lua
- FiveM Lua (if available) — FiveM-specific native function autocomplete
Step 10: Configure VS Code for FiveM Lua
Create a .vscode/settings.json in your scripts workspace folder:
{
"Lua.runtime.version": "Lua 5.4",
"Lua.diagnostics.globals": [
"Citizen",
"RegisterNetEvent",
"AddEventHandler",
"TriggerEvent",
"TriggerServerEvent",
"TriggerClientEvent",
"exports",
"Config",
"QBCore",
"ESX"
],
"Lua.workspace.checkThirdParty": false,
"editor.tabSize": 4,
"editor.insertSpaces": true
}
This prevents VS Code from flagging FiveM global variables as errors, and configures consistent formatting.
Your Daily Development Workflow
With everything set up, writing and testing a script looks like this:
1. Create a new resource:
C:/FXServer/server-data/resources/[dev]/my-new-script/
├── fxmanifest.lua
├── client.lua
└── server.lua
2. Write your fxmanifest.lua:
fx_version 'cerulean'
game 'gta5'
description 'My New Script'
version '1.0.0'
client_scripts { 'client.lua' }
server_scripts { 'server.lua' }
3. Add to server.cfg:
ensure my-new-script
4. Start the server, connect in FiveM (connect to localhost or 127.0.0.1)
5. Make a change to client.lua or server.lua in VS Code
6. Reload just that resource without restarting the whole server:
restart my-new-script
Type this in the server console (or txAdmin console). The resource reloads in under a second. No full restart, no downtime.
7. Test immediately in-game
This iteration loop — edit in VS Code, restart resource-name in console, test in-game — is how experienced FiveM developers work. It is dramatically faster than restarting the entire server for every change.
Version Control with Git
Track every script you build with Git so you can always roll back to a working version:
cd C:/FXServer/server-data/resources/[dev]/my-new-script
git init
git add .
git commit -m "Initial version"
After every meaningful change:
git add .
git commit -m "Add config option for job name"
Once you have built something worth selling, ModForge is the marketplace for reaching thousands of active FiveM server owners. Create a seller account at modforge.xyz.