Architecture
The backend consists of:- Hono HTTP Server: Handles oRPC endpoints and SSE streams
- Schedulers: Background jobs for trading, price tracking, portfolio snapshots
- PostgreSQL: Primary data store
- AI Integrations: Anthropic, OpenRouter, NIM, Mistral APIs
Prerequisites
- VPS with Docker and Docker Compose installed
- PostgreSQL 15+ (can be containerized)
- Domain or subdomain for API (e.g.,
api.autonome.app) - SSL certificate (use Caddy or nginx for HTTPS)
Docker Deployment
Dockerfile
The project includesDockerfile for the backend:
Dockerfile
docker-compose.yml
The full stack configuration:docker-compose.yml
Deployment Steps
1
Prepare VPS
Install Docker and Docker Compose:
2
Clone Repository
3
Configure Environment
4
Build Docker Image
5
Start Services
- Start PostgreSQL and wait for health check
- Run migrations (
db:push) - Seed database with initial models
- Start API server
6
Verify Deployment
Check API health:Expected response:
Environment Variables
Create a.env file with the following configuration:
Core Configuration
AI Provider Keys
Lighter Trading API
Simulator Options
Optional Services
Manual Deployment (Without Docker)
If you prefer not to use Docker:1
Install Dependencies
2
Build API
api/dist/index.js3
Run Migrations
4
Start Server
HTTPS Setup with Caddy
For production, use Caddy as a reverse proxy:Caddyfile
Monitoring
Health Checks
The API exposes health endpoints:Docker Logs
Process Management
Monitor container status:Troubleshooting
Database Connection Fails
Problem:ECONNREFUSED or timeout errors
Solutions:
- Verify
DATABASE_URLformat:postgresql://user:pass@host:port/dbname - Check PostgreSQL is running:
docker-compose ps db - Test connection:
docker exec -it autonome-db psql -U autonome -d autonome - Review firewall rules if using external database
Schedulers Not Starting
Problem: Health check shows schedulers asfalse
Solutions:
- Check API logs:
docker logs autonome-api - Verify environment variables are set correctly
- Ensure trading mode is configured (
TRADING_MODE=simulated) - Check for port conflicts
CORS Errors
Problem: Frontend can’t connect to API Solutions:- Add frontend domain to
CORS_ORIGINS - Restart API after changing environment variables
- Verify frontend is using correct
VITE_API_URL - Check browser console for specific CORS error messages
Updates and Maintenance
Update to Latest Version
Database Backups
View Application Logs
Next Steps
Database Setup
Learn about PostgreSQL configuration and migrations
Frontend Deployment
Deploy the TanStack Start frontend

