MBS School Management Portal
Fullstack & Backend Engineer · Mercan Brilliant Schools
Overview
A flagship school management system that digitises day-to-day operations for staff, students and families. The API runs on Express 5 with both REST and GraphQL, writes to MongoDB as the source of truth, mirrors reads to PostgreSQL, and uses Redis for caching, rate limiting and idempotency. The React front end adds dashboards, result tools, fee management and a permission-scoped portal assistant.
What I did
- 01Built and maintained the Express 5 REST + GraphQL API, with MongoDB as the write source of truth and PostgreSQL as the primary read mirror.
- 02Added a read-through Redis cache for hot, read-mostly data without making Redis a source of truth.
- 03Implemented JWT authentication, role-based authorization and per-record scoping across staff, student and guardian flows.
- 04Built the Paystack payment flow with HMAC-SHA512 webhook verification, idempotency keys and reconciliation of pending payments.
- 05Built the Portal Assistant: intent parsing, a permission-scoped tool registry and a fixed response envelope instead of stuffing records into a long prompt.
- 06Moved long-running work onto BullMQ with an inline fallback so Redis-less environments still boot.
- 07Hardened security with helmet/CSP/HSTS, CORS allowlisting, Zod body validation and Redis-backed rate limiting.
Key features
- Admissions, attendance, results, fees, payments and announcements in one portal
- Result upload and result checker powered by ExcelJS
- Online payments with Paystack and payment tracking
- AI portal assistant for staff questions across students, results, fees and attendance
- GraphQL endpoint alongside the REST API
- Bulk exports and broadsheet/result processing tools
- OTP and SMS notifications for families
Bugs fixed & failure modes handled
A Redis outage could take down reads that only needed a cache.
FixEvery cache helper degrades to a miss; MongoDB stays authoritative, so an outage costs latency, never correctness.
An unreachable PostgreSQL mirror broke reads even though MongoDB had the data.
FixThe read path falls back to MongoDB at boot and per request when the mirror is unavailable.
Duplicate Paystack webhooks could credit the same payment twice.
FixWebhooks are verified with HMAC-SHA512, re-verified with Paystack by reference, and deduplicated with idempotency keys.
The assistant could have echoed credential fields back to a user.
FixA response guard recursively strips password, token, secret, API-key and authorization fields before anything leaves the server.
Unknown request fields could reach the data layer.
FixZod validation strips unknown keys on write endpoints.
A Redis-less deployment failed to start or stalled background work.
FixRate limiting and idempotency fail open, and queued jobs run inline when REDIS_URL is unset.
Integrations
- Paystack payments and webhooks
- Cloudinary media storage
- WhatsApp notifications
- Gemini and NVIDIA assistants
- MongoDB and PostgreSQL
- Redis cache, rate limits and BullMQ
- Nginx reverse proxy
- PM2 on AWS Lightsail
Engineering highlights
- The assistant retrieves live portal data through permitted tools — it does not rely on a long context window.
- Redis is cache-only: losing it changes latency, not the truth.
- PostgreSQL and Redis are optional at boot, so the system starts degraded instead of failing.
Tools used
- Node.js
- Express 5
- GraphQL
- MongoDB
- PostgreSQL
- Prisma
- Redis
- BullMQ
- React
- Vite
- TanStack Query
- Tailwind CSS
- JWT
- Zod
- Paystack
- Cloudinary
- Nginx
- PM2
- AWS Lightsail
Tools & access needed
- Node.js 24+ and npm/pnpm
- MongoDB (required); PostgreSQL and Redis (optional but recommended)
- Paystack secret key and a public webhook URL
- Cloudinary, Gemini/NVIDIA, WhatsApp and SMS credentials
- Nginx and PM2 on the target host
One system now carries the school day — from attendance and results to Paystack payments and a staff assistant that answers from live portal data.
