Appolo Smart Test
Enterprise Exam Evaluation & Serverless Processing
Problem
Processing exam submissions after an exam closes used to mean manual grading and PDF handling — slow, error-prone, and impossible to scale during peak windows. The workload is bursty (zero traffic for weeks, then a flood at exam close) making always-on infrastructure wasteful. Cold starts on serverless functions were adding 3-8 seconds to the first invocation, violating the SLA.
Architecture
Serverless fan-out pipeline: submission batches hit a REST API (50+ endpoints, JWT RS256 auth) and publish individual processing jobs to SQS. Lambda workers pull jobs, run PDF processing, and write results to MongoDB, with Mongoose plugins and cursor-based pagination keeping list endpoints fast as the collection grows. An Agenda.js job scheduler drives the exam lifecycle itself — timed start/end, auto-submission when a candidate's time runs out, and idempotent reminder notifications so a retried job never double-sends. Cold starts are mitigated with provisioned concurrency and a pre-warming cron that fires ahead of known exam windows. A 40+ route React dashboard gives staff a single place to monitor submissions, and video answer uploads go through the TUS protocol for resumable, interruption-proof transfers of 500MB+ files.
Trade-offs
Provisioned concurrency eliminates cold starts but costs money even when idle — we sized it to absorb the initial burst while on-demand instances spin up behind it, landing at roughly 60% less cost than an always-on ECS cluster sized for peak. Cursor-based pagination with Mongoose plugins pushed more complexity into query construction than offset pagination would have, but it's what took list-endpoint response times down by 60% as submission volume grew. Security was treated as a first-class requirement rather than an afterthought: Helmet, XSS sanitization, MongoDB injection prevention, and rate limiting are applied uniformly across all 50+ endpoints.