ysskrishna logoysskrishna

Express Multi-Tenant Configurations

Compare schema-per-tenant and shared-table multi-tenancy with runnable examples.

Gallery image 1
Gallery image 2
Gallery image 3
Get it
Built with
Experimental Projects
Databases & SQL
Backend & APIs
Node.js
Express
PostgreSQL
Docker
SQL
JavaScript
JWT
Details
FreeMIT licenseCreated July 20, 2025Updated November 12, 2026
Share this product

You picked a stack. You have not picked how tenants live in the database.

Your team is sketching the first SaaS API. Someone asks whether each customer gets its own schema or one shared set of tables. The meeting ends with "we will prototype both." Weeks pass. You still have slides.

Express Multi-Tenant Configurations is two runnable paths in one repo so you can compare isolation and upkeep before you commit.

Pick the pattern with code, not slides.

What you get

  • Two tenancy models side by side. One path gives each tenant a dedicated PostgreSQL schema. The other keeps shared tables and isolates rows with a tenant key column.
  • Superadmin flows that mirror real platforms. Create and list tenants, create users for a tenant, secured with an admin token.
  • Tenant login and scoped data. JWT-based authentication, role-based access, and contact records that stay inside the active tenant.
  • Docker profiles for each path. Start the separate-schema variant or the shared-schema variant locally without maintaining two unrelated repos.
  • Honest tradeoff notes in the README. Guidance on when stronger physical isolation matters and when simpler shared tables are enough.

Picture your comparison day

For example, you start the separate-schema profile and add two tenants. You log in as each, add contacts, and confirm one tenant never sees the other’s list. You switch to the shared-schema profile and repeat the same clicks. Same flows, different isolation story. You leave with notes for your architecture decision instead of guesswork.

Ready to try it?

Frequently asked questions

Why not just follow a Postgres multi-tenancy article and build it myself?

You can. Articles explain models well. They rarely give you superadmin flows, tenant auth, and tenant-scoped CRUD you can run in an afternoon. This repo is a reference implementation you compare locally, then adapt to your product.

What multi-tenant patterns does this project include?

It demonstrates shared database with separate schemas, where each tenant has a dedicated PostgreSQL schema, and shared database with shared schema, where data is logically isolated using a tenant identifier column. Both implementations live in the same repository with their own documentation folders.

How do I run the separate-schema path versus the shared-schema path?

The root README documents Docker Compose profiles for each variant. Start the separate-schema profile to boot the schema-per-tenant example, and the shared-schema profile for the shared-table example. Each subfolder README goes deeper on setup.

How should I choose between separate schemas and shared tables?

Choose separate schemas when strict data isolation, compliance requirements, per-tenant backup, or schema-level customization matter. Choose shared schema when simple multi-tenancy, resource optimization, and easier maintenance matter more and strict physical isolation is not required. The README includes a comparison table for both approaches.

What features work the same in both implementations?

Both include superadmin management to create and list tenants and create users for tenants, JWT-based tenant authentication with role-based access control, and contact management with CRUD operations scoped per tenant.

Is it free?

Yes. The project is open source under the MIT license, as listed in the repository and package metadata on GitHub.

Is this a hosted multi-tenant SaaS?

No. It is an architecture reference with working examples, not a service you sign up for. You clone the repository, run a Docker profile locally, and use what you learn in your own backend.

Continue exploring

ProductPostgreSQL Indexing and Partitioning Performance Optimization

PostgreSQL Indexing and Partitioning Performance Optimization

Measure PostgreSQL index and partition wins before you bet your next deploy on them.
Databases & SQL
Experimental Projects
+6
BlogCover image for Integrating Hasura RBAC with Supabase JWT Authentication

Integrating Hasura RBAC with Supabase JWT Authentication

GraphQL
PostgreSQL
+5
6 min read
ProductExpress FastAPI Performance Test

Express FastAPI Performance Test

Same load tests, three backends. Numbers you can show in a meeting, not a tweet.
Backend & APIs
Experimental Projects
+9
ProductPyPIDB Convert

DB Convert

One SQLite file from your live Postgres or MySQL, with a CLI or a simple desktop UI.
Databases & SQL
PyPI Packages
+10
ProductEasy Calculator

Easy Calculator

A small responsive calculator you can run locally or shape for your own site.
Experimental Projects
JavaScript
+1
ProductEmail Audit Rules Engine

Email Audit Rules Engine

Repeatable scores for outbound customer replies your team can explain without rereading every thread.
Experimental Projects
Python
+2