Architecture Overview
The application consists of two main components:- Frontend (Vercel): TanStack Start SPA serving the React UI
- Backend (VPS): Hono API server handling business logic, database, and AI integrations
Why Split Deployment?
Frontend on Vercel
- Global edge deployment for low-latency UI delivery
- Automatic HTTPS and CDN
- Zero-config deployments from Git
- Optimized for static assets and SSR
Backend on VPS
- Full control over persistent processes (schedulers, trading bots)
- Direct PostgreSQL connection without serverless cold starts
- Long-running WebSocket/SSE connections for real-time data
- Cost-effective for CPU-intensive AI operations
Communication Protocol
The frontend communicates with the backend via oRPC over HTTP:- RPC Endpoint:
POST /api/rpc/*- Type-safe remote procedure calls - SSE Endpoints:
/api/events/*- Real-time data streams (positions, trades, portfolio) - Health Check:
/health- Server status and scheduler monitoring
In development, Vite proxies
/api/* requests to the backend server automatically. In production, the frontend makes direct HTTP calls to the deployed API server.Port Configuration
Three environment variables control how services communicate:| Variable | Scope | Purpose | Example |
|---|---|---|---|
PORT | Backend only | API server listening port | 8081 |
FRONTEND_PORT | Dev only | Vite dev server port | 5173 |
VITE_API_URL | Client-exposed | Backend URL for browser requests | https://api.autonome.app |
Deployment Workflow
Deploy Backend First
Deploy the Hono API server to your VPS with PostgreSQL access. Run migrations and verify health checks.
Configure Frontend
Set
VITE_API_URL to point to your deployed backend (e.g., https://api.autonome.app).Environment Variables by Deployment Target
Frontend (Vercel)
Backend (VPS)
The backend requires many more environment variables because it handles AI integrations, database connections, and trading APIs. The frontend only needs minimal configuration.
Next Steps
Deploy Frontend
Deploy the TanStack Start app to Vercel
Deploy Backend
Deploy the Hono API server to your VPS
Database Setup
Configure PostgreSQL and run migrations

