> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nexdevelopment.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Installation

> How to install NEX Garages on your FiveM server.

## Requirements

* FiveM server with `lua54` and OneSync enabled
* MySQL or MariaDB
* One of: [`qbx_core`](https://github.com/Qbox-project/qbx_core), [`qb-core`](https://github.com/qbcore-framework/qb-core), or [`es_extended`](https://github.com/esx-framework/esx_core)
* [`ox_lib`](https://github.com/overextended/ox_lib)
* [`oxmysql`](https://github.com/overextended/oxmysql)

Everything else is optional and auto-detected — see
[Integrations & exports](/nex_garages/integrations).

## Steps

1. Download the resource from your [Cfx.re Portal](https://portal.cfx.re/assets/granted-assets)
   granted assets and drop it into your server, e.g. `resources/[nex]/nex_garages/`.

2. Add it to your `server.cfg` **after** its dependencies:

   ```
   ensure oxmysql
   ensure ox_lib
   ensure qbx_core           # or qb-core / es_extended
   ensure nex_garages
   ```

3. Start your server. The database schema installs itself on first start —
   the console prints `SQL setup complete` when it's done.

4. Grant staff access for the admin commands. The in-game garage editor
   accepts the ACE groups from `Nex.Config.CustomGarages.allowedGroups`
   (defaults: `god`, `admin`, `mod`):

   ```
   add_ace group.admin admin allow
   ```

That's it — the default garages and impound lots appear on the map.

## Manual SQL install (optional)

Prefer to run the SQL yourself? Set `AutoRunSQL = false` in `config/main.lua`
and import the matching files from `install/`:

| File                           | When to use                                                           |
| ------------------------------ | --------------------------------------------------------------------- |
| `install/qb-qbx/schema-qb.sql` | QBCore / Qbox servers                                                 |
| `install/esx/schema-esx.sql`   | ESX servers                                                           |
| `install/schema-features.sql`  | Both — feature columns and tables (mileage, sharing, pins, audit log) |

All statements use `IF NOT EXISTS` and are safe to re-run.

## Checking it worked

From F8:

```
lua print(GetResourceState('nex_garages'))
```

Should print `started`. If it prints `missing` or `stopped`, fix `server.cfg`
and restart.

To verify framework detection, temporarily set `Debug = true` in
`config/main.lua` and restart — boot logs print what was detected.

## Updating

Every file in `config/` and `bridge/` is listed under `escrow_ignore` and
stays editable — keep your copies when updating. Vehicles, private garages,
custom garages, pins and audit logs all live in MySQL and are preserved
automatically.

1. Replace the resource files with the new version (keep your edited
   `config/` and `bridge/` files).
2. Restart the server.

<Info>
  The resource checks for updates on start and prints a console notice when a
  newer version is available in your granted assets.
</Info>
