-
Notifications
You must be signed in to change notification settings - Fork 0
Configuration
Claude edited this page Oct 14, 2025
·
5 revisions
Complete guide to API Dock configuration structure.
API Dock searches for configurations in this order:
-
Project directory:
api_dock_config/config.yaml -
Current directory:
config/config.yaml -
Package defaults:
api_dock/config/config.yaml
The main configuration file defines global settings and lists remotes/databases.
name: my-api-gateway
description: Production API gateway
authors:
- name: Your Name
email: you@example.com
remotes:
- service1
- service2
- api_v2
databases:
- user_db
- analytics_db
endpoints:
- "/" # API metadata endpoint
# Global route restrictions (applied to all remotes)
restricted:
- users/{{user_id}}/delete
- admin/{{admin_id}}/dangerous| Field | Type | Description |
|---|---|---|
name |
string | API gateway name |
description |
string | Description shown in API metadata |
authors |
list | Author information |
remotes |
list | List of remote API names |
databases |
list | List of database names |
endpoints |
list | Non-proxied endpoints |
restricted |
list | Globally restricted route patterns |
Remote configurations define individual backend APIs.
config/remotes/
├── service1.yaml
├── service2.yaml
└── versioned_api/
├── 0.1.yaml
├── 0.2.yaml
└── 1.0.yaml
name: service1
description: User management service
url: http://localhost:8001
routes:
- users
- users/{{user_id}}
- users/{{user_id}}/profilename: service2
description: Legacy API with custom routes
url: http://localhost:8002
routes:
- route: {{route_name}}/{{user_id}}/permissions
method: GET
remote_route: user-permissions/{{user_id}}
- route: users/{{user_id}}/settings
method: GET
remote_route: user-config/{{user_id}}name: restricted_api
description: API with additional security
url: http://localhost:8003
restricted:
- users/{{user_id}}/permissions
- admin/{{}}
routes:
- users
- users/{{user_id}}
- healthDatabase configurations define SQL-queryable data sources.
config/databases/
├── user_db.yaml
├── analytics_db.yaml
└── versioned_db/
├── 0.1.yaml
└── 1.0.yaml
name: user_db
description: User data warehouse
tables:
users: s3://my-bucket/users.parquet
permissions: databases/permissions.parquet
routes:
- route: users
sql: SELECT * FROM [[users]]
- route: users/{{user_id}}
sql: SELECT * FROM [[users]] WHERE user_id = {{user_id}}name: analytics_db
description: Analytics database
tables:
events: s3://analytics/events.parquet
users: s3://analytics/users.parquet
queries:
user_events: |
SELECT e.*
FROM [[events]] e
WHERE e.user_id = {{user_id}}
routes:
- route: users/{{user_id}}/events
sql: "[[user_events]]"Recommended project structure:
my_project/
├── api_dock_config/
│ ├── config.yaml # Main configuration
│ ├── remotes/ # Remote API configs
│ │ ├── service1.yaml
│ │ ├── service2.yaml
│ │ └── api_v2/ # Versioned remote
│ │ ├── 0.1.yaml
│ │ └── 1.0.yaml
│ └── databases/ # Database configs
│ ├── user_db.yaml
│ └── analytics_db/ # Versioned database
│ ├── 0.1.yaml
│ └── 1.0.yaml
├── databases/ # Local Parquet files (generated from toy_api)
│ ├── test_db/
│ │ ├── users.parquet
│ │ └── permissions.parquet
│ └── versioned_db/
│ └── 1.2/
│ ├── users.parquet
│ ├── posts.parquet
│ └── user_permissions.parquet
└── ...
Create configuration directory:
pixi run api-dock initThis creates:
api_dock_config/
├── config.yaml
├── remotes/
└── databases/
Use different config directories per environment:
# Development
pixi run api-dock start --config dev_config/config.yaml
# Staging
pixi run api-dock start --config staging_config/config.yaml
# Production
pixi run api-dock start --config prod_config/config.yaml-
Version control configs - Commit
api_dock_config/to git - Separate environments - Use different config directories
- Document restrictions - Comment why routes are restricted
- Use versioning - Version APIs and databases independently
-
Test configurations - Use
describecommand to verify
Describe configuration to see expanded values:
# View remote configuration
pixi run api-dock describe service1
# View database configuration
pixi run api-dock describe user_db- Routing and Restrictions - Route configuration
- SQL Database Support - Database configuration
- Versioning - Versioned configurations
- Main README - Quick start guide