Overview
Therouta server command starts the Routa HTTP backend server, providing REST APIs and WebSocket endpoints for the web UI and external integrations. The server implements the same APIs as the Next.js backend but is built with Rust and Axum for better performance and standalone deployment.
Usage
--host <HOST>- Host to bind to (default:127.0.0.1)--port <PORT>- Port to listen on (default:3210)--static-dir <PATH>- Path to static frontend directory (optional)
Starting the Server
Basic Usage
Start the server with default settings:Custom Host and Port
Bind to a specific host and port:With Static Frontend
Serve static frontend files (Next.js export):- API routes at
/api/* - Static files from the
--static-dirdirectory - Frontend routes for the web UI
Custom Database
Use a specific database file:Server Endpoints
The Routa server provides several endpoint categories:REST APIs
| Endpoint | Description |
|---|---|
GET /api/health | Health check endpoint |
POST /api/rpc | JSON-RPC endpoint for all operations |
GET /api/workspaces | List workspaces |
POST /api/workspaces | Create workspace |
GET /api/agents | List agents |
POST /api/agents | Create agent |
GET /api/tasks | List tasks |
POST /api/tasks | Create task |
GET /api/skills | List skills |
Protocol Endpoints
| Endpoint | Protocol | Description |
|---|---|---|
GET /api/mcp | MCP (SSE) | Model Context Protocol for Claude |
POST /api/acp | ACP (HTTP) | Agent Client Protocol endpoint |
POST /api/a2a | A2A (HTTP) | Agent-to-Agent protocol |
WebSocket
| Endpoint | Description |
|---|---|
WS /api/acp/chat | Real-time chat for ACP agents |
WS /api/events | Event stream for UI updates |
Server Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
ROUTA_DB_PATH | Database file path | routa.db |
RUST_LOG | Logging level | info |
PORT | Server port (fallback) | 3210 |
HOST | Server host (fallback) | 127.0.0.1 |
Logging
Control server logging withRUST_LOG:
Production Deployment
Systemd Service
Create a systemd service file:Docker Deployment
Run the server in a Docker container:Reverse Proxy (Nginx)
Configure Nginx as a reverse proxy:Health Checks
Check server health:Monitoring
Server Logs
View server logs:API Metrics
Monitor API usage:Testing the Server
JSON-RPC Request
Test the RPC endpoint:WebSocket Connection
Test WebSocket withwscat:
Load Testing
Perform load testing withwrk:
Stopping the Server
PressCtrl+C to gracefully stop the server:
- Close all active connections
- Flush database writes
- Clean up resources
- Exit cleanly
Comparison with Next.js Server
The Rust server provides the same APIs as the Next.js backend:| Feature | Rust Server | Next.js Server |
|---|---|---|
| REST APIs | ✅ Identical | ✅ Reference |
| JSON-RPC | ✅ Same protocol | ✅ Same protocol |
| WebSocket | ✅ Native support | ✅ Via ws library |
| MCP (SSE) | ✅ Native support | ✅ Via SSE |
| ACP | ✅ Native support | ✅ Via ACP SDK |
| A2A | ✅ Native support | ✅ Via A2A SDK |
| Database | SQLite only | SQLite + Postgres |
| Static files | Optional | Next.js routing |
| Performance | High (compiled) | Good (JIT) |
| Memory | Low (~50MB) | Higher (~200MB) |
| Deployment | Standalone binary | Node.js runtime |
Troubleshooting
Port Already in Use
If port 3210 is busy:Database Locked
If you see “database is locked”:Permission Denied
If binding to port fails:Next Steps
- Learn about REST APIs
- Explore MCP protocol
- Configure ACP agents
- Set up A2A federation