Development Setup
This guide covers setting up a local development environment for contributing to Station.Prerequisites
Optional
Clone and Build
Project Structure
Running Locally
Start the Server
Create a Test Environment
Run an Agent
Configuration
Default Paths
Configuration File
Createconfig.yaml:
Environment Variables
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
NATS Subject Conventions
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
Next Steps
Architecture
Deep dive into system architecture
Testing
Running and writing tests

