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

# Server Configuration

> Complete breakdown of server.cfg settings for Mythic Framework

The `server.cfg` file controls all server settings. This guide covers every setting relevant to Mythic Framework.

## Basic Settings

```bash theme={null}
# Server name in the server browser (supports ^0-^9 color codes)
sv_hostname "^5Mythic ^7Roleplay Server"

# Tags for server browser filtering
sets tags "roleplay, mythic, economy, jobs"

# Server metadata
sets sv_projectName "Mythic Framework"
sets sv_projectDesc "Professional FiveM Roleplay Server"
sets locale "en-US"
```

## License and API Keys

```bash theme={null}
# FiveM license key (REQUIRED)
sv_licenseKey "your_license_key_here"

# Steam Web API key (REQUIRED for Steam auth)
set steam_webApiKey "your_steam_api_key_here"

# Framework version
setr mfw_version "1.0.0"

# Discord application ID (for rich presence)
setr discord_app "your_discord_app_id"
```

<Warning>
  **Never share your license or API keys publicly!** Never commit them to public repositories.
</Warning>

<Steps>
  <Step title="Get FiveM License Key">
    Visit [keymaster.fivem.net](https://keymaster.fivem.net), log in, click "New Server", and generate a key for your server IP.
  </Step>

  <Step title="Get Steam API Key">
    Visit [steamcommunity.com/dev/apikey](https://steamcommunity.com/dev/apikey), enter your domain, and generate a key.
  </Step>
</Steps>

## Network Configuration

```bash theme={null}
# Server endpoint (IP:Port)
endpoint_add_tcp "0.0.0.0:30120"
endpoint_add_udp "0.0.0.0:30120"

# Maximum players
sv_maxclients 48

# Enforce GameBuild
sv_enforceGameBuild 2802
```

## Database Configuration

Mythic Framework uses **4 separate MongoDB convars** (two databases) plus MySQL:

```bash theme={null}
# MongoDB Auth Database (accounts, bans, roles)
set mongodb_auth_url "mongodb://localhost:27017/?readPreference=primary&ssl=false"
set mongodb_auth_database "auth"

# MongoDB Game Database (characters, vehicles, inventory, etc.)
set mongodb_game_url "mongodb://localhost:27017/?readPreference=primary&ssl=false"
set mongodb_game_database "fivem"

# MySQL (oxmysql)
set mysql_connection_string "mysql://root@localhost/MythicFramework?charset=utf8mb4"
set mysql_slow_query_warning 300
```

<Warning>
  **Two separate MongoDB databases are required.** The `auth` database stores account/ban data while the `fivem` database stores all game data (characters, vehicles, inventory, properties, etc.).
</Warning>

<Tip>
  For detailed database setup, see [Database Connections](/configuration/database-connections).
</Tip>

## Environment Configuration

```bash theme={null}
# Environment mode (dev or prod)
set sv_environment "prod"

# Access role level
set sv_access_role 0

# Logging level (numeric: 0 = minimal, higher = more verbose)
setr log_level 0

# OneSync (REQUIRED for Mythic Framework)
set onesync on
set onesync_enabled true
set onesync_population true
```

<AccordionGroup>
  <Accordion title="sv_environment" icon="flask">
    **Options:**

    * `dev` — Development mode (verbose logging)
    * `prod` — Production mode (optimized, minimal logging)

    **Effect:** Controls logging verbosity and feature behavior throughout the framework.
  </Accordion>

  <Accordion title="log_level" icon="bug">
    Numeric logging level. Higher values produce more verbose output.

    **Recommendation:** Use `0` in production, increase when debugging issues.
  </Accordion>

  <Accordion title="OneSync" icon="sync">
    **Required:** YES — Mythic Framework requires OneSync Infinity.

    ```bash theme={null}
    set onesync on
    set onesync_enabled true
    set onesync_population true
    ```

    **Never disable OneSync** — the framework depends on it.
  </Accordion>
</AccordionGroup>

## Discord Webhooks

```bash theme={null}
# Admin actions webhook
set discord_admin_webhook "https://discord.com/api/webhooks/..."

# Player connections webhook
set discord_connection_webhook "https://discord.com/api/webhooks/..."

# General logging webhook
set discord_log_webhook "https://discord.com/api/webhooks/..."

# Kill logs webhook
set discord_kill_webhook "https://discord.com/api/webhooks/..."

# Error logs webhook
set discord_error_webhook "https://discord.com/api/webhooks/..."

# Anti-cheat logs webhook
set discord_pwnzor_webhook "https://discord.com/api/webhooks/..."
```

<Info>
  Learn how to create and configure webhooks in [Discord Webhooks Guide](/configuration/discord-webhooks).
</Info>

## Security Settings

```bash theme={null}
# Disable script hook (security)
set sv_scriptHookAllowed 0

# Require Steam authentication
sv_authMaxVariance 1
sv_authMinTrust 1

# Rate limiting
set sv_filterRequestControl 4
```

## Admin Permissions

```bash theme={null}
# Create admin group
add_ace group.admin command allow
add_ace group.admin admin allow

# Add admin by Steam identifier
add_principal identifier.steam:YOUR_STEAM_ID group.admin
```

<Note>
  For complete permission configuration, see [Permissions Guide](/configuration/permissions).
</Note>

## Resource Loading

```bash theme={null}
# Database (MUST load first)
ensure oxmysql

# Core Framework
ensure mythic-base
ensure mythic-pwnzor

# ... (all other resources in dependency order)
```

<Tip>
  Resource load order is **critical**. See [Resource Management](/configuration/resource-management) for proper ordering.
</Tip>

## Complete Example

<Accordion title="View Full server.cfg Example">
  ```bash theme={null}
  # ====================================
  # MYTHIC FRAMEWORK - SERVER CONFIG
  # ====================================

  # === BASIC SETTINGS ===
  sv_hostname "^5Mythic ^7Roleplay Server"
  sets tags "roleplay, mythic, economy, jobs"
  sets locale "en-US"
  sv_maxclients 48

  # === AUTHENTICATION ===
  sv_licenseKey "your_license_key_here"
  set steam_webApiKey "your_steam_api_key_here"
  setr mfw_version "1.0.0"
  setr discord_app "your_discord_app_id"

  # === NETWORK ===
  endpoint_add_tcp "0.0.0.0:30120"
  endpoint_add_udp "0.0.0.0:30120"
  sv_enforceGameBuild 2802

  # === ENVIRONMENT ===
  set sv_environment "prod"
  set sv_access_role 0
  setr log_level 0

  # === MONGODB (Auth Database) ===
  set mongodb_auth_url "mongodb://localhost:27017/?readPreference=primary&ssl=false"
  set mongodb_auth_database "auth"

  # === MONGODB (Game Database) ===
  set mongodb_game_url "mongodb://localhost:27017/?readPreference=primary&ssl=false"
  set mongodb_game_database "fivem"

  # === MYSQL ===
  set mysql_connection_string "mysql://root@localhost/MythicFramework?charset=utf8mb4"
  set mysql_slow_query_warning 300

  # === DISCORD WEBHOOKS ===
  set discord_admin_webhook ""
  set discord_connection_webhook ""
  set discord_log_webhook ""
  set discord_kill_webhook ""
  set discord_error_webhook ""
  set discord_pwnzor_webhook ""

  # === ONESYNC (REQUIRED) ===
  set onesync on
  set onesync_enabled true
  set onesync_population true

  # === SECURITY ===
  set sv_scriptHookAllowed 0
  sv_authMaxVariance 1
  sv_authMinTrust 1
  set sv_filterRequestControl 4

  # === PERMISSIONS ===
  add_ace group.admin command allow
  add_ace group.admin admin allow
  add_principal identifier.steam:YOUR_STEAM_ID group.admin

  # === RESOURCES ===
  ensure oxmysql
  ensure mythic-base
  ensure mythic-pwnzor
  # ... (see Resource Management for full load order)
  ```
</Accordion>

## Validation Checklist

Before starting your server, verify:

<Steps>
  <Step title="License Keys">
    FiveM license key and Steam API key are set and valid.
  </Step>

  <Step title="Database">
    All 4 MongoDB convars set (`mongodb_auth_url`, `mongodb_auth_database`, `mongodb_game_url`, `mongodb_game_database`). MySQL connection string configured.
  </Step>

  <Step title="Network">
    Correct IP/port. Firewall allows traffic on port 30120.
  </Step>

  <Step title="OneSync">
    OneSync enabled with all three settings.
  </Step>
</Steps>

## Next Steps

<CardGroup cols={2}>
  <Card title="Database Connections" icon="database" href="/configuration/database-connections">
    Configure MongoDB and MySQL connections
  </Card>

  <Card title="Discord Webhooks" icon="discord" href="/configuration/discord-webhooks">
    Set up Discord logging webhooks
  </Card>

  <Card title="Resource Management" icon="boxes-stacked" href="/configuration/resource-management">
    Understand resource load order
  </Card>

  <Card title="Permissions" icon="shield-check" href="/configuration/permissions">
    Configure ACE permissions
  </Card>
</CardGroup>

<Warning>
  After making changes to `server.cfg`, restart the server for them to take effect.
</Warning>
