Skip to main content

Getting Started

This guide walks you through setting up Open Genie for local development.

Prerequisites

  • Node.js 20+
  • PostgreSQL 14+ (running and accessible)
  • Ollama installed and running (ollama.com)
  • FFmpeg installed (required for video thumbnails and camera captures)

1. Clone and Install

git clone <repo-url> open-genie
cd open-genie
npm install

2. Environment Variables

Create a .env file in apps/web/:

# Database
DATABASE_URL=postgresql://user:password@localhost:5432/open_genie

# Secrets
AUTH_SECRET=your-session-signing-secret # min 32 chars — signs web session cookies
GENIE_JWT_SECRET=your-jwt-secret-min-32-chars # signs device access/refresh tokens

# Ollama
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_DEFAULT_MODEL=granite4:350m
OLLAMA_VISION_MODEL=llava:latest

# Storage
GENIE_STORAGE_PATH=./data/files

# Server
PORT=3000
NODE_ENV=development

# Google OAuth (for web UI sign-in — optional in dev)
AUTH_GOOGLE_ID=your-google-client-id
AUTH_GOOGLE_SECRET=your-google-client-secret

# Push Notifications (optional)
# FIREBASE_SERVICE_ACCOUNT=path/to/firebase-service-account.json
# EXPO_ACCESS_TOKEN=your-expo-access-token

Required Variables

VariableDescription
DATABASE_URLPostgreSQL connection string
AUTH_SECRETSecret for signing web session cookies (min 32 chars)
GENIE_JWT_SECRETSecret for signing device JWT tokens (min 32 chars)

Optional Variables

VariableDefaultDescription
OLLAMA_BASE_URLhttp://localhost:11434Ollama server URL
OLLAMA_DEFAULT_MODELgranite4:350mDefault chat model
OLLAMA_VISION_MODELllava:latestVision analysis model
GENIE_STORAGE_PATH./data/filesFile storage root directory
PORT3000Server port

3. Database Setup

Generate and run migrations:

# Generate migration files from the schema
npm run db:generate

# Apply migrations to the database
npm run db:migrate

To explore the database interactively:

npm run db:studio

This opens Drizzle Studio in your browser.

4. Pull Ollama Models

Make sure you have the required models downloaded:

ollama pull granite4:350m # Default chat model
ollama pull llava:latest # Vision model (for camera analysis)

5. Start the Dev Server

npm run web:dev

This runs two processes concurrently:

  • Hono API server on http://localhost:3000 (tsx watch server.ts)
  • Vite dev server on http://localhost:5173 with HMR

In development, point your browser to the Vite dev server (http://localhost:5173). It proxies /api/* requests to the Hono server automatically.

6. Verify

Open http://localhost:5173 in your browser to access the web UI (or http://localhost:3000/api/status to check the backend directly).

Check the health endpoint:

curl http://localhost:3000/api/status

npm Scripts (from repo root)

ScriptDescription
npm run web:devStart dev server with HMR (Hono + Vite concurrently)
npm run web:buildBuild for production (Vite SPA + server bundle)
npm run web:startStart production server
npm run db:migrateRun pending migrations
npm run db:studioOpen Drizzle Studio GUI

From apps/web/ directly

ScriptDescription
npm run devSame as web:dev
npm run buildBuild both client (vite build) and server (tsc)
npm run startProduction: tsx server.ts
npm run db:generateGenerate Drizzle migration files from schema
npm run db:migrateApply pending migrations
npm run db:pushPush schema directly (skip migrations, dev only)
npm run db:studioOpen Drizzle Studio GUI
npm run preflightRun preflight checks and print a status report