Express Multi-Tenant Configurations
Two working multi-tenant patterns with Express, Prisma, and Postgres
This repository shows side-by-side implementations: shared database, separate schema per tenant and shared database, shared tables with a tenant key. Both include superadmin flows to manage tenants and users, JWT auth, and contact CRUD scoped per tenant. Run either variant with the Docker Compose profiles documented in the README.
When it is useful
You are choosing between stronger physical isolation vs. simpler shared-table tenancy, you need runnable code to stress-test Prisma migrations and queries, or you are onboarding engineers to tenant-aware APIs. It is an architecture reference, not a hosted SaaS.
What you can do
- Boot the separate-schema profile or the shared-schema profile and compare operational tradeoffs summarized in the project’s comparison table.
- Exercise tenant admin and tenant user flows as implemented for contacts.
- Read the per-folder READMEs linked from the main documentation for deeper setup detail.
Limits
- Compliance, legal isolation, and performance at scale depend on your domain; use the examples to inform design, not as certification.
- Migrations, backups per tenant, and connection pooling get harder with separate schemas; discipline on queries matters more with shared tables.
- Anything beyond the demo scope (analytics, billing, per-tenant theming) is custom engineering.





