Designing a Multi-Tenant Tuition System That Scales Without Bloat

How a client who refused to touch a payment gateway forced a leaner, faster architecture than any "best practices" checklist would have produced.
My client didn't know what a server was. He'd never heard of cloud hosting, had no real idea why software needs money every month just to stay online, and had no operational model for how a tuition consultancy should actually run at scale. What he did know, with total conviction, was that he would never use Razorpay, Stripe, or any payment gateway that asked for merchant KYC.
That refusal turned out to be the best requirement he ever gave me.
This is the story of OMD Leads — a multi-tenant tuition marketplace now running across multiple Indian cities, connecting guardians looking for tutors, teachers looking for students, and tuition consultancies looking to digitize their client books. It's built on a lean Node.js backend that answers in under 250 milliseconds on average, and it moves real money without a single payment gateway anywhere in the stack.
Here's how the constraints ended up building the system.
Constraints as a Design Document
Most engineering briefs start with a feature list. This one started with a list of things that were off the table:
- No budget for infrastructure. Anything that cost real money before it earned money was disqualified.
- No technical literacy from the client. Every admin workflow had to be usable by someone who has never opened a database.
- No payment gateway, full stop. No Razorpay, no Stripe, no merchant onboarding, no recurring KYC.
- No defined operational model. Nobody could tell me how many tutors, students, or cities this needed to support — only that "more than one city, eventually" was non-negotiable.
Individually, each of those looks like a limitation. Together, they worked as a very effective filter against the accidental complexity that kills bootstrapped products. There was no budget for a bloated microservices mesh, so there isn't one. There was no appetite for a payment gateway integration, so I built something else entirely. The constraints didn't limit the system — they defined it.
These constraints did not limit the system. They defined it.
Three Tiers, One Deterministic Pipeline
The platform splits into three specialized layers, each on infrastructure chosen for cost-efficiency over prestige:
Backend API — Node.js 18 and Express, hosted on Render, backed by MongoDB Atlas through Mongoose. This is the only layer that touches the database directly, and where every business rule lives.
Admin & Partner Web App — React 18 and TypeScript, built with Vite, deployed serverlessly on Vercel's edge network. Super admins, staff, and consultancy partners run the platform from here.
Mobile App — React Native 0.72 with Redux Toolkit for state, shipped to the Google Play Store with zero required storage permissions — no READ_MEDIA_IMAGES, no READ_EXTERNAL_STORAGE. This is where students, guardians, and teachers actually live.
Mobile Architecture: Overcoming Play Store Privacy Bloat
Deploying an application to the Google Play Store today requires navigating extremely aggressive privacy policies. Historically, if an educator needed to upload a profile picture or a qualification certificate, the app had to request invasive READ_EXTERNAL_STORAGE or READ_MEDIA_IMAGES permissions. Google Play now heavily penalizes apps that overuse these permissions, which leads to immediate user drop-off during onboarding.
To guarantee 100% compliance and zero user friction, the OMD Leads mobile app leverages the native Android Photo Picker. By invoking the image library with the androidPhotoPicker: true flag, the mobile app never asks the user for storage access. Instead, the Android OS handles the gallery UI in a separate, isolated system sandbox.
The user selects a photo, and the OS passes only a temporary, read-only URI back to the React Native app. The application converts this URI into a binary FormData payload, uploads it to the backend, and immediately discards the URI. Privacy is preserved, compliance is guaranteed, and onboarding friction is mathematically reduced to zero.
Beyond privacy, the mobile application is engineered to handle the realities of fluctuating mobile networks. The architecture leverages AsyncStorage for local data persistence, actively caching previously fetched leads and saving draft tuition requirements directly on the device.
This local storage is coupled with a dedicated Network Context provider that monitors connectivity state in real-time.
Instead of breaking when a connection drops, the UI gracefully adapts, allowing users to view cached data offline and seamlessly syncing queued actions once the network is restored.
All three talk to the same Express API over HTTPS with JWT authentication, through a middleware stack that's intentionally boring: Helmet for security headers, CORS, a rate limiter, then JWT validation and role-based authorization before a request ever reaches business logic. Boring, here, is a feature — every piece of the stack was picked because it's well understood, cheap to run, and unlikely to surprise anyone at 2 a.m.
The target from day one was sub-250ms average response times across all endpoints, even during peak evening hours when thousands of teachers refresh their lead feed at once — which, it turned out, came down almost entirely to how the database was indexed rather than how much was spent on compute.
One User Table, Six Roles, No Fragmentation
The most common mistake in marketplace platforms is treating "student," "teacher," and "admin" as fundamentally different kinds of accounts — separate apps, separate tables, separate everything. It looks clean on a whiteboard and turns into a synchronization nightmare in production, especially the moment someone needs to be more than one type of user at once.
OMD Leads uses a single User collection with a role field and role-specific sub-documents that stay attached to the account no matter what the role becomes later:
**Six roles cover the entire platform: **
- super_admin (fee rates, partner approvals, admin creation)
- admin (teacher verification, premium lead assignment, ledger management)
- staff (internal team members working off a configurable permission matrix — canManageLeads, canVerifyTeachers, canViewAnalytics, and so on)
- student (guardians and students posting requirements and reviewing proposals)
- teacher (educators browsing leads, unlocking contacts with wallet credits, submitting proposals)
- consultancy (approved agencies running both a web dashboard and mobile app access).
The consultancy role is the interesting one, because it isn't really a fixed identity — it's a state a student or teacher account can graduate into without losing anything it already had.
Anyone can apply to become a partner from the mobile app. Their existing role keeps working while the application sits as pending. Once a super admin approves it, the role flips to consultancy and a consultancyProfile sub-document attaches — but the studentProfile or teacherProfile that was already there stays exactly where it was.
On the mobile app, a consultancy operator logs in and the backend returns role: 'consultancy', while the Redux store defaults currentRole to 'teacher' so they land directly in the lead-browsing interface. From there, they can flip between a Teacher Panel and a Student Panel — browsing leads to unlock as a tutor, or posting requirements on behalf of their own client roster — without re-authenticating or losing any app state. It's one account with two working modes, not two accounts pretending to be one product.
The Frontend Execution: Navigator Remounting
Allowing a user to hold two roles simultaneously is easy on the backend, but rendering it on a mobile app usually creates a tangled mess of conditional UI logic. If a user switches from the "Teacher Panel" to the "Student Panel," you cannot simply push a new screen over the old one without risking memory leaks or cross-contaminating state.
Instead, OMD Leads handles this via a Dynamic Navigator Remounting strategy. The Redux store manages a currentRole slice. In the React Native Root Navigator, this currentRole is passed directly as a React key prop to the navigation container.
When a consultancy partner taps "Switch to Student Mode," changing that key prop forces React to completely destroy the existing view hierarchy of the Teacher stack and instantly mount a fresh Student stack. This guarantees zero state leakage between roles, clears cached component memory, and resets navigation stacks—all in under 100 milliseconds without requiring a hard logout or re-authentication.
Locking Down Who Can Do What
None of this matters if a teacher account can call an admin endpoint. The API enforces authorization in three layers:
- Route-level authentication (every protected route validates the JWT and reads the embedded role claim)
- Resource-level ownership (regular users can only mutate resources where ownerId === req.userId)
- Action-level permission checks for staff (who get attribute-based access checked against a permissions map).
That gives staff members exactly as much power as they've been explicitly granted, and nothing more — which matters a lot once more than one or two people on the admin side are making decisions that touch other people's money.
Security & Fraud Prevention at the Schema Level
Protecting the platform required more than just route-level authentication. The Express middleware includes a dynamic rate limiter that scales based on the user's role and verification status.
Unauthenticated endpoints face strict request caps, while verified teachers and platform admins are granted progressively higher thresholds to comfortably operate their heavy-data dashboard workflows without being throttled[cite: 10].
And money is where this gets genuinely unusual. Because the one thing that was never on the table, from day one, was a payment gateway.
Custom Payment Gatewayless Settlement: The Decimal Pool

