- Next.js Backend (TypeScript) — Web deployment on Vercel with Postgres/SQLite
- Rust Backend (Axum) — Desktop application with embedded server and SQLite
Architecture Overview
Both backends implement identical REST APIs for seamless frontend compatibility. The same React frontend can run against either backend without modification.Next.js Backend
Located insrc/app/api/, the Next.js backend provides:
- Web-optimized deployment on Vercel
- Serverless-ready with edge runtime support
- Postgres via Neon Serverless (DATABASE_URL)
- SQLite fallback for local development
Key Files
src/core/routa-system.ts— Core system initializationsrc/app/api/— Next.js API routessrc/core/db/schema.ts— Postgres schemasrc/core/db/sqlite-schema.ts— SQLite schema
Storage Modes
The Next.js backend supports three storage modes (src/core/routa-system.ts:1-290):- InMemory — No database, for quick dev/tests
- Postgres — When DATABASE_URL is set (Neon Serverless)
- SQLite — When ROUTA_DB_DRIVER=sqlite (local file)
Rust Backend
Located incrates/routa-server/, the Rust backend provides:
- Desktop-optimized with embedded server
- Single binary distribution (Tauri)
- SQLite for local persistence
- CLI interface for automation
Crate Structure
API Implementation
The Rust server incrates/routa-server/src/api/ mirrors the Next.js API routes:
/api/health— Health check endpoint/api/agents— Agent management/api/tasks— Task operations/api/workspaces— Workspace CRUD/api/mcp— MCP protocol endpoint/api/acp— ACP protocol endpoint/api/a2a— A2A protocol endpoint
API Parity
Both backends must maintain identical REST API contracts. The project includes validation tools:Database Configuration
Both backends use Drizzle ORM but with different drivers:Next.js (Postgres)
Next.js (SQLite)
Rust (SQLite)
The Rust backend usesrusqlite with the same schema as the TypeScript SQLite implementation.
Development Workflow
Web Development
Desktop Development
Testing Against Both Backends
Why Dual Backend?
Next.js Advantages
- Serverless deployment on Vercel
- Edge runtime support
- Postgres for scalable storage
- Web-optimized caching and routing
Rust Advantages
- Single binary distribution
- No external dependencies (embedded SQLite)
- Better performance for desktop use
- CLI tools for automation
- Offline-first operation
Related Resources
- Database Configuration — Detailed database setup
- Testing Guide — Testing both backends
- Contributing Guide — Development guidelines