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

# Edge Server Configuration Anatomy

> Anatomy of a Ditto Edge Server configuration file

Ditto Edge Server is configured entirely by a static YAML configuration file. This file defines all
aspects of the server's behavior, including resource definitions, authentication settings, and
network configurations.

The configuration file takes the following general structure:

```yaml theme={null}
# Required: Single Ditto database configuration
database:
  db_id: "00000000-0000-4000-0000-000000000000"
  device_name: "edge-device-1"
  auth:
    # Authentication configuration (server or small_peer_only)
  subscriptions:
    - "SELECT * FROM collection"

# Optional: HTTP server configuration
http_server:
  listen_addr: "127.0.0.1:8080"
  tls_config: dev_mode  # or provide cert/key for TLS
  http_api: true

# Required: Authentication configuration
auth:
  identities:
    my_identity:
      credential:
        api_key: "BASE64_HASH"
      permissions: [permission_set_name]
  permission_sets:
    permission_set_name:
      permissions: full

# Optional: Logging configuration
logging:
  ditto_sdk: warning
  edge_server:
    level: warning
    console_logs: std_out
```

## Configuration Schema

Edge Server provides a comprehensive JSON Schema that documents all available configuration options, validation rules, and examples. This schema enables IDE autocomplete and validation for your config files.

### Viewing the Schema

```bash theme={null}
# View schema in JSON format (best for tools)
ditto-edge-server config schema

# Save to file for IDE integration
ditto-edge-server config schema > edge-server-config-schema.json
```

### IDE Integration

Most modern editors support YAML schema validation. Enable it by adding a schema directive at the top of your config file:

```yaml theme={null}
# yaml-language-server: $schema=./edge-server-config-schema.json

database:
  db_id: "00000000-0000-4000-0000-000000000000"
  device_name: "edge-device-1"
  # IDE will now provide autocomplete and validation here
```

<Tip>
  Schema-based validation catches configuration errors before runtime, making it easier to discover available options and ensuring your config file is correct.
</Tip>

### Validating Configuration

Validate your configuration file without starting the server:

```bash theme={null}
# Validate config syntax and schema compliance
ditto-edge-server config validate my-config.yaml

# View config with all defaults filled in
ditto-edge-server config defaults my-config.yaml

# Get a minimal example config
ditto-edge-server config minimum
```
