Contributing

Get Dictumal running locally and start contributing.

Prerequisites

  • Node.js 18+ and npm
  • PostgreSQL database (local or hosted)
  • A Google Cloud OAuth client (for authentication)
  • An OpenRouter API key (for AI features)
  • A DigitalOcean API token (required only if testing deployment flows)

Local Setup

  1. Clone the repo
    git clone https://github.com/your-org/dictumal.git
    cd dictumal/dictumal
  2. Install dependencies
    npm install
  3. Set up environment variables

    Copy .env.example to .env and fill in the values:

    DATABASE_URL="postgresql://user:pass@localhost:5432/dictumal"
    AUTH_URL="http://localhost:3000"
    AUTH_SECRET="your-random-secret"
    GOOGLE_CLIENT_ID="your-google-client-id"
    GOOGLE_CLIENT_SECRET="your-google-client-secret"
    OPENROUTER_API_KEY="your-openrouter-key"
    DIGITALOCEAN_API_TOKEN="your-do-token"  # optional
    DIGITALOCEAN_IMAGE_SLUG="ubuntu-24-04-x64"  # optional explicit pin
    DIGITALOCEAN_USE_LATEST_UBUNTU_IMAGE="false"  # optional; defaults to false
    DIGITALOCEAN_SSH_KEYS="123456,aa:bb:cc:dd"  # optional DO SSH key ids/fingerprints
    NEXT_PUBLIC_STREAM_GATEWAY_HOST="stream.the-next-lab.com"  # optional launch host override
  4. Run database migrations
    npx prisma migrate dev
  5. Generate the Prisma client
    npx prisma generate
  6. Start the dev server
    npm run dev

    Open http://localhost:3000 in your browser.

Google OAuth Setup for Local Dev

In your Google Cloud Console OAuth client configuration, add:

  • Authorized JavaScript origins: http://localhost:3000
  • Authorized redirect URIs: http://localhost:3000/api/auth/callback/google

Project Structure

All application code lives in the dictumal/ subdirectory:

  • src/app/ — Next.js App Router pages and API routes
  • src/components/ — Reusable React components
  • src/lib/ — Shared utilities (auth, Prisma, AI, deploy)
  • prisma/ — Database schema and migrations

Common Commands

CommandDescription
npm run devStart the development server
npm run buildBuild for production
npx prisma migrate devRun pending migrations
npx prisma generateRegenerate the Prisma client after schema changes
npx prisma studioOpen the Prisma database GUI

Environment Variables

VariableRequiredDescription
DATABASE_URLYesPostgreSQL connection string
NEXTAUTH_URLYesLegacy alias for auth base URL (prefer AUTH_URL)
NEXTAUTH_SECRETYesLegacy alias for auth secret (prefer AUTH_SECRET)
AUTH_URLYesBase URL used by NextAuth v5
AUTH_SECRETYesSession/JWT signing secret used by NextAuth v5
GOOGLE_CLIENT_IDYesGoogle OAuth client ID
GOOGLE_CLIENT_SECRETYesGoogle OAuth client secret
OPENROUTER_API_KEYYesOpenRouter API key for AI features
DIGITALOCEAN_API_TOKENRequired for deployDigitalOcean API token for droplet create/get/delete
DIGITALOCEAN_IMAGE_SLUGNoOverride droplet image slug (default is pinned ubuntu-24-04-x64)
DIGITALOCEAN_USE_LATEST_UBUNTU_IMAGENoIf true, auto-select latest Ubuntu image from DigitalOcean catalog
DIGITALOCEAN_SSH_KEYSNoComma-separated DigitalOcean SSH key IDs or fingerprints
NEXT_PUBLIC_STREAM_GATEWAY_HOSTNoPreferred host for launch redirects. Defaults to stream.the-next-lab.com; falls back to deployment IP when blank.

Deployment Debug Checklist

  • DIGITALOCEAN_API_TOKEN present and not placeholder text.
  • Account has droplet quota and selected region/size capacity.
  • If route calls return 401, verify auth env values and Google OAuth callback URL alignment.
  • If deployment times out, inspect droplet /var/log/dictumal-init.log.