Development Setup
This guide covers setting up a local development environment for contributing to Station.Prerequisites
| Requirement | Version | Purpose |
|---|---|---|
| Go | 1.21+ | Core language |
| Docker | Latest | Jaeger, sandbox, integration tests |
| Make | Any | Build automation |
| Git | Any | Version control |
Optional
| Requirement | Purpose |
|---|---|
| Node.js 18+ | Building documentation |
| SQLite CLI | Database debugging |
| Jaeger | Distributed tracing |
Clone and Build
Project Structure
Running Locally
Start the Server
Create a Test Environment
Run an Agent
Configuration
Default Paths
| Platform | Config Directory |
|---|---|
| Linux/macOS | ~/.config/station/ |
| Windows | %APPDATA%\station\ |
Configuration File
Createconfig.yaml:
Environment Variables
| Variable | Description | Default |
|---|---|---|
OPENAI_API_KEY | OpenAI API key | - |
GOOGLE_API_KEY | Google AI API key | - |
STN_AI_PROVIDER | AI provider override | openai |
STN_AI_MODEL | AI model override | gpt-5-mini |
STN_DATABASE_URL | Database path | ~/.config/station/station.db |
STN_WORKSPACE | Environments path | ~/.config/station/environments |
STN_API_PORT | API server port | 8585 |
STN_MCP_PORT | MCP server port | 8586 |
Starting Infrastructure
Jaeger (Distributed Tracing)
libsql (Optional Cloud Database)
For cloud database development:IDE Setup
VS Code
Recommended extensions:GoLand / IntelliJ
- Open the
station/directory as a Go project - Enable “Go Modules integration”
- Configure GOROOT to Go 1.21+
Makefile Targets
Common Development Tasks
Adding a New CLI Command
- Create handler in
cmd/main/handlers/<domain>/ - Register command in
cmd/main/main.go - Add tests in
cmd/main/handlers/<domain>/*_test.go
Adding a New Service
- Create service in
internal/services/<name>.go - Define interface if needed
- Add to service registry if applicable
- Write tests in
internal/services/<name>_test.go
Adding a New API Endpoint
- Add handler in
internal/api/v1/<resource>.go - Register route in
internal/api/v1/routes.go - Add tests in
internal/api/v1/<resource>_test.go
Adding a New MCP Tool
- Add handler in
internal/mcp/handlers/ - Register in
internal/mcp/server.go - Update tool discovery if needed
Debugging
Enable Debug Logging
Database Inspection
Tracing with Jaeger
- Start Jaeger (see above)
- Configure telemetry in
config.yaml - Run agents and view traces at http://localhost:16686
Station Lattice Development
Station Lattice enables multi-station mesh networking. This section covers development-specific workflows.Running Lattice Locally
Key Lattice Directories
| Directory | Purpose |
|---|---|
internal/lattice/ | Core lattice implementation |
internal/lattice/work/ | JetStream work tracking |
cmd/main/lattice_commands.go | CLI commands |
bundles/demo/ | Demo bundles for testing |
NATS Subject Conventions
| Subject Pattern | Purpose |
|---|---|
lattice.station.{id}.heartbeat | Station presence heartbeats |
lattice.agent.invoke.{agent} | Request-reply agent invocation |
lattice.work.assign.{station} | Async work assignment |
lattice.work.result.{work_id} | Work completion results |
Adding New Message Types
- Define the message struct in
internal/lattice/messages.go:
- Add publisher function in appropriate file:
Testing Lattice Code
Common Gotchas
- Always close NATS connections - Use
defer client.Close()to prevent resource leaks - JetStream KV eventual consistency - Allow small delays when testing KV operations
- Port conflicts - Use unique ports in tests to avoid conflicts with running stations
- Heartbeat timing - Default heartbeat is 5s; tests may need shorter intervals

