Phase 1 establishes the project foundation for the first complete loop:
Demo Next.js website -> browser SDK -> ingestion API -> PostgreSQL/Prisma -> dashboard.
This does not implement the full SaaS, AI explanations, billing, auth, queues, or large-scale analytics stores.
apps/dashboard- Next.js dashboard shell for future analytics views.apps/api- Next.js API surface for event ingestion.apps/demo-nextjs- Demo Next.js website wired to the browser SDK.packages/event-schema- Zod schemas and TypeScript event contracts.packages/sdk- Browser SDK boundary for collecting and sending events.packages/ui- Shared React UI primitives.prisma- PostgreSQL data model and initial migration.tests- Foundation tests for shared event validation.docs- Phase notes and implementation boundaries.
- Install dependencies:
npm install- Copy environment values:
cp .env.example .env- Start PostgreSQL with Docker:
docker compose up -d postgres- Generate Prisma client and apply the initial migration:
npm run prisma:generate
npm run prisma:migrateIf Prisma's Windows migration engine is blocked locally, apply the same schema SQL with:
npm run db:apply- Start all apps:
npm run devBy default, the apps are configured for:
- Dashboard:
http://localhost:3000 - API:
http://localhost:3001 - Demo site:
http://localhost:3002
npm run typecheck
npm test- Open the dashboard at
http://localhost:3000. - Open the demo site at
http://localhost:3002. - Click the CTA, focus the email field, and submit the form.
- Refresh the dashboard to see live event, visitor, session, and conversion counts.
Check stored database totals with:
npm run db:status