What is multi-tenant architecture in WORKSPHR?
A single deployment of WORKSPHR that hosts independent organizations under their own subdomains, with row-level data isolation, per-tenant branding and feature flags, and a super-admin console that can spin up or wind down a subsidiary without engineering involvement. Built on AWS ap-southeast-1 for data residency.
Why running 6 HR systems doesn't scale
Every subsidiary on a different tool means 6 vendor contracts, 6 admin trainings, 6 BIR alphalist exports to consolidate, and zero visibility for the parent CFO. Multi-tenant architecture is the structural fix, not just a discount.
- Vendor sprawl. Different tool per subsidiary, no shared config
- Compliance drift. Sub A on 2024 BIR, Sub B still on 2022 brackets
- Cross-tenant leak risk. Excel exports merged manually, mistakes in HR copies
- Group reporting blind. Parent CFO has no rolled-up headcount or comp view
Enterprise architecture, ready to ship
Subdomain routing, database isolation, super-admin console, per-tenant feature flags, AWS deployment topology, the same architecture WORKSPHR uses for itself, made available to your group.
1.Subdomain-based tenant routing
Every subsidiary gets a subdomain matching its slug, e.g. acme-corp.worksphr.com. The TenantMiddleware reads the Host header on every request, resolves the org, and scopes the session, with no app-level branching needed.
- Per-subsidiary subdomain (acme-corp.worksphr.com)
- Reserved: admin · app · staging · api
- Per-tenant logo, colour, email-from
- End-users never see the parent brand
2.Database isolation per tenant
Shared schema with row-level tenancy. Every row carries an org_id. The TenantMixin declares the column and FK, the repository base class injects WHERE org_id = :org_id automatically, and CI tests block merges if a query forgets the filter.
- Single Aurora PostgreSQL Multi-AZ
- Repository base class auto-injects filter
- Cross-tenant leakage check in CI
- One backup & PITR covers everyone
3.Super-admin portal
A dedicated console at admin.worksphr.comfor the parent's IT/HR-ops team. Spin up a new tenant, suspend one, view aggregate seat usage, push a feature flag across the group, all without engineering involvement.
- Tenant create / suspend / archive
- Aggregate seat & module usage
- Cross-tenant audit-log search
- Group-level billing rollup
4.Per-tenant feature flags
The four-tier guard chain(Subscription → SDO → RBAC → Department) gates every endpoint. Enable Surveys for the BPO sub, disable Performance Management for manufacturing, and the sidebar nav for each tenant updates accordingly with no code change.
- Backend: require_feature("key") guard
- Frontend: MODULE_REQUIRED_FEATURES map
- Per-tenant overrides for trials
- Feature-disabled routes redirect to /upgrade
5.AWS deployment topology
Hosted in AWS ap-southeast-1(Singapore). CloudFront + WAF up front, ALB → ECS Fargate (FastAPI) for the backend, S3 for the frontend bundle and uploads, Aurora PostgreSQL Multi-AZ for the database, ElastiCache Redis for sessions, SES for transactional email.
- CloudFront caching + WAF + SSL
- ECS Fargate — auto-scale per tenant load
- Aurora Multi-AZ + PITR
- Secrets Manager for app secrets & DB creds
From contract to first payroll, group-wide
1.Provision tenants in the super-admin
List your subsidiaries, pick subdomain slugs, set per-tenant logos and feature flags. New tenants are spun up in under five minutes from the admin console.
2.Migrate or import per subsidiary
Each tenant gets its own employee import, payroll history, and 201 file load. WORKSPHR Implementation Specialist runs in parallel across all subs.
3.One bill, one update cycle
BIR/SSS/PhilHealth changes propagate to every tenant on the next deployment, no per-sub upgrade contract. The parent CFO sees consolidated headcount and comp on a single dashboard.
