TANMAY SINGH
INITIALIZING SYSTEM... 0%
Back to Projects Deck
Full Stackcompleted

Courselly

An enterprise-grade Learning Management System (LMS) built for high performance, secure content delivery, and seamless student enrollment.

Courselly bridges a Headless CMS (Sanity) with Next.js 15 App Router to deliver extremely fast, dynamically rendered pages, utilizing Stripe payment fulfillment and Clerk authentication.

Tech Employed

Next.js 15Sanity CMSClerkStripeTailwind CSSTypeScriptVercel

Project Access

Courselly - An enterprise-grade Learning Management System (LMS) built for high performance, secure content delivery, and seamless student enrollment.

The Core Problem

Building an online learning platform is not simply about displaying videos.

A production-ready Learning Management System must securely authenticate users, process payments, manage enrollments, protect premium content, and provide educators with an intuitive content management workflow—all while remaining fast and scalable.

Most solutions solve these problems independently, resulting in disconnected systems that are difficult to maintain and expensive to scale. The challenge was to design a platform where authentication, content management, payments, and course delivery work together seamlessly without sacrificing performance or developer experience.

"Isolated services create friction. If payments aren't tied directly to secure database states at the edge, student enrollments break and premium content leaks."

Why I Built This

Understanding how modern SaaS infrastructure is engineered.

I wanted to understand how modern SaaS products are engineered behind the scenes. Rather than building another course-selling website, I focused on the infrastructure that powers it—secure authentication, server-side rendering, content management, payment automation, and protected course delivery.

How do we decouple authentication, content rendering, and payment fulfillment?

The goal wasn't just to ship a product. It was to design a modular system where every service has a single responsibility and the entire platform remains scalable, maintainable, and easy to extend.

The Solution

System Architecture

"A serverless, service-oriented architecture, allowing each technology to solve what it is best designed for."

Next.js App Router

Handles server-side rendering, API route handlers, and application routing to deliver instant page loads with minimal client JavaScript.

Sanity CMS

Serves as both the headless content management system and structured data store, powering course creation, modules, and lessons.

Clerk Identity

Manages secure authentication, identity verification, session state, and protects private dashboard routes at the edge.

Stripe Checkout

Processes credit card payments securely and automatically provisions student enrollments through cryptographic signed webhooks.

System Architecture

Every request follows a clearly defined execution pipeline.

This architecture minimizes client-side JavaScript, keeps sensitive operations on the server, and ensures course access is always determined by verified enrollment data rather than client state.

Request Pipeline Flow
STEP 01Clerk MiddlewareEdge Route Protection
STEP 02Server ComponentsRSC Static Rendering
STEP 03Sanity CMSStructured DB Read
STEP 04Server ActionsSecure RPC Mutations
Transaction Scope
STEP 05Stripe CheckoutSecure Gateway Session
STEP 06Webhook VerificationSigned Signature POST
STEP 07Enrollment RegistryCMS Access Document

Secure Enrollment

Purchasing a course is only the beginning of the access lifecycle.

When a student initiates enrollment, the application creates a Stripe Checkout Session through a Server Action. After payment is successfully completed, Stripe sends a signed webhook event back to the application. Only after verifying the webhook signature does the system create an Enrollment document inside Sanity, immediately granting access to the purchased course.

This asynchronous workflow keeps financial operations isolated while maintaining a secure enrollment process.

Enrollment Gating Function

Validates course material access dynamically by ensuring a verified enrollment link document exists between student ID and course ID.

Access(U, C) = ∃ E ∈ Enrollments | E.userId = U ∧ E.courseId = C
Stripe Webhook Verification

Cryptographically matches incoming Stripe event payloads with local endpoint secrets to verify origin authenticity.

const event = stripe.webhooks.constructEvent(
body, signature, process.env.STRIPE_WEBHOOK_SECRET
);
Engineering Highlights
Engineered for security and speed.

By routing dynamic previews through Next.js Draft Mode and building server-first components, the system achieves maximum loading velocity while maintaining strict enrollment gates.

RSC server-first rendering
Sanity CMS Headless core
Clerk route gates
Stripe signed webhooks
Draft Mode live preview
Type-safe Server Actions
Lessons Learned

This project reinforced that scalable software is built by separating responsibilities rather than combining them. Using dedicated services for authentication, content management, and payments significantly simplifies application logic while improving security and maintainability.

It also demonstrated how modern Next.js features—such as React Server Components and Server Actions—can reduce client complexity without sacrificing user experience.

Product Walkthrough

Courselly Landing Interface - Public landing page showcasing featured courses, descriptions, prices, and direct enrollments.
Interface
SLIDE 1 OF 2

Courselly Landing Interface

Public landing page showcasing featured courses, descriptions, prices, and direct enrollments.