# Common Schemas

Reusable Nickel schemas for standard configuration components.

## Schemas

### Server (`server.ncl`)

HTTP server configuration component:

Fields:
- `host` (String) - Bind address
- `port` (Number) - Server port (1024-65535)
- `workers` (Number) - HTTP worker threads
- `request_timeout` (Number) - Request timeout (ms)
- `keep_alive` (Number) - Keep-alive timeout (s)
- `max_connections` (Number) - Max concurrent connections
- `graceful_shutdown` (Bool) - Enable graceful shutdown
- `shutdown_timeout` (Number) - Shutdown timeout (s)

Used by: Backend, Agents, LLM Router, Frontend services

### Database (`database.ncl`)

Database connection configuration:

Fields:
- `url` (String) - Connection URL (ws://, http://, file://)
- `username` (String) - Database user
- `password` (String) - Database password
- `database` (String) - Database name
- `pool_size` (Number) - Connection pool size
- `connection_timeout` (Number) - Connection timeout (s)
- `max_idle_connections` (Number) - Max idle connections

Used by: All services requiring persistence

### Monitoring (`monitoring.ncl`)

Observability and logging configuration:

Fields:
- `prometheus_enabled` (Bool) - Enable metrics
- `log_level` (String) - Log level (trace/debug/info/warn/error)
- `tracing_enabled` (Bool) - Enable distributed tracing
- `metrics_path` (String) - Metrics endpoint path
- `logging` (Record) - Logging format and outputs
- `metrics` (Record) - Metrics collection settings

Used by: All services

### Storage (`storage.ncl`)

Storage and backup configuration:

Fields:
- `base_path` (String) - Base storage path
- `backend` (String) - Storage backend (filesystem/s3/azure)
- `backup` (Record) - Backup scheduling
- `cache` (Record) - Cache configuration

Used by: Backend, Agents, Knowledge Graph

### Security (`security.ncl`)

Security configuration:

Fields:
- `tls_enabled` (Bool) - Enable TLS
- `tls_cert_path` (String) - Certificate path
- `tls_key_path` (String) - Private key path
- `auth` (Record) - Authentication settings
- `audit` (Record) - Audit logging

Used by: All services

## Usage Pattern

```nickel
let server_schema = import "schemas/common/server.ncl" in

# Use schema as base
let server_config = server_schema {
  port = 9001,
  workers = 8,
}
```

## References

- Parent: `../README.md`
- Defaults: `../../defaults/README.md`
- Values: `../../values/README.md`
- Constraints: `../../constraints/README.md`
