Production-oriented course platform built with Next.js 16, Prisma 7, Supabase Postgres and Storage, NextAuth, Stripe Checkout, and Mux Video.
- Email magic-link authentication with user and admin roles
- Admin CRUD for courses and modules
- Draft/publish workflow that exposes only courses with ready videos
- Permanent protection against deleting published or purchased courses
- Resumable direct video uploads to Mux with verified webhooks
- Automatic video processing status and duration synchronization
- Stripe Checkout with webhook-based, idempotent course fulfillment
- Versioned checkout consent for immediate digital access and withdrawal waiver
- Transactional purchase confirmation and authenticated online withdrawal flow
- Purchased-course area under
/profile - Monotonic learner progress, 90% completion, and 10-day module unlocks
- Copy
.env.exampleto.envand configure each service. - Install dependencies with
pnpm install. - Apply migrations with
pnpm db:deploy. - Start the app with
pnpm dev -- --port 3001.
Run the complete local verification with:
pnpm checkConfigure these public endpoints in the matching service environment:
- Mux:
/api/mux/webhook - Stripe:
/api/stripe/webhook
Set MUX_WEBHOOK_SECRET and STRIPE_WEBHOOK_SECRET to the signing secrets for those exact endpoints. For Mux, enable direct-upload and asset lifecycle events, including ready, errored, and cancelled events.
For Stripe, enable checkout completion events plus charge.refunded, refund.created, and refund.updated so full refunds revoke course access and partial refunds remain visible without revoking it.
The pages under /[locale]/legal are operational drafts and are excluded from search indexing. Before production, replace the placeholder seller, privacy, support, jurisdiction, and retention details with professionally reviewed copy. Bump LEGAL_DOCUMENT_VERSION whenever accepted legal wording changes so each purchase keeps the exact accepted version.
Before releasing a new version:
- Configure all variables from
.env.examplein the production environment. - Set
NEXTAUTH_URLandNEXT_PUBLIC_APP_URLto the exact production HTTPS origin; never use localhost in a deployed environment. - Run
pnpm db:deployagainst the production database. - Run
pnpm check. - Replace and approve all draft legal content, then bump its document version.
- Verify one magic-link login, one Mux upload through playback, one Stripe test purchase with confirmation email, and one eligible withdrawal/refund using production webhook URLs with test-mode credentials before enabling live payments.
Never commit .env files or service credentials.