- Introduction
- Pitch
- Hogwarts
- Live Demo
- MVP
- Roadmap
- Launch Sprint
- PRD
- Get Started
- Localhost
- Architecture
- Structure
- Pattern
- Page
- Layout
- Content
- Types
- Config
- Actions
- Queries
- Authorization
- Validation
- Form
- Table
- Detail
- Card
- Util
- Hooks
- List Params
- Views
- README.md
- ISSUE.md
- Technology Stack
- Database
- File
- CDN Assets
- Entry Points
- Dashboard
- Authentication
- Credentials
- OAuth
- Flow Diagrams
- Multi-Tenancy
- Offline
- Onboarding
- Onboarding Videos
- Add Values
- Admission
- Application
- Attendance
- Compliance
- Profile
- Exams
- Exam Wizard
- Timetable
- Classrooms
- Notifications
- Conference
- LMS (Lumos)
- Finance
- Fee Management
- Invoice
- Wallet
- Salary
- Payroll
- Timesheet
- Expenses
- Budget
- Receipt
- Accounts
- Banking
- Reports
- Dashboard
- Permissions
- Messages
- Integration Flow
- Provision
- AI Document Processing
- Document Intelligence
- Internationalization
- Translation
- Translation Guide
- Icons
- Docs Factory
- Inspiration
- Listings
- Teachers
- Students
- Catalog
- Library
- Contributing
- Code of conduct
- GitHub Workflow
- Database Seeds
- Database Safety
- Test Accounts
- Playwright
- Prettier
- Block Rebound
Two wizard systems, each in two phases. Phase 1 designs a template; Phase 2 consumes that template to produce instances.
| System | Phase 1 | Phase 2 |
|---|---|---|
| Exam Wizard | Template — saves ExamTemplate | Generate — saves GeneratedExam + ExamPaperConfig + Exam |
| Certificate Wizard | Template — saves ExamCertificateConfig | Issue — saves ExamCertificate (single / batch) |
Auth: ADMIN, DEVELOPER, TEACHER only.
Routes
| Phase | URL | Purpose |
|---|---|---|
| Exam P1 | /{lang}/exams/generate/template-wizard | New exam template |
| Exam P1 | /{lang}/exams/generate/template-wizard/{configId} | Edit exam template |
| Exam P2 | /{lang}/exams/generate/exam-wizard | Generate exam from template |
| Cert P1 | /{lang}/exams/certificates/cert-wizard | New cert template |
| Cert P1 | /{lang}/exams/certificates/cert-wizard/{configId} | Edit cert template |
| Cert P2 | /{lang}/exams/certificates | Manage + issue certs |
| Cert P2 | /{lang}/exams/certificates/verify/{code} | Public verification |
Phase 1 + Exam P2 use the (exam-wizard)/ route group (full-screen, no dashboard chrome). Cert P2 lives in (school-dashboard)/.
Wizard steps
Exam P1 — template (dynamic count)
| # | Step | Description |
|---|---|---|
| 1 | gallery | Regional preset (SD, SA, US, MENA) or blank |
| 2 | info | Name, subjects, grades, exam type, duration, marks, question types |
| 3 | layout | 6 slots: header, studentInfo, instructions, answerSheet, cover, footer |
| 4+ | question-{type} | Dynamic — one per Q type, difficulty distribution |
| N-2 | scoring | Passing score, grade boundaries (add / remove / reset) |
| N-1 | footer-print | Footer variant + decorations (accent bar / watermark / frame) + print |
| N | preview | 4 summary cards + paper mockup + save (creates / updates ExamTemplate) |
Exam P2 — generation (fixed 5)
| # | Step | Description |
|---|---|---|
| 1 | template | Pick from school's saved templates |
| 2 | exam | New exam form or pick existing PLANNED exam |
| 3 | questions | Auto-fill matching questions + manual select with filters |
| 4 | paper-config | Style, page size, versions (1-5), toggles |
| 5 | preview | Summary + generate (creates GeneratedExam + ExamPaperConfig in transaction) |
Cert P1 — template (fixed 12)
| # | Step | Variants / fields |
|---|---|---|
| 1 | gallery | Regional preset |
| 2 | info | Name, type (6), theme, bilingual title / body, eligibility, signatures |
| 3 | header | crest / ministry / bilingual / minimal |
| 4 | title | elegant / modern / classic / arabic-calligraphy |
| 5 | recipient | centered / underline / framed / photo |
| 6 | body | achievement / report-summary / transcript / custom |
| 7 | scores | badge-row / table-grid / gauge / hidden |
| 8 | signatures | dual / triple / single / stamps |
| 9 | footer | verification / minimal / dated / numbered |
| 10 | decorations | 5 toggles — border, corners, seal, watermark, ribbon |
| 11 | A4 / Letter, landscape / portrait | |
| 12 | preview | Summary + full mockup + save (creates / updates ExamCertificateConfig) |
Cert P2 — issuance (dashboard, not wizard)
- Single —
generateCertificate(): eligibility check, rank calculation, verification code - Batch —
batchGenerateCertificates()viaBatchIssueDialog - Share —
shareCertificate()returns public token - Verify —
verifyCertificate()(public, no auth) - Revoke —
revokeCertificate()soft revoke with reason
State
All Phase 1 wizards use useReducer + localStorage draft persistence + draft resume dialog + Context provider.
| Wizard | State | Actions | Context | Storage key |
|---|---|---|---|---|
| Exam P1 | TemplateWizardState | 18 | WizardProvider / useWizard() | wizard-template-{schoolId} |
| Exam P2 | ExamWizardState | 10 | None (self-contained) | None |
| Cert P1 | CertWizardState | 17 | CertWizardProvider / useCertWizard() | cert-wizard-{schoolId} |
Shared infrastructure
| Component | Used by |
|---|---|
WizardShell | Exam P1, Cert P1 |
WizardCard | All wizards |
VariantThumbnail | Exam P1, Cert P1 |
GalleryCard | Exam P1, Cert P1 |
GradeRow | Exam P1 |
MiniPaperMockup / Full… | Exam P1 |
MiniCertMockup / Full… | Cert P1 |
CertSlotStep | Cert P1 (7 slot steps delegate to this) |
Exam P2 has its own inline shell — does NOT use WizardShell.
Prisma models
| Model | File | Created by | Purpose |
|---|---|---|---|
ExamTemplate | qbank.prisma | Exam P1 | Template composition (blockConfig, scoringConfig, printConfig) |
GeneratedExam | qbank.prisma | Exam P2 | Generated paper from template |
GeneratedExamQuestion | qbank.prisma | Exam P2 | Question selection |
ExamPaperConfig | exam.prisma | Exam P2 | Print / layout (template style, page size, versions) |
ExamCertificateConfig | exam.prisma | Cert P1 | Cert template (compositionConfig, text, signatures) |
ExamCertificate | exam.prisma | Cert P2 | Issued cert (number, score, grade, share token) |
Server actions
| Action | File | Phase | Creates |
|---|---|---|---|
saveTemplate | wizard/template-wizard/actions.ts | Exam P1 | ExamTemplate |
createExamFromWizard | wizard/exam-wizard/actions.ts | Exam P2 | Exam + GeneratedExam + ExamPaperConfig (transaction) |
saveCertificateComposition | wizard/cert-wizard/actions.ts | Cert P1 | ExamCertificateConfig |
generateCertificate | certificates/actions/index.ts | Cert P2 | ExamCertificate (single) |
batchGenerateCertificates | certificates/actions/index.ts | Cert P2 | ExamCertificate[] (batch) |
shareCertificate | certificates/actions/index.ts | Cert P2 | Updates share token |
verifyCertificate | certificates/actions/index.ts | Cert P2 | Read-only verification |
revokeCertificate | certificates/actions/index.ts | Cert P2 | Soft revoke |
File tree
Routes under src/app/[lang]/s/[subdomain]/(exam-wizard)/:
layout.tsx # Auth guard, full-screen <main>
exams/generate/
template-wizard/page.tsx # Exam P1 (new) → TemplateWizardClient
template-wizard/[configId]/page.tsx # Exam P1 (edit)
exam-wizard/page.tsx # Exam P2 → ExamWizardClient
exams/certificates/
cert-wizard/page.tsx # Cert P1 (new) → CertWizardClient
cert-wizard/[configId]/page.tsx # Cert P1 (edit)
Cert P2 in (school-dashboard)/exams/certificates/ — page.tsx, configs/, verify/[code]/page.tsx.
Components under src/components/school-dashboard/exams/wizard/:
types.ts # TemplateWizardState, WizardAction, StepDefinition
context/wizard-provider.tsx # WizardProvider + useWizard()
layout/wizard-shell.tsx # Top bar, sidebar nav, progress, prev / next
hooks/use-wizard-state.ts # useReducer + localStorage
hooks/use-wizard-steps.ts # Dynamic step list
atoms/ # WizardCard, VariantThumbnail, GalleryCard, GradeRow, mockups
template-wizard/ # Exam P1 — client + actions + 8 steps
exam-wizard/ # Exam P2 — types, hooks, actions, client + 5 steps
cert-wizard/ # Cert P1 — types, actions, client + provider + shell + atoms + 12 steps
Cert P2 components: src/components/school-dashboard/exams/certificates/ — content.tsx, config-list.tsx, config-form.tsx, certificate-list.tsx, batch-issue-dialog.tsx, validation.ts, actions/ (12 server actions).
Cross-module imports
- Exam P1 — composition types from
exams/templates/(VARIANT_REGISTRY, region presetsSD_NATIONAL,SA_NATIONAL,US_STANDARD,MENA_PRIVATE). - Cert P1 — composition types from
grades/templates/composition/(CERT_VARIANT_REGISTRY, cert region presets). - Both Phase 1 wizards share atoms (
WizardCard,VariantThumbnail,GalleryCard). - Cert P2 is independent — only consumes
ExamCertificateConfigfrom DB.