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

  1. After editing the schema, run npx prisma generate.
  2. Use npx prisma db push for quick dev changes or npx prisma migrate dev if you want migration files.
  3. 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 User and 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.ts if you need to surface new user fields inside the session.