Configuration
Complete reference for api.config.toml configuration options.
chowbea-axios uses a TOML configuration file (api.config.toml) in your project root.
Full Configuration Reference
# Remote OpenAPI spec endpoint URL
api_endpoint = "http://localhost:3000/docs/swagger/json"
# Local spec file path (takes priority over api_endpoint if set)
# spec_file = "./openapi.json"
# Polling interval in milliseconds for watch mode
poll_interval_ms = 10000
[output]
# Folder where all generated files are written
folder = "app/services/api"
[instance]
# Environment variable name for base URL
base_url_env = "VITE_API_URL"
# localStorage key for auth token
token_key = "auth-token"
# Whether to include credentials (cookies) in requests
with_credentials = true
# Request timeout in milliseconds
timeout = 30000
[fetch]
# Headers to include when fetching the OpenAPI spec
# Values can use $ENV or ${ENV} for environment variable interpolation
# headers = { Authorization = "Bearer $API_TOKEN" }
[watch]
# Enable debug logging in watch mode (shows cycle-by-cycle logs)
debug = falseConfiguration Options
Root Options
| Option | Type | Default | Description |
|---|---|---|---|
api_endpoint | string | "http://localhost:3000/docs/swagger/json" | Remote OpenAPI spec endpoint URL |
spec_file | string | - | Local spec file path (overrides api_endpoint) |
poll_interval_ms | number | 10000 | Watch mode polling interval (ms) |
Output Section
| Option | Type | Default | Description |
|---|---|---|---|
folder | string | "app/services/api" | Output folder for generated files |
Instance Section
These options configure the generated Axios instance:
| Option | Type | Default | Description |
|---|---|---|---|
base_url_env | string | "VITE_API_URL" | Environment variable name for base URL |
token_key | string | "auth-token" | localStorage key for auth token |
with_credentials | boolean | true | Include credentials (cookies) in requests |
timeout | number | 30000 | Request timeout in milliseconds |
Fetch Section
| Option | Type | Default | Description |
|---|---|---|---|
headers | object | - | Headers to include when fetching the spec |
Watch Section
| Option | Type | Default | Description |
|---|---|---|---|
debug | boolean | false | Enable verbose cycle-by-cycle logging |
Environment Variable Interpolation
Header values support environment variable interpolation:
[fetch]
headers = { Authorization = "Bearer $API_TOKEN" }Both $VAR_NAME and ${VAR_NAME} syntax are supported:
[fetch]
headers = {
Authorization = "Bearer ${API_TOKEN}",
X-API-Key = "$MY_API_KEY"
}If an environment variable is not set, the CLI will throw an error with a helpful message.
Framework-Specific Examples
Vite / React
api_endpoint = "http://localhost:3000/api-docs/json"
[output]
folder = "src/api"
[instance]
base_url_env = "VITE_API_URL"Next.js
api_endpoint = "http://localhost:3000/api-docs/json"
[output]
folder = "lib/api"
[instance]
base_url_env = "NEXT_PUBLIC_API_URL"Vue / Nuxt
api_endpoint = "http://localhost:3000/api-docs/json"
[output]
folder = "src/services/api"
[instance]
base_url_env = "VITE_API_BASE_URL"Using a Local Spec File
Instead of fetching from a remote endpoint, you can use a local OpenAPI file:
# Comment out or remove api_endpoint
# api_endpoint = "http://localhost:3000/docs/swagger/json"
# Use local file instead
spec_file = "./openapi.json"
[output]
folder = "app/services/api"The CLI will use this file for all generation operations.
Multiple Configurations
If you need different configurations (e.g., for different API services), you can:
-
Create multiple config files:
api.config.toml(default)api.config.auth.tomlapi.config.payments.toml
-
Specify which config to use:
chowbea-axios fetch --config api.config.auth.toml