Multi-Tenant
A software architecture where a single instance of an application serves multiple customers (tenants), with data isolation ensuring each tenant's data remains separate and secure.
Infrastructure
Multi-tenancy allows a single application instance to serve multiple customers (tenants) while keeping their data completely isolated.
Isolation Strategies
1. Database-Level
// Separate database per tenant
const db = getTenantDatabase(tenantId);
await db.query("SELECT * FROM users");
2. Schema-Level
-- Separate schema per tenant
SELECT * FROM tenant_123.users;
SELECT * FROM tenant_456.users;
3. Row-Level
-- Shared tables with tenant_id
SELECT * FROM users WHERE tenant_id = '123';
TrustGraph Multi-Tenancy
// Create isolated Knowledge Graph per tenant
await trustgraph.tenant.create({
id: "company-abc",
isolation: "graph", // Separate graphs
resources: {
graphDb: "neo4j-abc",
vectorDb: "qdrant-abc"
}
});
// Query respects tenant isolation
const results = await trustgraph.query({
tenantId: "company-abc",
query: "MATCH (n) RETURN n"
// Only sees company-abc's data
});
Benefits
- Cost Efficiency: Share infrastructure
- Easy Updates: Update once, all tenants benefit
- Resource Sharing: Better utilization
See Also
Examples
- •SaaS application serving 1000 companies from one deployment
- •TrustGraph isolating knowledge graphs per organization