# 08 — Protected Builds & FiveM Integration

How protected customer builds work and how to use the bundled FiveM licensing resource.

# Protected Customer Builds

# Protected Customer Builds

Nord Forge can generate a protected customer build when a customer downloads a licensed **script** product.

## Developer download

Developers/admins can use direct release downloads and receive the clean uploaded package.

## Customer download

For protected script products, customer downloads can be transformed into a protected build.

The protected build:

- Keeps required public/configuration files editable.
- Protects runtime Lua code.
- Validates the customer's Forge Key online.
- Validates the registered FiveM server.
- Requests a temporary session key before protected code is unlocked.
- Can stop validating after product access is suspended or revoked.

## Category behavior

The current product UI enables protected-build behavior for the **Scripts** category.

Bots, MLOs, maps and other asset categories are intended to be delivered clean rather than through the Lua script protection flow.


# Editable Files & escrow_ignore

# Editable Files & `escrow_ignore`

Nord Forge keeps common configuration and documentation files editable in protected customer packages.

Default public/editable content includes patterns such as:

- `fxmanifest.lua`
- `__resource.lua`
- `config.lua`
- `config/**`
- `shared/config.lua`
- `locales/**`
- `lang/**`
- `languages/**`
- `translations/**`
- Markdown and text documentation
- JSON
- SQL
- CFG
- INI files

## `escrow_ignore`

During protected build generation, Nord Forge reads `fxmanifest.lua` or `__resource.lua` and honors `escrow_ignore` rules.

Example:

```lua
fx_version 'cerulean'
game 'gta5'

escrow_ignore {
    'config.lua',
    'shared/config.lua',
    'locales/*.lua',
    'data/*.json'
}
```

Files matched by `escrow_ignore` remain clean and editable.

Extra public patterns can also be configured at platform level with:

```env
NORD_FORGE_PUBLIC_FILE_PATTERNS=
```


# Bundled FiveM License Resource

# Bundled FiveM License Resource

The source package includes:

```text
integrations/fivem_resource/nord_forge_license
```

This resource provides a reusable FiveM-side Nord Forge license integration.

## Default configuration

```lua
Config = {}
Config.ForgeApi = 'https://nord-forge.lunarocketeer.com'
Config.ForgeKeyConvar = 'nord_license'
Config.KeymasterConvar = 'nord_keymaster'
Config.AutoBind = false
Config.Debug = false
```

`AutoBind` is disabled by default, matching the production requirement that customers register servers manually in Forge.

## Public exports

```lua
exports.nord_forge_license:ValidateProduct(product, callback)
exports.nord_forge_license:CreateSession(product, buildId, callback)
exports.nord_forge_license:IsValidated(product)
exports.nord_forge_license:GetSessionKey(product)
```

## Console command

The integration also includes the `nordforge_check` server command for validation checks.


# Licensing API Endpoints

# Licensing API Endpoints

Nord Forge exposes licensing endpoints used by protected builds and integrations.

## Validate

```text
POST /api/license/validate
```

Validates the Forge Key, product and registered server.

## Session

```text
POST /api/license/session
```

Validates the license and creates a temporary protected-build session.

## Register customer server

```text
POST /api/license/keymasters
```

Authenticated customer endpoint used to register a Keymaster.

## List customer servers

```text
GET /api/license/keymasters
```

Returns active/removed Keymasters and slot usage.

## Remove server

```text
POST /api/license/keymasters/<id>/remove
```

Removes a Keymaster from active use.

> The licensing API should normally be used through the official Nord Forge integration rather than reimplemented unnecessarily.