app/(site)/work/eproshnobank/page.tsxln 001
← WORK / SPECIMEN ARCHIVE
eProshnoBank
Next.js 16React 19TypeScriptAnt Design 6TanStack QueryZustandTiptapMathLiveKaTeXNestJSPrisma 7PostgreSQLBullMQRedisCloudinaryPuppeteerJWTDocker2026BETA
THE PROBLEM

Bangladeshi schools still build MCQ question papers by hand: teachers retype questions from old papers into Word, struggle to format Bangla text and physics/math equations, and spend hours making multiple sets (ক, খ, গ, ঘ) so students can't copy. Questions live in scattered files, nothing is reusable, and running an online test means stitching together tools that don't understand Bangla or the local exam format. Teachers also get no insight into which questions the class actually found hard.

KEY FEATURES
  • 01Question bank in Bangla and English with a rich-text editor, images and math equations (LaTeX)
  • 02Fast Bangla/English search across questions and equations, with filters by subject, chapter, topic and difficulty
  • 03Bulk import of hundreds of questions from Excel/CSV with a row-by-row error report
  • 04Paper generator: pick chapters, difficulty mix and number of sets (ক/খ/গ/ঘ), with a live question-pool check
  • 05Print-ready PDFs with Bangla numerals and a separate answer key, generated in a background job
  • 06Online exams with a server-controlled timer, autosave, resume after disconnect and auto-submit at time-up
  • 07Instant scoring, and answer review that opens only after the exam closes, so answers can't leak mid-exam
  • 08Results analytics: average, median, score distribution, per-question correct rate and how often each option was picked
  • 09Role-based dashboards for Admin, Teacher and Student; teachers only see their own subjects
  • 10Admin tools for users, classes and sections, the subject → chapter → topic tree, and teacher assignments
CHALLENGES

• Bangla + math in one editor: combined Tiptap with MathLive so teachers can mix Bangla text and LaTeX equations, rendered consistently in the browser (KaTeX) and in the PDF. All question HTML is sanitised on the server.
• Reliable PDF generation: rendering many sets with Puppeteer is slow and memory-hungry, so it runs as a BullMQ background job with retries. The UI shows live progress instead of blocking the request.
• Fair online exams: the timer is owned by the server (deadline = start + duration, capped at the window end, with a short grace period), not the browser. Answers autosave, attempts resume after a disconnect, and submission is atomic, so a refresh or a slow network can't lose or extend an exam.
• No answer leaks: students never receive which option is correct, and reviewing answers only opens after the exam window closes.
• Secure auth without localStorage: short-lived access token in memory plus a rotating httpOnly refresh cookie with reuse detection; rate-limited login per account and IP.
• Search in Bangla: PostgreSQL trigram (pg_trgm) indexes give fast fuzzy search over Bangla text and LaTeX without a separate search engine.

ARCHITECTURE

Two apps: a Next.js 16 frontend and a NestJS REST API, organised feature-by-feature so new modules can be added without touching existing ones.

• Frontend: Next.js App Router with separate route groups per role, a route guard on the server, TanStack Query for server state, Zustand for exam session and wizard state, and Ant Design 6.
• Backend: NestJS modules per domain (auth, users, academic structure, questions, question sets, exams, dashboard). Global JWT and role guards, DTO validation, one consistent error and pagination format, and pure domain functions (allocation, grading, analytics) covered by unit tests.
• Data: PostgreSQL via Prisma 7 (Neon in production), with GIN trigram indexes for search.
• Jobs: BullMQ on Redis (Upstash) runs PDF generation in the background.
• Files: Cloudinary for images, with PDFs streamed back through the API.
• Delivery: Docker images and an nginx reverse proxy serving the web app and API on one domain; also deployable split across Vercel (web) and Render (API) behind a rewrite that keeps auth cookies first-party.

IMPACT · RESULTS
01A 20-question, 2-set paper with answer keys generated as print-ready PDFs in about 10 seconds
02Hundreds of questions per bulk import, with a row-by-row error report
033 roles (Admin, Teacher, Student), each with its own dashboard and access rules
0474 automated backend tests covering auth, grading, analytics and paper allocation