Habify BaseHabify Base
Courses & LMSHabify Base · Platform Product Team2026-11-267 min read

Building an Online Course Platform (LMS) and Paid Learning Community on Habify Base

Build a leak-resistant online course backend: unlock curriculum automatically upon direct QR payment, protect videos and PDFs behind private signed links, track student completion, and host class discussions.

Private Course VaultShort-Lived Media LinksDirect QR UnlockStudent Live Chat
Online course LMS architecture with RLS enrollment checks, private media links, and class chat

Educators, training centers, and course creators can operate an independent LMS on Habify Base without giving up 20% to 50% marketplace commissions. Build your custom learning UI on Next.js or React while Habify Base powers access control, private course materials, direct payments, and student Q&A.

Combining PostgreSQL enrollment policies with private object storage guarantees that only paid students can request short-lived links to downloadable slides, workbooks, and lesson media.

1. LMS & Paid Learning Community Architecture

Six native capabilities carry students cleanly from browsing public syllabi to completing paid lessons:

LMS CapabilityHabify Base FeaturePractical Benefit
Public course catalogAnon RLS on course syllabus & free preview lessonsSEO-friendly course landing pages with open sample modules
Paid lesson gatingPostgreSQL RLS verifying active enrollment recordsBlocks non-enrolled accounts at the database query layer
Private PDF & media assetsPrivate R2 storage + short-lived Signed URLsPrevents static media URLs from circulating outside class
One-time or membership payDirect BYO Checkout or Project Billing KitUnlocks course enrollment immediately upon webhook arrival
Lesson completion trackingConflict-safe UPSERT on (user_id, lesson_id)Keeps student progress percentages accurate across devices
Cohort Q&A channelsBuilt-in Realtime Chat & NotificationsSupports live mentor discussions without extra chat SaaS

2. Gating Paid Lessons and Tracking Progress via RLS

Allow anonymous browsers to preview lessons marked is_free_preview = true while gating full modules behind an active row in public.enrollments:

sql
CREATE TABLE public.enrollments (
  user_id uuid NOT NULL,
  course_id uuid NOT NULL,
  status text NOT NULL DEFAULT 'active' CHECK (status IN ('active', 'expired', 'refunded')),
  enrolled_at timestamptz NOT NULL DEFAULT now(),
  PRIMARY KEY (user_id, course_id)
);

ALTER TABLE public.enrollments ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.enrollments FORCE ROW LEVEL SECURITY;
CREATE POLICY enrollments_own_read ON public.enrollments
  FOR SELECT USING (user_id::text = current_setting('app.current_user_id', true));

CREATE TABLE public.lessons (
  id uuid PRIMARY KEY DEFAULT gen_random_uuid(),
  course_id uuid NOT NULL,
  title text NOT NULL,
  is_free_preview boolean NOT NULL DEFAULT false,
  material_storage_path text
);

ALTER TABLE public.lessons ENABLE ROW LEVEL SECURITY;
ALTER TABLE public.lessons FORCE ROW LEVEL SECURITY;
CREATE POLICY lessons_preview_or_enrolled ON public.lessons
  FOR SELECT USING (
    is_free_preview = true
    OR EXISTS (
      SELECT 1 FROM public.enrollments e
      WHERE e.course_id = lessons.course_id
        AND e.user_id::text = current_setting('app.current_user_id', true)
        AND e.status = 'active'
    )
  );

4. Automated Welcome Emails & Realtime Student Discussions

The moment checkout unlocks enrollment, send a branded onboarding email through your BYO domain and issue a tax-compliant receipt for individual learners or corporate training teams.

Use built-in Chat and Notification pipelines to power course-specific Q&A channels and announce newly published modules or live review sessions.

Frequently Asked Questions

Can students copy a lesson link and share it publicly outside the course?

No. Signed URLs created by createSignedUrl() carry cryptographic expiration timestamps (e.g., 10 minutes) and automatically stop working once expired.

Can I sell both lifetime one-off courses and monthly memberships?

Yes. Use direct BYO checkouts for one-time course purchases and Project Billing Kit for auto-renewing membership plans.

Does Habify Base handle concurrent students during course launches?

Yes. Per-project PostgreSQL 18 databases pool connections cleanly through PgBouncer with plan tiers scaling from 200 RPM upward plus optional Dedicated Compute Add-ons.

Need a SePay Merchant Account?

Customer VietQR transfers and Visa/Mastercard/JCB card payments settle directly into your own bank account. Register with SePay before connecting credentials in your project.

Related Documentation & Guides

Launch This Architecture in Free Sandbox in 3 Minutes

Spin up an isolated PostgreSQL 18 database, grab your hb_pk_* / hb_sk_* keys, and wire @habifybase/sdk.

More Engineering Articles & Use Cases