Lazer Docs
Getting Started

Installation

Install and configure the Lazer web application.

Installation

This guide walks you through setting up Lazer on your local development environment. By the end, you'll have a running instance of the web application with a seeded database.

Prerequisites Check

Before proceeding, verify that you have:

  • Node.js 18 or higher installed (node --version)
  • PostgreSQL 14 or higher running locally or remotely
  • A Cloudflare R2 account with a bucket created
  • Git installed for cloning the repository

Step 1: Clone the Repository

Clone the Lazer repository to your local machine:

git clone https://github.com/yourusername/lazer_v2.git
cd lazer_v2

Step 2: Install Dependencies

Install all required Node.js packages:

npm install

This will install Next.js, Prisma, React, and all other dependencies defined in package.json.

Note: If you prefer pnpm or yarn, you can use those package managers instead. Lazer has no specific npm-only requirements.

Step 3: Configure Environment Variables

Create a .env file in the project root by copying the example:

cp .env.example .env

Open .env in your text editor and configure the following variables:

Database Configuration

DATABASE_URL="postgresql://username:password@localhost:5432/lazer_dev?schema=public"

Replace username, password, and database name (lazer_dev) with your PostgreSQL credentials. If your database runs on a different host or port, update localhost:5432 accordingly.

Note: The database name (lazer_dev) will be created automatically when you run migrations in Step 4.

Supabase Auth Configuration

NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key"

To obtain these credentials:

  1. Go to your Supabase Dashboard
  2. Select your project (or create a new one)
  3. Navigate to Settings > API
  4. Copy the Project URL and anon public key

Note: The anon key is safe to expose in the browser. It works with Supabase Row Level Security (RLS) to control access.

OpenRouter Configuration

API_KEY="sk-or-v1-your-api-key-here"

Lazer uses OpenRouter for AI-powered script parsing and analysis. Get your API key from OpenRouter.

Note: Script parsing is optional for initial setup. You can leave this blank and add it later if you want to test the application without AI features first.

Cloudflare R2 Configuration

R2_ACCOUNT_ID="your-cloudflare-account-id"
R2_ACCESS_KEY_ID="your-r2-access-key-id"
R2_SECRET_ACCESS_KEY="your-r2-secret-access-key"
R2_BUCKET_NAME="lazer-assets"
R2_PUBLIC_URL="https://your-public-r2-domain.com"

To obtain these credentials:

  1. Log in to your Cloudflare Dashboard
  2. Navigate to R2 in the sidebar
  3. Create a new bucket (e.g., lazer-assets)
  4. Go to Manage R2 API Tokens and create a new API token with read/write permissions
  5. Copy the Access Key ID and Secret Access Key
  6. Set up a public domain for your bucket (optional but recommended for asset URLs)

Note: R2 is S3-compatible. If you prefer AWS S3 or another provider, you can modify the storage configuration in src/lib/storage.ts.

Complete .env.example Format

Your .env file should look like this:

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/lazer_dev?schema=public"

# Supabase Auth
NEXT_PUBLIC_SUPABASE_URL="https://your-project.supabase.co"
NEXT_PUBLIC_SUPABASE_ANON_KEY="your-anon-key"

# AI Provider (OpenRouter)
API_KEY="sk-or-v1-your-api-key-here"
AI_MODEL="anthropic/claude-haiku-4.5"
AI_LOGGING="true"

# Cloudflare R2 Storage
R2_ACCOUNT_ID="your-cloudflare-account-id"
R2_ACCESS_KEY_ID="your-r2-access-key-id"
R2_SECRET_ACCESS_KEY="your-r2-secret-access-key"
R2_BUCKET_NAME="lazer-assets"
R2_PUBLIC_URL="https://your-public-r2-domain.com"

Step 4: Set Up the Database

Create the PostgreSQL database if it doesn't exist:

createdb lazer_dev

Run Prisma migrations to create all required tables:

npx prisma migrate dev

This command will:

  • Create all database tables (projects, scenes, shots, asset versions, etc.)
  • Apply any pending migrations
  • Generate the Prisma Client TypeScript types

Note: The migrate dev command is for development only. For production, use npx prisma migrate deploy.

Step 5: Seed the Database

Populate the database with sample data:

npx prisma db seed

This will create:

  • A sample user account
  • An example project ("Lazer V2")
  • Sample scenes from the Lazer script
  • Example shot structures and prompt packages

Note: You can inspect the seed data in prisma/seed.ts to understand the data model.

Step 6: Start the Development Server

Launch the Next.js development server:

npm run dev

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

You should see output similar to:

  ▲ Next.js 16.0.0
  - Local:        http://localhost:3000
  - Ready in 1.2s

Step 7: Verify Installation

Open your browser and navigate to http://localhost:3000. You should see the Lazer landing page or login screen.

To verify the database connection, check the Prisma Studio (database GUI):

npx prisma studio

This opens a browser-based interface at http://localhost:5555 where you can inspect your database tables and seeded data.

Common Issues

Database Connection Failed

If you see Error: P1001: Can't reach database server, verify:

  • PostgreSQL is running (pg_isready command)
  • Database credentials in .env are correct
  • Database exists (psql -l to list databases)

R2 Upload Errors

If asset uploads fail:

  • Verify R2 credentials are correct
  • Check bucket permissions allow read/write
  • Ensure R2_PUBLIC_URL matches your bucket's public domain

Port Already in Use

If port 3000 is occupied:

PORT=3001 npm run dev

Update your Supabase site URL settings if needed.

Next Steps

Now that Lazer is running, proceed to Your First Project to create a production project and upload a script.

Development Tools

Useful commands for working with Lazer:

# Run type checking
npm run type-check

# Run linter
npm run lint

# Format code
npm run format

# View database schema
npx prisma studio

# Reset database (WARNING: deletes all data)
npx prisma migrate reset

# Generate Prisma Client after schema changes
npx prisma generate

On this page