Low Code Multi Tenancy

Production-grade guide to low code multi tenancy covering architecture patterns, implementation strategies, testing approaches, and operational best practices for enterprise engineering teams.

Low code multi tenancy enables a single instance of a low code platform to serve multiple independent organisations (tenants), each with isolated data, configurations, branding, and access. It matters when a platform is used across departments, subsidiaries, or clients—such as a customer portal, internal HR tool, or SaaS application—where each tenant needs autonomy while sharing infrastructure and development effort.

Tenant Provisioning and Lifecycle

Creating a new tenant involves defining a unique tenant identifier, provisioning resources, and configuring tenant-specific settings. The tenant ID is typically derived from the tenant’s domain or a unique slug. A new tenant is created via a standard HTTP API call, with a request body in JSON:

{
  "tenant_id": "acme-corp",
  "name": "Acme Corporation",
  "contact_email": "[email protected]",
  "plan": "enterprise",
  "currency": "USD",
  "time_zone": "America/New_York"
}

The server responds with 201 Created and the full tenant record:

{
  "tenant_id": "acme-corp",
  "name": "Acme Corporation",
  "created_at": "2023-10-05T12:30:00Z",
  "status": "active",
  "plan": "enterprise",
  "currency": "USD",
  "time_zone": "America/New_York"
}

The platform must ensure that tenant-specific databases, file storage buckets, and API endpoints are provisioned. The tenant ID is used as a schema prefix in PostgreSQL:

CREATE SCHEMA acme_corp;

