← All work
Flagship Production2026 · Backend / Full-Stack Engineer (Contract)

School Platform: Landing + CRM + LMS

Production monorepo for an online exam-prep school · Sole engineer · Since March 2026

Status
Production
Running the school's daily operations since March 2026
Users
Daily use
Used daily by the school's students, teachers and admins

Key decisions

One monorepo behind a single edge proxy

RejectedSeparate deployments for the site, the CRM and the LMS

One routing layer and cross-subdomain SSO mean a single login, one deployment pipeline and shared types between the public site, staff tools and the student LMS.

Prisma & PostgreSQL relational model for CRM and billing

RejectedDecoupled per-service databases

Payment confirmations, lesson billing and course access live in one transactional database, so a payment and the access it grants commit together.

Context

I built the platform solo to replace the rigid off-the-shelf CRM the school was using. It runs the school's daily operations: enrollment, scheduling, attendance, billing, payroll and course delivery.

Architecture

A single Next.js App Router monorepo serves three surfaces behind one edge proxy with cross-subdomain SSO:

  • Public site — the landing and lead intake, feeding applications straight into the CRM.
  • CRM — role-based tools for admins and teachers: students, groups, attendance, balances and payroll.
  • LMS — the student side: lessons, materials and embedded video with per-request access checks.

Inside the product

Screenshots from a local copy seeded with demo data — every name and number below is fictional. The interface is in Russian, the language the school works in.

crm · groups
CRM groups screen: study groups with price per lesson, teacher and student roster
CRM · Groups — each group carries its price per lesson, teacher and roster; billing reads from here.
crm · payroll
CRM payroll screen showing a per-student rate calculation: 23 billable marks times 450 rubles equals 10,350 rubles
CRM · Payroll — teacher pay computed from attendance marks for a period, with the formula shown, before a payout is recorded.
lms · lesson
LMS lesson page with a course outline, completed lessons and a module locked until the subscription is renewed
LMS · Lesson — course outline with progress; module 3 stays locked until the student's subscription is renewed.
lms · AI tutor
LMS AI tutor answering a student's question step by step
LMS · AI tutor — streaming answers scoped to the selected syllabus topic.

Checking the money in production

A reader of my billing write-up asked whether the ledger invariants ever run outside the test suite. They didn't, so the same morning I ran them against production as read-only queries that return the rows breaking a rule.

  • Every online payment reconciled with a credit on the student's balance.
  • A few charges from before the cancel and delete paths learned to offset charges were flagged for correction.
  • Reading the delete path to explain them turned up a live race. It read the lesson's ledger before its transaction started, so an attendance mark landing in that window could leave an orphaned charge. Deletion is now decided inside the transaction under a row lock, covered by a regression test, and was deployed the same day.
  • The checks now run nightly and email a report every night, including clean ones, so a missing report means the check itself broke.

Engineering highlights

  • Billing under concurrency. Production runs lesson billing in SERIALIZABLE transactions with row locks. Extracting the billing core showed that design aborting most concurrent writes, so the open-source version redesigns it around READ COMMITTED and an explicit, deadlock-free lock order.
  • Payment webhooks with a timing-safe secret check, IP allowlist, idempotency keys and server-side re-verification with the provider, so no payment is credited twice or without confirmation.
  • Payroll engine with mid-cycle proration and idempotent lead-to-student conversion.
  • Enumeration-safe login, Postgres-backed rate limiting, and access checks on presigned storage URLs.
  • LLM features in production: a streaming AI tutor in the LMS and a report generator with prompt-injection sanitising, schema validation and hard timeouts.