Traditional Indian payment gateways like Razorpay and Stripe create heavy friction for bootstrapped founders through mandatory business proofs, GST filings, recurring KYC, and multi-week reviews that can block launches. This system bypasses them entirely by accepting direct UPI transfers into a single business bank account while still confirming payments automatically and without human intervention.
The core innovation is the Decimal Pool — a collection of 99 unique fractional values (0.01 to 0.99). When a teacher initiates a purchase, an unreserved decimal is atomically claimed and added to the base price, creating a unique amount such as ₹500.47. A standard NPCI-compliant UPI deep link is generated with this exact amount, and the decimal is locked for five minutes.
Incoming bank SMS alerts are parsed by a lightweight webhook that extracts the precise amount (down to the paisa). Because the pool guarantees no two live orders share the same amount, the system matches the deposit to exactly one pending order, marks it completed, credits the teacher’s wallet, and releases the decimal — all inside a MongoDB transaction. Unmatched deposits are logged for audit rather than ignored.
The Hardware Bridge & Idempotent Webhooks
The missing physical link between the business bank account and the digital webhook is a standard Android phone permanently running the automation app MacroDroid.
This device acts as an observer, watching for incoming bank SMS notifications and instantly firing an HTTP POST payload to the server.
To prevent the webhook from becoming a vulnerability, it is built to be strictly idempotent. The endpoint always returns an HTTP 200 response to MacroDroid; if it returned standard 4xx or 5xx error codes, the automation app would automatically retry the request, which could trigger a race condition or double-credit a user.
Once the payload is secured, a layered Regex parser steps in, successfully extracting the exact fractional amounts and transaction IDs from the varying, unstructured SMS formats used by banks like HDFC, SBI, and ICICI.
As the ultimate fail-safe, a mathematical verifyDecimalMatch function ensures the fractional amount paid exactly matches the fraction reserved, while a sparse unique index on the transactionId in MongoDB acts as an impenetrable safety net against duplicate webhook executions.
This design turns the payment amount itself into a fingerprint, eliminating any need for gateway reference IDs, callback signatures, or webhook secrets. It is purpose-built for one inbound collection account with reliable SMS notifications and deliberately does not support multi-party payouts.
I wrote a complete, deep-dive breakdown of the exact mathematical mechanics, SMS webhook parsing, and atomic MongoDB transactions that power this 0-fee payment engine. Read the full architecture case study here:
The Dual-Lead Matchmaking Engine
Legacy platforms treat all educational requirements identically, pushing casual hobby classes and high-stakes academic preparations through the same pipeline. This structural rigidity results in low engagement and high spam. We dismantled this by engineering a Dual-Lead Routing Engine:
**A. Regular Leads (Open Pay-per-Unlock Marketplace)**Designed for volume and localized velocity.
- Privacy First: Sensitive PII (guardian name, exact phone number) is strictly masked.
- The Economy: Teachers spend wallet credits (e.g., 50 credits) to unlock and reveal the contact details.
- Algorithmic Pricing: To prevent the first responding teacher from monopolizing a lead, the system calculates automatic dynamic price discounts. Unlocks 1 through 3 cost full price; unlocks 4 through 6 receive a 20% discount; unlocks 7+ receive a 40% discount.
- Auto-Closure: Once a hard cap is reached (e.g., 10 unlocks), the lead automatically transitions to a closed state, shielding the parent from endless calls.
**B. Premium Leads (Curated Proposal Marketplace)**Designed for high-budget, specialized requirements.
- Zero Upfront Friction: Tutors submit comprehensive, structured teaching proposals entirely for free.
- Admin Curation: Platform operators review the proposals side-by-side in the React Admin panel, verify the tutor's qualifications, and manually assign the best fit.
- Revenue Model: The platform captures a sustainable 20% commission on the monthly tuition fee generated by the assignment.
Geospatial Routing (The 2dsphere Engine)
Matching tutors with students in dense urban environments requires immense geographical precision. A two-kilometer difference drastically alters a teacher's willingness to accept a commute.
Instead of relying on heavy, relational SQL queries with complex spatial extensions, the platform leverages MongoDB's native 2dsphere indexes. When a student publishes a requirement, external geocoding services map the raw text address into standardized GeoJSON coordinate pairs [longitude, latitude].
When a teacher browses the mobile feed, the API executes optimized $nearSphere geospatial operators bounded by configurable thresholds (e.g., 5km, 10km, or 25km):
Frictionless Token Attendance System ("The Token Counter")
Traditional calendar-based daily check-ins fail in independent tutoring ecosystems due to highly fluid schedules. Forcing users to log in daily creates high friction and rapid feature abandonment.
To monetize B2B tuition consultancies on the platform, we engineered a frictionless Post-Class Token Deduction System.
- The Monthly Token Quota: A tuition center assigns a monthly class count to a student-teacher pair (e.g., 12 classes).
- 1-Tap Teacher Action: After a class concludes, the teacher taps a single prominent "Mark Class Done" button in the app. Zero daily login calendars are used.
- Passive Parent Approval & 24h Auto-Cron: The parent receives an interactive push notification: "Teacher marked Class 4 of 12 completed today. Wrong? Tap to Dispute." If the parent does not dispute it within 24 hours, an automated backend cron job seamlessly verifies the session and deducts the token from the monthly quota.
This state machine recognizes actual human behavior: teachers want immediate 1-tap confirmation, and parents prefer passive approval rather than constant administrative micromanagement.
B2B Monetization: This frictionless tracking acts as a SaaS layer for tuition agencies. Consultancies purchase a ₹10/month subscription credit per student to unlock the Token Counter. Unsubscribed users hit a locked feature paywall that advertises the 1-tap tracking system, turning a simple attendance tracker into a recurring revenue stream for the platform.
Have thoughts or questions on this topic?
Follow and discuss with our engineering team on X / Twitter for daily tech breakdowns, system design notes, and software engineering debates.
Related Articles

Your Phone Was Always a Better Remote Control . NEXORA Just Made It Feel Like One
I never noticed how frequently I reached for the mouse until I began keeping count. Lean in, click, lean back, open a tab, skip a track, type six words—and repeat the loop dozens of times an hour. The

Beyond the Hype: Building AI Agents That Actually Work in Production
We’ve all seen the magical AI demos. You type a vague prompt into a chat box, and a few seconds later, an "autonomous agent" writes a marketing plan, codes a website, and emails a client. It looks

Out of a quiet obsession, we built a beast. 60+ heavy utilities, handed freely to the web.
A few months ago, Launch Your Concept released a beast. 60+ massive utilities operating entirely off the grid.. Inside the engineering madness that built FlashTools. We were tired of the web feeling
