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.
Engineering highlights
- Race-safe lesson billing. After a review showed
SERIALIZABLE+FOR UPDATEaborting concurrent writes, I redesigned it aroundREAD COMMITTEDwith an explicit, deadlock-free lock order. The billing core is open source. - 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.