A simple e-learning app built with Next.js (App Router), Clerk auth, Prisma + Postgres (Neon adapter), and Stripe checkout.
- Browse courses:
/Courses - View a course landing page (and buy if paid):
/course/[id] - Access course content if you’re the instructor or enrolled:
/course/[id]/view - Instructor dashboard (manage your courses):
/dashboard - Course builder (chapters + lessons):
/Courses/[id]/manage
- Web: Next.js 16, React 19, Tailwind
- Auth: Clerk (
@clerk/nextjs) - DB: Prisma + Postgres (
@prisma/adapter-neon,@neondatabase/serverless) - Payments: Stripe (Checkout + webhook)
Use whatever package manager you’re using in this repo (scripts show pnpm, but npm/yarn can work too).
pnpm installCopy the template and fill in values:
cp .env.example .envRequired variables are in .env.example:
DATABASE_URLNEXT_PUBLIC_CLERK_PUBLISHABLE_KEYCLERK_SECRET_KEYSTRIPE_SECRET_KEYSTRIPE_WEBHOOK_SECRETNEXT_PUBLIC_APP_URL
This repo uses Prisma. Apply migrations (or create your own workflow) and generate the client:
pnpm prisma generate
pnpm prisma migrate devOptional: seed sample data (users, courses, chapters, lessons, enrollments):
pnpm db:seedpnpm devApp runs at http://localhost:3000 by default.
- Roles: the app checks
user.publicMetadata.rolefrom Clerk."INSTRUCTOR"gets the instructor dashboard + course builder; everyone else is treated as a student. - Course access:
/course/[id]/viewis gated. You can view if you are the course instructor or have an Enrollment record for that course. - Stripe webhook:
POST /api/webhooks/stripelistens forcheckout.session.completed. It records the event and upserts anEnrollmentusingsession.metadata.userIdandsession.metadata.courseId.
pnpm dev: run Next dev serverpnpm build: buildpnpm lint: lintpnpm db:seed: seed the DB fromprisma/seed.js