Skip to content

Quick Start

Prerequisites

  • Node.js 20+
  • pnpm 9+
  • A Cloudflare account (for D1 databases and Workers deployment)

1. Clone and Install

Terminal window
git clone <your-repo-url>
cd product-factory
pnpm install

2. Configure Environment

Copy the checked-in example files and adjust values for the services you want to run:

Terminal window
cp apps/worker-auth/.dev.vars.example apps/worker-auth/.dev.vars
cp apps/worker-billing/.dev.vars.example apps/worker-billing/.dev.vars
cp apps/worker-support/.dev.vars.example apps/worker-support/.dev.vars
cp apps/web/.env.example apps/web/.env

Frontend apps read build-time env vars such as GATEWAY_URL, PUBLIC_SUPPORT_API, and PUBLIC_APP_KEY. Additional examples are available in apps/admin/.env.example, apps/platform/.env.example, and apps/docs/.env.example.

For the full code-verified inventory, see Environment Variables and docs/deployment/environment-variable-inventory.md.

For local billing work, run:

Terminal window
pnpm billing:setup:stripe-cli
pnpm billing:setup:creem-cli
pnpm billing:check-env

Each worker requires its own environment configuration. Common variables include:

VariablePurpose
JWT_SECRETSecret key used by Better Auth session runtime
AUTH_BASE_URLBase URL for the auth service
RESEND_API_KEYAPI key for sending transactional emails
TURNSTILE_SECRETCloudflare Turnstile secret for bot protection
OPS_WEBHOOK_URLDiscord/Feishu webhook for operational notifications

3. Set Up Databases

Create D1 databases for each service domain:

Terminal window
npx wrangler d1 create auth-db
npx wrangler d1 create billing-db
npx wrangler d1 create content-db
npx wrangler d1 create support-db
npx wrangler d1 create ai-db
npx wrangler d1 create admin-db

Run migrations for each database:

Terminal window
pnpm db:migrate

4. Start Development

Run all apps and workers in development mode:

Terminal window
pnpm dev

This starts:

AppURL
Web (marketing + blog)http://localhost:4322
Admin consolehttp://localhost:4321
Docshttp://localhost:4323
Gateway workerhttp://localhost:8787
Billing workerhttp://localhost:8803

Use the gateway URL for normal app requests so session and role context are attached. Use the billing worker URL only for local worker debugging, health checks, and signed webhook testing.

5. Verify the Setup

  1. Open http://localhost:4322 — the marketing homepage should load.
  2. Click Register to create a test account.
  3. Log in and verify the dashboard loads with all sections (profile, credits, tickets, etc.).
  4. Open http://localhost:4321 to access the admin console.
  5. Check http://localhost:8803/health if you need to verify the billing worker directly.

Next Steps