Documentation
Database & Prisma
StartupKit uses Prisma with MongoDB. The schema at prisma/schema.prisma includes everything NextAuth needs plus Stripe subscription artifacts, usage tracking, and notification preferences.
Models
- User: Auth profile plus Stripe metadata (
stripeCustomerId,stripeSubscriptionId,stripePriceId,stripeCurrentPeriodEnd, onboarding state, profile info). - Account, Session, VerificationToken,PasswordResetToken: Standard NextAuth tables.
- Subscription: Historical subscription entries for reporting or admin dashboards.
- UsageRecord: Tracks per-feature quotas (api calls, storage, etc.) with start/end periods.
- NotificationPreferences: Stores JSON preferences for emails/alerts.
Workflow
- After editing the schema, run
npx prisma generate. - Use
npx prisma db pushfor quick dev changes ornpx prisma migrate devif you want migration files. - On production deploys, run
npx prisma migrate deploy(Vercel does this in the build script if you add it as a post-build step).
Accessing Prisma
Import the singleton from src/lib/db.ts. The Prisma client is automatically reused in development to avoid exhausting connections.
Seeding / Test Data
StartupKit relies on the actual UI to create demo data which keeps the onboarding instructions simple for customers receiving the zip download. If you want fixtures, add a script under prisma/seed.ts and run npx prisma db seed.
Extending the Schema
- Add extra profile fields to
Userand expose them on/dashboard/account. - Create new collections for your specific product data and query them inside the dashboard routes.
- Update
src/types/next-auth.d.tsif you need to surface new user fields inside the session.