Engineering Notes
System Architecture4 min readUpdated

Designing a Multi-Tenant Education Platform for Different Institutes

How I think about tenant identity, permissions, and shared modules when one platform serves many institutes with different needs.

Multi-Tenant Education PlatformDjangoNext.jsPostgreSQLSaaSMulti-Tenancy
On this page

When we started building our multi-tenant education platform, I expected the difficult part to be the visible features: question banks, practice tests, dashboards. Those took work, but they were not the real problem. The real problem was that different institutes needed to use the same product in different ways.

One institute focuses on law entrance preparation. Another runs Loksewa classes. They have different courses, teachers, fees, students, and branding. A separate backend per institute would have been easy to start and painful to maintain, because every bug fix and every new feature would need to be repeated across projects.

So the goal became: one shared system, without mixing up the institutes' data.

The stack and the request path

The backend is Django with Django REST Framework, with PostgreSQL for data. The web application is Next.js, and the mobile applications are Flutter. Redis is part of the backend infrastructure, and the services run as containers behind Nginx, deployed with Dokploy.

  1. Institute website, or Main product site, or Mobile app
  2. Next.js frontend, or Flutter app
  3. Django REST API
  4. Tenant resolution + authorization
  5. PostgreSQL and supporting services
How a request reaches institute data

Every client, whether it is an institute's own website, the main product site, or a mobile app, ends up at the same Django API. That is deliberate. It means the rules about who can see what live in one place.

Why a shared database

We use a shared database where records carry their tenant relationship. The trade-off is straightforward:

  • What we gain: fewer databases and deployments to maintain, one schema to migrate, and one codebase where a fix applies to every institute.
  • What it costs: the application layer carries more responsibility. A query that forgets its tenant scope is not just a functional bug, it can expose one institute's data to another.

I accepted that trade-off, but it changes how I review code. Tenant scoping is not something to remember occasionally. It has to be part of how every query and endpoint is written.

Finding the tenant is not the same as authorizing the user

The web platform uses institute subdomains such as institute.example.com. The hostname tells the frontend which institute's public website and branding to load. The Django backend then resolves and verifies the tenant context on its own before returning any private data.

I keep two operations separate:

  1. Tenant resolution: which institute is this request for?
  2. Authorization: is this user allowed to do this, inside that institute?

Knowing that a request came from an institute's subdomain does not mean every logged-in user should have access to that institute. The backend still checks membership, the user's role, and the scope of the resource being requested. A teacher should not see every institute's students. A student should not be able to change an institute identifier in an API request and read someone else's question sets or results.

This matters even more with mobile apps. A white-label institute with its own app has a different login experience from an institute using the shared app. The user experience can vary per tenant, but the authorization rules have to stay on the backend. I wrote more about that boundary in Building a White-Label Flutter App on a Shared Django Backend.

Shared modules, configurable behavior

Instead of separate codebases for each institute's requirements, I treat the product as a set of shared modules:

  • academics, categories, and batches
  • resources and question banks
  • practice, exams, and results
  • subscriptions and user management

Permissions are layered on top. The platform admin controls tenant-level configuration. Institute administrators work inside their own institute. Teachers and students get progressively narrower permissions. Features and branding are configured per tenant, without rewriting the core logic.

The public website follows the same idea. Homepage content, courses, features, and other sections are loaded from tenant settings and a CMS rather than hardcoded into a template for each institute.

The questions I ask for every new feature

A shared codebase only helps if the boundaries stay consistent. Whenever we add a feature, I come back to the same four questions:

  1. Which tenant owns this record?
  2. Which roles can view it, and which can change it?
  3. Does the rule apply equally to the web app, the mobile app, and direct API calls?
  4. Will the feature still work for an institute with a different configuration?

The same questions apply to performance work. Caching a response in a multi-tenant system is a data-ownership decision as much as a speed decision, which I go into in Redis, API Speed, and Tenant Safety in a Multi-Tenant Platform.

Where it stands

The system is still evolving, and these questions are part of every architecture review. When there is a choice, I would rather reuse an existing service safely than create another copy of the same logic for a new portal.

Multi-tenancy turned out to be less about putting an institute's logo in the header and more about keeping identity, data ownership, permissions, and configuration consistent across the whole system. That makes this as much a product engineering project as an application development one: multiple institutes working independently on one dependable platform.

Related reading