Skip to content
Instant download after checkout
Join The Discord Today
discord.gg/EskoKustomz
Instant download after checkout
Join The Discord Today
discord.gg/EskoKustomz
Instant download after checkout
Join The Discord Today
discord.gg/EskoKustomz
Esko Kustomz
All posts
Tutorials4 min read

FiveM Resource Load Order and the ensure Command

Resources load in the order defined by ensure statements in server.cfg. Here is the documented best practice for ordering frameworks, dependencies, and content.

#fivem#server.cfg#resource#ensure#tutorial

FiveM resources do not auto-discover. They load in the explicit order defined by ensure statements in server.cfg (or files included via exec). Getting the order wrong means dependencies are not ready when downstream resources try to use them. This post covers the documented behavior of ensure and the community-recommended load order, sourced from the Cfx.re docs and forum.

What ensure does

From the Cfx.re documentation: ensure "starts a resource if it is not already running." It is the recommended way to start resources because it is idempotent - if you call ensure twice on the same resource, the second call is a no-op rather than an error.

The older syntax start <resource> still works but does not have the idempotent behavior, so most modern server configurations use ensure exclusively.

Why order matters

From community guidance on the Cfx.re forum: "The order of ensure is important because some resources depend on others." A resource trying to use ESX's exports will fail if ESX has not started yet. A resource querying the database will fail if oxmysql is not running yet.

FiveM does respect dependency declarations in fxmanifest.lua and will hold a resource's start until its declared dependencies are running. But this only works for explicitly declared dependencies. Implicit dependencies (e.g. you call an export from another resource without declaring the dependency) need correct ensure ordering or they will misbehave at startup.

Recommended load order

The community-recommended structure (per multiple FiveM hosting and Cfx forum guides):

  1. FiveM core resources - mapmanager, chat, spawnmanager, sessionmanager, hardcap, rconlog. These ship with FiveM and are required for nearly everything else.
  2. Database - oxmysql or mysql-async. Must start before any framework or resource that touches the database.
  3. Framework - es_extended (ESX) or qb-core (QBCore).
  4. Framework menus / shared utilities - esx_menu_default, esx_menu_dialog, esx_menu_list (for ESX); ox_lib (commonly used cross-framework).
  5. Inventory - if separate (qs-inventory, ox_inventory).
  6. Jobs and ESX/QB-specific scripts - all the scripts that depend on the framework and database.
  7. Standalone utilities - things that have no framework dependency (some HUDs, voice mods, etc.).
  8. Content packs - vehicle packs, map mods, clothes packs, etc. Last because they only depend on the engine, not on other resources.

Avoid ensure *

You can technically use ensure * to start every resource in the resources folder, but the Cfx community guidance is to avoid this in production. From the documentation summary: "Avoid using ensure * in production as it causes non-deterministic order." If two resources both depend on a third, a non-deterministic load order means the bug will reproduce intermittently.

Organizing with exec

For larger servers, the convention is to split resource ensure statements into a separate file (commonly resources.cfg) and reference it from server.cfg with:

exec resources.cfg

This keeps server.cfg focused on connection/network/security settings, with resource management in its own dedicated file.

Bracketed folder convention

FiveM also recognizes a bracketed-folder convention: resources/[vehicles]/, resources/[esx]/, etc. Folders inside these brackets get auto-discovered when their containing category is referenced. The bracket folders themselves are not directly ensured - they are categories. Each underlying resource still needs to be ensured (or use ensure on the category-derived shorthand).

Sources

Browse the lot

Drag, drop, drive. Lore-friendly originals and curated real-vehicle conversions for FiveM.

Related field notes