-- All tenant data resides in this schema
CREATE TABLE acme_corp.users (
  id UUID PRIMARY KEY,
  name TEXT NOT NULL,
  email TEXT UNIQUE NOT NULL,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

When a tenant is deleted, the system performs a cascade cleanup: all schema objects, stored files, and related metadata are removed. A common failure is orphaned files in a shared storage bucket—files not linked to a tenant schema or metadata table—leading to wasted storage and inconsistent data.

Data Isolation and Schema Management

Data isolation ensures that one tenant cannot access another’s data unless explicitly configured. The most common patterns are schema-per-tenant and tenant-id column. The schema-per-tenant model uses a unique schema per tenant, as above. The tenant-id column model stores all data in a single schema with a tenant_id column:

CREATE TABLE users (
  id UUID PRIMARY KEY,
  tenant_id TEXT NOT NULL,
  name TEXT NOT NULL,
  email TEXT,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

The platform must enforce tenant context at the database level. Every query must include a WHERE tenant_id = $1 clause, and the system must derive the current tenant from the incoming request.

The tenant ID is propagated through the request stack using a header:

X-Tenant-ID: acme-corp

When the header is missing, the system defaults to default tenant. A common failure is a request with X-Tenant-ID: acme-corp but a typo: X-Tenant-Id, leading to silent tenant misrouting.

The platform must also manage schema evolution. When a new version of a flow or form is deployed, it must be applied across all tenants. A migration script runs per tenant:

-- Migration script for tenant acme-corp
ALTER TABLE acme_corp.users ADD COLUMN phone TEXT;
UPDATE acme_corp.users SET phone = 'N/A' WHERE phone IS NULL;

The migration system tracks which scripts have been applied per tenant. A failed migration leaves a tenant in a partially updated state, causing runtime errors when accessing new fields.

Tenant-Specific Configuration and Customisation

Each tenant can override global defaults through a configuration store. A common approach is a JSON document stored per tenant in a tenant_configs table:

CREATE TABLE tenant_configs (
  tenant_id TEXT PRIMARY KEY,
  config JSONB NOT NULL
);

Example configuration:

{
  "theme": {
    "primary_color": "#1a73e8",
    "logo_url": "https://acme-corp.com/logo.png",
    "font_family": "Inter"
  },
  "features": {
    "enable_chat": true,
    "enable_kanban": false
  },
  "integration": {
    "salesforce": {
      "base_url": "https://acme.my.salesforce.com",
      "api_key": "sk-abc123"
    }
  }
}

A flow or component reads configuration via a standard function call:

{
  "action": "get_tenant_config",
  "input": {
    "key": "theme.primary_color"
  }
}

The system returns #1a73e8. If a key does not exist, it returns null or a default value. The configuration system supports nested keys and fallbacks: if theme.primary_color is not set, it falls back to theme.default_color.

A common failure is configuration drift: one tenant has a typo in a configuration key, but the system does not validate the schema. A flow expects theme.primary_color, but the tenant sets theme.prime_color. The system silently uses null, leading to unexpected UI defaults.

Authentication and Tenant Context

Authentication is shared across tenants, but each tenant can enforce its own login flow, identity provider, and user roles. The system supports tenant-specific login pages and branding, accessed via:

https://app.example.com/acme-corp

On first visit, the platform checks the Host header and the X-Tenant-ID header to determine the tenant context. If both are present and mismatched, the system logs a warning and uses the X-Tenant-ID header as the authoritative tenant.

Users are authenticated via a standard JWT token. The JWT payload includes a tenant_id claim:

{
  "sub": "user-123",
  "name": "Alice Johnson",
  "tenant_id": "acme-corp",
  "roles": ["admin", "developer"],
  "exp": 1700000000
}

The platform validates the token and sets the current tenant context for the duration of the session. The session is stored in a sessions table:

CREATE TABLE sessions (
  session_id UUID PRIMARY KEY,
  user_id UUID NOT NULL,
  tenant_id TEXT NOT NULL,
  expires_at TIMESTAMPTZ,
  created_at TIMESTAMPTZ DEFAULT NOW()
);

When a user logs in, the system checks if they belong to the tenant. If not, it prompts to join the tenant, with a join_tenant action:

{
  "action": "join_tenant",
  "input": {
    "tenant_id": "acme-corp"
  }
}

The system returns 200 OK if the user is already a member, or 201 Created if the user is newly added.

Shared and Tenant-Specific Assets

The platform supports both shared and tenant-specific assets: flows, forms, APIs, and dashboards. A shared asset is available to all tenants. A tenant-specific asset overrides the shared one for that tenant.

Each asset has a tenant_id field. When resolving a flow, the system queries:

SELECT *
FROM flows
WHERE name = 'onboarding'
  AND (tenant_id = 'acme-corp' OR tenant_id IS NULL)
ORDER BY CASE WHEN tenant_id IS NOT NULL THEN 1 ELSE 2 END
LIMIT 1;

This returns the tenant-specific version if available, otherwise the global version. The system caches the result per tenant and per flow name.

A common failure is a tenant-specific form that is not published. A flow references a form, but the form exists only in the acme-corp schema and is not published to the global registry. The system returns 404 Not Found when trying to load the form, but the error is not logged at the tenant level.

Tenant-Scoped API Endpoints and Routing

API endpoints are scoped to tenants via a base path:

https://api.example.com/v1/tenant/{tenant_id}/orders

The {tenant_id} is extracted from the path and used to set the tenant context. The platform uses a middleware that:

  1. Parses the path segment.
  2. Sets X-Tenant-ID header if not present.
  3. Queries the tenant configuration.
  4. Applies tenant-specific middleware (e.g., rate limiting, logging, caching).

A typical API response includes tenant metadata:

{
  "data": [
    { "id": 1, "order_number": "ORD-1001", "total": 299.99 }
  ],
  "meta": {
    "tenant": {
      "id": "acme-corp",
      "name": "Acme Corporation",
      "currency": "USD"
    },
    "pagination": {
      "total": 100,
      "page": 1,
      "limit": 20
    }
  }
}

The platform supports subdomains as tenant identifiers:

https://acme-corp.example.com/orders

This is routed via a reverse proxy (e.g., NGINX) that sets X-Tenant-ID: acme-corp and forwards the request.

Tenant-Specific Event Processing and Workflows

Events are processed at the tenant level. When a new order is created, the system fires an event:

{
  "event_type": "order.created",
  "data": {
    "order_id": "ord-1001",
    "tenant_id": "acme-corp",
    "total": 299.99
  }
}

The event is published to a message queue (e.g., Kafka, RabbitMQ) with a topic per tenant:

topic: order.created.acme-corp

A workflow engine listens on the tenant-specific topic and executes tenant-specific flows. The system must ensure that events are delivered to the correct tenant queue and that the flow engine is scalable per tenant.

A common failure is a missing tenant-specific event handler. A workflow expects order.created.acme-corp but the system publishes to order.created.acme-corp, causing a backlog of unprocessed events and delayed processing.

Tenant Management and Monitoring

The platform provides a tenant management dashboard. The dashboard displays tenant health, resource usage, and recent activities. The system logs tenant-specific events to a tenant_logs table:

CREATE TABLE tenant_logs (
  id UUID PRIMARY KEY,
  tenant_id TEXT NOT NULL,
  level TEXT NOT NULL,
  message TEXT NOT NULL,
  metadata JSONB,
  timestamp TIMESTAMPTZ DEFAULT NOW()
);

A typical log entry:

{
  "id": "log-12345",
  "tenant_id": "acme-corp",
  "level": "error",
  "message": "Failed to send email notification: SMTP connection timeout",
  "metadata": {
    "flow_id": "send-welcome-email",
    "retry_count": 3,
    "error_code": "SMTP-504"
  },
  "timestamp": "2023-10-05T13:45:22Z"
}

The platform provides a query API:

GET /api/tenant-logs?tenant_id=acme-corp&level=error&from=2023-10-05T00:00:00Z

It returns a paginated list of logs with metadata. A common failure is a log entry with tenant_id = 'acme-corp' but the tenant does not exist in the tenants table, leading to orphaned logs and missing dashboards.

Tenant-Specific Error Handling and Debugging

When an error occurs in a tenant-specific flow, the system includes tenant context in the error response:

{
  "error": {
    "code": "FLOW_EXECUTION_FAILED",
    "message": "Failed to execute onboarding flow",
    "details": {
      "flow_id": "onboarding-123",
      "step": "send_welcome_email",
      "input": { "user_id": "usr-456" }
    },
    "tenant": {
      "id": "acme-corp",
      "name": "Acme Corporation"
    },
    "trace_id": "trace-789"
  }
}

The system correlates all logs, events, and API calls under a trace_id across tenants. The error is logged and visible in the tenant’s monitoring dashboard. A common failure is a missing trace_id in a flow, leading to isolated error reports that cannot be traced across services.

Tenant-Specific Deployment and Versioning

The platform supports versioned deployments per tenant. A deployment includes a manifest.json file that defines the version, dependencies, and configuration:

{
  "version": "1.2.3",
  "dependencies": [
    "flow:[email protected]",
    "form:[email protected]"
  ],
  "config": {
    "features": {
      "enable_sms": true
    }
  }
}

The system applies the deployment to the tenant’s environment. A deployment can be rolled back with a rollback command:

POST /api/tenant/rollback
Content-Type: application/json

{
  "tenant_id": "acme-corp",
  "version": "1.1.0"
}

The system reverts all flows, forms, and configuration to the previous version. A failure occurs when a deployment references a flow that does not exist in the tenant’s library, leading to a 404 Not Found error during deployment.

This page was rewritten on 16 October 2026. It replaced a templated version that was not specific to its own title. How these pages are written and checked. If anything here is wrong, tell us at [email protected] and we will correct it.