Skip to content

πŸ“š 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.

License

Notifications You must be signed in to change notification settings

maciekt07/nextjs-math-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Next.js Math Course Platform

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.

GitHub code size in bytes GitHub created at GitHub last commit GitHub License

Tech Stack

Landing Lesson

Features

  • 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 headless 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 and SEO, while paid lessons use server-side rendering for secure, on-demand access.
  • Caching & Revalidation – lesson and enrollment data are cached for performance and automatically refreshed via Payload CMS hooks or Stripe webhook when content or access changes.
  • Protected media – paid lesson images restricted to enrolled users, with auto-generated blur placeholders and optional AWS S3 / Cloudflare R2 storage
  • Mux Video Integration – video uploads through CMS and streaming, 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

Installation Steps

1. Clone the Repository

git clone https://github.com/maciekt07/nextjs-math-course cd nextjs-math-course

2. Install Dependencies

npm install

3. Set Up Environment Variables

Create a .env file in the root directory. Use .env.example as a template. Environment variables are fully typed and validated for both dev and build.

4. Start Databases

Both PostgreSQL (for main app data) and MongoDB (for Payload CMS) run via Docker Compose

docker compose up -d

Tip

View Database with Drizzle Studio

npm run db:studio

5. Apply Database Migrations

npm run db:push

6. Run the Stripe webhook listener

npm run stripe:webhook

Testing Payments

Use these Stripe test card details to simulate a successful payment:

  • Card Number: 4242 4242 4242 4242
  • Expiration Date: Any future date
  • CVC: Any 3-digit code

7. Run the App

Development mode:

npm run dev

Production preview:

npm run preview

The application should now be running at http://localhost:3000

8. Access Payload CMS Admin Panel

Once the app is running, you can access the CMS at:

http://localhost:3000/admin

  • Create your admin account on first visit

  • Use the panel to manage courses, lessons, and media

Usage

Using Desmos Graphs

You can add interactive Desmos graphs directly in markdown lessons:

::desmos{url="https://www.desmos.com/calculator/your-graph-id"}
Desmos Graph

Note

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}

Using LaTeX in Markdown

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

Using Callout Blocks

You can highlight important content or tips using custom callout blocks like note, tip, important, warning, etc.

:::note This is a note ::: :::tip{title="Remember"} This is a tip with a custom title :::
Callout block

Reordering Lessons

  1. Go to the Lessons collection in the CMS.
  2. In the top-right, open Filters β†’ Add Filter.
  3. Select course β†’ equals β†’ your course.
  4. Use drag-and-drop to reorder the filtered lessons.

Performance

lighthouse

Math rendering

In paid lessons, math formulas are rendered lazily on the client as it scrolls into view, preventing main-thread blocking and avoiding FPS drops on long pages with many formulas. Free lessons are fully SSGed, which requires no special optimization and also benefits SEO.

Credits

Illustrations used in this project are from Storyset, modified for personal use.

Made with ❀️ by maciekt07, licensed under MIT

About

πŸ“š 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.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages