Quick Start
Prerequisites
- Node.js 20+
- pnpm 9+
- A Cloudflare account (for D1 databases and Workers deployment)
1. Clone and Install
git clone <your-repo-url>cd product-factorypnpm install2. Configure Environment
Copy the checked-in example files and adjust values for the services you want to run:
cp apps/worker-auth/.dev.vars.example apps/worker-auth/.dev.varscp apps/worker-billing/.dev.vars.example apps/worker-billing/.dev.varscp apps/worker-support/.dev.vars.example apps/worker-support/.dev.varscp apps/web/.env.example apps/web/.envFrontend 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:
pnpm billing:setup:stripe-clipnpm billing:setup:creem-clipnpm billing:check-envEach worker requires its own environment configuration. Common variables include:
| Variable | Purpose |
|---|---|
JWT_SECRET | Secret key used by Better Auth session runtime |
AUTH_BASE_URL | Base URL for the auth service |
RESEND_API_KEY | API key for sending transactional emails |
TURNSTILE_SECRET | Cloudflare Turnstile secret for bot protection |
OPS_WEBHOOK_URL | Discord/Feishu webhook for operational notifications |
3. Set Up Databases
Create D1 databases for each service domain:
npx wrangler d1 create auth-dbnpx wrangler d1 create billing-dbnpx wrangler d1 create content-dbnpx wrangler d1 create support-dbnpx wrangler d1 create ai-dbnpx wrangler d1 create admin-dbRun migrations for each database:
pnpm db:migrate4. Start Development
Run all apps and workers in development mode:
pnpm devThis starts:
| App | URL |
|---|---|
| Web (marketing + blog) | http://localhost:4322 |
| Admin console | http://localhost:4321 |
| Docs | http://localhost:4323 |
| Gateway worker | http://localhost:8787 |
| Billing worker | http://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
- Open
http://localhost:4322— the marketing homepage should load. - Click Register to create a test account.
- Log in and verify the dashboard loads with all sections (profile, credits, tickets, etc.).
- Open
http://localhost:4321to access the admin console. - Check
http://localhost:8803/healthif you need to verify the billing worker directly.
Next Steps
- Read Project Structure to understand the codebase layout.
- Check Authentication to understand the auth flow.
- Review API Reference for available endpoints.