A modern full-stack Next.js 15 platform with CMS, auth, and Stripe integration - built to manage and sell online math courses with videos, quizzes, LaTeX, and interactive graphs.
- Full Authentication with BetterAuth - secure login, registration, and email verification powered by Resend.
- Admin CMS Dashboard - manage courses, lessons, and media directly through an integrated Payload CMS interface.
- Stripe Payments - sell courses with one-time payments using Stripe Checkout.
- Hybrid Lesson Delivery (SSR + SSG) - free lessons are pre-rendered for speed, while paid lessons use server-side rendering for secure, on-demand access.
- Protected media β paid lesson images restricted to enrolled users, with optional AWS S3 / Cloudflare R2 storage
- Blurred Image Placeholders β images load fast with smooth, auto-generated blur previews.
- Mux Video Integration β video uploads and streaming through CMS, with signed URLs ensuring only enrolled users can access paid video lessons.
- LaTeX and Interactive Desmos Graphs β Lessons feature interactive graphs and clean LaTeX formatting, with settings like larger math font or colored symbols
- Node.js (v18 or higher)
- npm package manager
- Docker Desktop
- Git
git clone https://github.com/maciekt07/nextjs-math-course
cd nextjs-math-coursenpm installCreate a .env file in the root directory. Use .env.example as a template.
Both PostgreSQL (for main app data) and MongoDB (for Payload CMS) run via Docker Compose
docker compose up -dTo verify the database is running:
docker compose psnpm run stripe:webhooknpm run devThe application should now be running at http://localhost:3000
Once the app is running, you can access the CMS at:
-
Create your admin account on first visit
-
Use the panel to manage courses, lessons, and media
You can add interactive Desmos graphs directly in markdown lessons:
::desmos{url="https://www.desmos.com/calculator/your-graph-id"}
By default, the embedded version displays only the graph.
If you set noEmbed=true, it will open the full Desmos calculator with all its tools and controls.
::desmos{url="https://www.desmos.com/calculator/your-graph-id" noEmbed=true}You can include math expressions in your lessons using standard Markdown + LaTeX syntax:
Inline math: $E = mc^2$
Block math:
$$
f'(x) = \lim_{h \to 0} \frac{f(x+h) - f(x)}{h}
$$For more details, see the Markdown + LaTeX documentation
docker compose exec db psql -U postgres -d math_coursenpm run db:studioThis opens a visual database browser at https://local.drizzle.studio
docker compose downIllustrations used in this project are from Storyset, modified for personal use.