Dev Environment Configuration
This reference covers configuration options specific to the local development workflow (moose dev), including lifecycle hooks, Docker infrastructure extensions, and network defaults.
Lifecycle Hooks
Configure shell commands to run automatically during the development server's lifecycle. These are defined within the [http_server_config] section of your configuration.
[http_server_config]# Script to run once on first starton_first_start_script = "echo 'Dev server started'" # Script to run after every reload completeson_reload_complete_script = "echo 'Reload complete'"| Key | Env Variable | Type | Default | Description |
|---|---|---|---|---|
on_first_start_script | MOOSE_HTTP_SERVER_CONFIG__ON_FIRST_START_SCRIPT | String | - | Shell command executed once when moose dev starts. |
on_reload_complete_script | MOOSE_HTTP_SERVER_CONFIG__ON_RELOAD_COMPLETE_SCRIPT | String | - | Shell command executed after every code/infra reload. |
Execution Context
Scripts run from your project root using your system's default shell (usually /bin/sh or bash). You can chain commands using &&.
Common Examples
Sync External Tables on Start
on_first_start_script = "moose db pull --clickhouse-url $REMOTE_DB_URL"Regenerate Clients on Reload
on_reload_complete_script = "openapi-generator-cli generate -i .moose/openapi.yaml ..."File Watcher
The dev server watches your project and hot-reloads when you save changes.
- TypeScript projects: Reloads are driven by TypeScript compilation. The compiler runs in watch mode; when you save a file, an incremental compile runs. Only after a successful compile does Moose re-plan and apply infrastructure changes. Compilation errors block reloads (fix errors in your code to continue). Compiled output goes to your
tsconfig.jsonoutDiror.moose/compiled. See Moose Dev for details. - Python projects: A file watcher detects changes and triggers reloads directly.
Use ignore_patterns to exclude files (e.g. generated by lifecycle hooks) that should not trigger reloads.
[watcher_config]# Patterns use standard glob syntaxignore_patterns = ["generated/**", "*.gen.ts"]Debugging Data Flow
To debug data as it flows through your pipeline, use the --log-payloads flag:
moose dev --log-payloadsThis logs payloads at three key points with searchable prefixes:
PAYLOAD:INGEST- Data received at ingest APIPAYLOAD:STREAM_IN- Data before streaming functionPAYLOAD:STREAM_OUT- Data after streaming function
All logs appear in Moose logs and can be viewed using moose logs --tail.
Docker Infrastructure Extensions
Extend the default Moose development infrastructure by creating a specific override file in your project root.
| File Name | Purpose |
|---|---|
docker-compose.dev.override.yaml | Adds or overrides services in the generated Docker Compose setup. |
Usage
Create docker-compose.dev.override.yaml to add services like PostgreSQL or monitoring tools. Moose automatically detects and merges this file when running moose dev.
# docker-compose.dev.override.yamlservices: postgres: image: postgres:16 environment: POSTGRES_PASSWORD: mypassword ports: - "5432:5432"Limitations
Do not use this file to configure Moose-managed services (ClickHouse, Redpanda, Redis, Temporal). Use moose.config.toml for those components to avoid configuration conflicts.
Externally Managed Tables
When working with tables marked as EXTERNALLY_MANAGED (tables that exist in a production database but are managed outside Moose), you can configure the dev environment to create local mirror tables for development and testing.
Configuration
[dev.externally_managed.tables]# Create local mirror tables for EXTERNALLY_MANAGED tablescreate_local_mirrors = true # Number of sample rows to seed (0 = schema only, no data)sample_size = 1000 # Re-create tables on every dev server startrefresh_on_startup = false| Key | Type | Default | Description |
|---|---|---|---|
create_local_mirrors | Boolean | false | When true, creates local tables matching the schema of externally managed tables. |
sample_size | Integer | 0 | Number of rows to copy from the remote database. Set to 0 to create empty tables (schema only). |
refresh_on_startup | Boolean | false | When true, drops and recreates mirror tables on each moose dev start. |
Remote Credentials
If you have a remote ClickHouse URL configured, Moose will mirror table schemas and sample data from the remote database. Without remote access, tables are created using local schema definitions (empty).
Remote ClickHouse Connection
To mirror data from a production or staging database, configure a remote ClickHouse connection:
[dev.remote_clickhouse]host = "your-clickhouse-host.example.com"port = 8443database = "production_db"use_ssl = trueprotocol = "http"| Key | Type | Default | Description |
|---|---|---|---|
host | String | - | Hostname of the remote ClickHouse server. |
port | Integer | 8443 (SSL) / 8123 (non-SSL) | HTTP port for the remote server. |
database | String | - | Default database to query on the remote server. |
use_ssl | Boolean | true | Whether to use TLS (HTTPS) for connections. |
protocol | String | http | ClickHouse interface protocol — http selects the HTTP interface (vs native). TLS is controlled separately by use_ssl. |
Credential Storage
Credentials (username/password) are not stored in moose.config.toml. On first run, Moose will prompt for credentials and store them securely in your OS keychain. You can also set MOOSE_REMOTE_CLICKHOUSE_USER and MOOSE_REMOTE_CLICKHOUSE_PASSWORD environment variables.
Networking Reference
Reference for default ports and URLs used by the Moose Runtime in development mode.
Default Ports
| Port | Service | Description | Config Key |
|---|---|---|---|
| 4000 | API Server | Main Ingestion/Consumption APIs | http_server_config.port |
| 5001 | Management API | Health checks & Metrics | http_server_config.management_port |
| 18123 | ClickHouse HTTP | OLAP Database (HTTP) | clickhouse_config.host_port |
| 9000 | ClickHouse Native | OLAP Database (TCP) | clickhouse_config.native_port |
| 19092 | Redpanda | Kafka Streaming | redpanda_config.broker |
| 8080 | Temporal UI | Workflow Dashboard | temporal_config.ui_port |
Service URLs
Access points for local development services:
| Service | URL |
|---|---|
| Main API | http://localhost:4000 |
| Management API | http://localhost:5001/metrics |
| OpenAPI Spec | http://localhost:5001/openapi.yaml |
| Temporal UI | http://localhost:8080 |