Skip to main content

Prerequisites

Before you begin, ensure you have the following installed:
  • Bun >= 1.1 (package manager and runtime)
  • Node.js 18+ (for compatibility)
  • PostgreSQL 15+ (local or hosted)
  • Git (for version control)
Autonome uses Bun exclusively as its package manager. Never use npm or pnpm.

Installation Steps

1. Clone the Repository

2. Install Dependencies

Use Bun to install all project dependencies:
This will install all packages defined in package.json, including:
  • TanStack Start framework
  • React 19 and related libraries
  • Database tools (Drizzle ORM)
  • AI SDK and provider integrations
  • UI components (shadcn/ui, Tailwind CSS v4)

3. Configure Environment Variables

Copy the example environment file and configure it:
Edit .env and fill in the required values:

Required Variables

Optional Variables

Environment Variable Naming:
  • PORT and FRONTEND_PORT are server-side only (accessed via process.env)
  • Variables prefixed with VITE_ are exposed to the browser (accessed via import.meta.env)
  • Always use src/env.ts (T3Env) instead of accessing process.env directly

4. Set Up PostgreSQL Database

Local PostgreSQL Setup

If you don’t have PostgreSQL installed: macOS (Homebrew):
Ubuntu/Debian:
Create Database:
Update your DATABASE_URL in .env:

Using Hosted PostgreSQL

Alternatively, use a hosted PostgreSQL service:
  • Supabase: Free tier with generous limits
  • Neon: Serverless PostgreSQL with branching
  • Railway: Simple deployment and database hosting

5. Run Database Migrations

Apply the database schema:
This creates all necessary tables with Drizzle’s quoted identifiers (e.g., "Models", "Orders", "Trades").
Use bun run db:studio to launch Drizzle Studio and visually inspect your database schema.

6. Seed the Database (Optional)

Populate the database with default AI models:
This creates entries in the "Models" table for the four trading variants:
  • Apex: Aggressive high-frequency trading
  • Trendsurfer: Momentum-based trading
  • Contrarian: Counter-trend strategies
  • Sovereign: Conservative long-term positions

Running the Development Servers

Autonome has a split architecture with separate frontend and backend servers:

Development Commands

Run Both Servers Concurrently

This starts:
  • API server on port 8081 (Hono backend)
  • Frontend server on port 5173 (Vite + TanStack Start)
Use this command for full-stack development.

Run API Server Only

Starts the Hono API server with hot reload on port 8081. Use when:
  • Working on backend logic, oRPC procedures, or database queries
  • Testing API endpoints independently
  • Running the scheduler bootstrap

Run Frontend Only

Starts the Vite dev server with TanStack Start on port 5173. Use when:
  • Working on UI components and styles
  • The API server is already running separately
  • Testing frontend-only changes
Vite Proxy Configuration: The frontend dev server automatically proxies /api/* requests to the backend API server at http://localhost:8081. This is configured in vite.config.ts.

When to Use Each Command

Verifying Your Setup

1. Check Environment Configuration

Run the environment validation script:
This verifies all required environment variables are set correctly.

2. Access the Application

Once the dev servers are running:

3. Test Database Connection

Open Drizzle Studio to verify database connectivity:
This opens a web interface at http://localhost:4983 to browse your database.

Troubleshooting

Port Already in Use

Error: EADDRINUSE: address already in use Solution: Check if another process is using the port:
Or change the ports in your .env file:

Database Connection Failed

Error: Connection refused or authentication failed Solutions:
  1. Verify PostgreSQL is running:
  2. Check DATABASE_URL format:
  3. Test connection manually:

Bun Installation Issues

Error: bun: command not found Solution: Install Bun:

Module Resolution Errors

Error: Cannot find module '@/...' Solution: Ensure TypeScript path aliases are configured. Check tsconfig.json:
Then restart the dev server.

Migration Errors

Error: relation "Models" does not exist Solutions:
  1. Generate migrations after schema changes:
  2. Apply migrations:
  3. Reset database (destructive):

Vite Build Errors

Error: Build fails with TypeScript errors Solution: Run type checking:
Fix any reported type errors before running the dev server.

API Proxy Not Working

Symptom: Frontend can’t reach API endpoints Solutions:
  1. Verify API server is running:
  2. Check VITE_API_URL in .env:
  3. Restart frontend dev server after changing environment variables.

Next Steps

Now that your development environment is set up:
  1. Explore the codebase: Review Architecture to understand the project structure
  2. Run tests: See Testing for testing strategies
  3. Follow code style: Read Code Style for Biome rules and conventions
  4. Start coding: Check out the Contributing Guide for development workflow
Use bun run dev:all with TRADING_MODE=simulated to test trading strategies without connecting to real exchanges.