Developer Guide

Getting Started

Set up OpenStory for local development

OpenStory is an open-source AI video production platform. This guide walks you through setting up a local development environment.

Prerequisites

Nothing else. No Docker, no external database, no Cloudflare account — local dev runs the full stack (D1, R2, Workflows, Durable Objects, email) inside Workerd via Miniflare.

Quick Start

# Clone the repository
git clone https://github.com/openstory-so/openstory.git
cd openstory

# Install and run
bun install
bun dev

bun dev does everything: it generates .env.local (with auth/encryption secrets) on first run, migrates and seeds the local database, and starts the dev server.

The app will be available at http://localhost:3000.

To expose worktrees on public HTTPS (Google OAuth, inbound webhooks), see Local dev tunnels. Ordinary bun dev does not need this. Ports 3000–3009 are reserved for those worktrees; e2e uses 3020.

AI Keys

To use AI generation features you need two API keys — run bun setup to add them interactively, or paste them into .env.local:

  • FAL_KEY — fal.ai for image, video & audio generation
  • OPENROUTER_KEY — OpenRouter for LLM script analysis

Environment Variables

See .env.example for the full list of available environment variables, including optional services like Google OAuth, Stripe, PostHog, and remote R2 storage.

Database

Local development uses a Cloudflare D1 database (Miniflare-backed SQLite) via Drizzle ORM — no account or remote service required. bun dev migrates and seeds it automatically.

# Generate migrations from schema changes
bun db:generate

# Apply migrations to the local D1 database
bun db:migrate:local

# Open Drizzle Studio against the local D1 database
bun db:studio:local

Production deployments use Cloudflare D1. See the Cloudflare deployment guide for details.

Next Steps