PiTyUs.Hire me

Getting started

Running a local FiveM server for development

Set up a local FiveM development server: running FXServer on your PC, connecting with localhost, sv_lan for offline testing, a separate dev database, fast restart and refresh workflow, matching production (game build, OneSync), and testing with two clients.

Updated 9 min readBy PiTyUs · FiveM developer

Overview

Editing scripts directly on a live server means every typo is a public outage. A local development server on your own PC lets you restart resources a hundred times an hour, break things freely and only ship what works. It takes ten minutes to set up.

01Setting it up

  1. Download the server artifacts for your OS — the same build as production.
  2. Copy your server-data (or a trimmed version) to your PC.
  3. Create a fivem_dev database and import a copy of production data or the framework’s SQL.
  4. Point mysql_connection_string at the dev database.
  5. Start the server and connect with connect localhost:30120 in F8.

Server setup details: Windows or Linux.

Offline testing with sv_lan

dev.cfgcfg
set sv_lan true
sv_hostname "DEV - local"
sv_maxclients 8

With sv_lan true the server does not appear in the public list and skips licence key checks — handy for a laptop on the train. Remove it on anything public.

The edit–test loop

Command (server console)When
ensure myresAfter editing a resource (starts or restarts it)
refreshAfter adding a new resource folder or changing an fxmanifest
stop myresTo test behaviour without it
restart myresRestart an already running resource

Many client changes need you to be in the game when the resource restarts; UI changes are fastest with a dev server and hot reload — see NUI devtools. Errors appear in F8 and the server console — see the F8 console guide.

Match production

  • Same sv_enforceGameBuild — natives and DLC content depend on it.
  • Same OneSync mode; server-side natives behave differently without it.
  • Same framework and ox_lib versions.
  • Same Lua version setting (lua54).

Testing multiplayer logic

Sync, ownership and events between players only show up with two clients. Use a second PC or a friend on the LAN (with sv_lan off if they connect over the internet). Entity ownership pitfalls are explained in network IDs and ownership.

Frequently asked questions

How do I run a FiveM server on my PC for testing?

Download the server artifacts, set up server-data and a dev database, start FXServer and connect with connect localhost:30120.

Do I need a licence key for a local server?

Not with sv_lan true, which keeps the server LAN-only and skips the key check.

How do I reload a script without restarting the server?

ensure <resource> in the server console (or restart). Use refresh first for new resources.

Should the dev server use the live database?

No. Use a copy, so testing cannot damage real player data.

Need this built, not just explained?

Ten years of FiveM work, from Lua to NUI

Custom resources, React NUI, ESX / QBCore / Qbox integration, OneSync performance audits and security reviews — plus the websites and SEO around your server brand.

Related guides