Online Campus: payments you can trust on a learning platform
The backend for a business school's online campus: course sales, timed quizzes and certificates anyone can verify.
- Role
- Backend and DevOps engineer
- Timeline
- Apr 2026 to Sept 2026
- Status
- Live at ebschool.org
- Stack
- NestJS, Fastify, Prisma, Postgres, BullMQ, Paystack
- Problem
- A business school needed to sell courses, run timed assessments and issue certificates, with payments that never double-enroll or go missing.
- What I did
- Built the backend and ran its infrastructure, alongside a frontend engineer and a designer: idempotent Paystack fulfilment with a reconciliation job, server-owned quiz deadlines, and certificates rendered on a queue.
- Result
- Live with paying students working through lessons and timed quizzes, with verifiable certificates ready for the first completions.

The system
Students pay, take timed assessments and receive certificates, and each of those is a promise. A payment has to enroll exactly once even when the provider sends the webhook twice or not at all. A quiz deadline has to hold even if the browser lies about the time.
Backend and DevOps engineer for five months, alongside a frontend engineer and a designer: 97 commits, 117 endpoints, 24 models and about 350 tests.
- students
- 10+
- endpoints
- 117
- tests
- 350
From payment to certificate. Hover or tap a node to see each step.
Fulfil exactly once
payment-fulfillment.service.ts (simplified)
await prisma.$transaction(async (tx) => { if (await tx.paymentEvent.findUnique({ where: { eventId } })) return; await tx.paymentEvent.create({ data: { eventId } }); await tx.enrollment.create({ data: { userId, courseId } });});// every 5 minutes: ask Paystack about anything still pending
Paystack reports a successful charge.
A verified webhook only enqueues a job. The worker fulfils inside a transaction that dedupes on the provider's event id and treats a unique violation on enrollment as already done. If a payment succeeded but cannot be fulfilled, it is logged as needing a refund rather than silently dropped.
A reconciliation cron runs every five minutes and asks the provider about anything still pending, so a webhook that never arrives still ends in an enrollment.
Deadlines the server owns
learn-quiz-session.service.ts (simplified)
const { count } = await tx.quizAttempt.updateMany({ where: { id, version, deadlineAt: { gt: new Date() } }, data: { answers, version: { increment: 1 } },});if (count === 0) throw new ConflictException();
Starting a quiz stores the shuffled questions and a deadline on the server.
Quiz attempts store their own shuffled question order and a server-side deadline. Saving an answer uses optimistic concurrency and returns a conflict if the attempt changed in another tab. A per-minute job expires abandoned attempts, and completion feeds course progress.
Certificates off the request path
Finishing a course only queues a job. The request returns at once.
Rendering a PDF in headless Chrome is slow and memory hungry, so it never happens in a request. A dedicated queue renders, uploads and emails each certificate, and admins can reissue or revoke them. A public endpoint lets anyone verify a certificate by its id.
Decisions worth defending
Separate worker process
Chrome and webhook bursts cannot starve the API, and the worker scales on its own.
Offset pagination over cursors
Admins jump to page N and sort by many columns; the lists are small enough that offset cost never shows up.
Redis-backed circuit breaker
When a provider is down, every instance stops calling it at once instead of each discovering it separately.