Multi-Tenant SaaS Architecture for a B2B Job Marketplace
Client: Product Build — SDT LTD · Industry: HR Technology / SaaS · Role: Tech Lead & Project Owner · Duration: 8 months
The Challenge
Building a B2B job marketplace where recruiting-agency tenants required contractual data isolation. A shared-schema approach was ruled out early. The challenge was designing a database-per-tenant architecture that could scale to 200+ tenants while keeping migration orchestration and connection pooling manageable for a 23-person cross-functional team shipping on a fixed go-live date.
The Solution
Implemented database-per-tenant using stancl/tenancy v3 in Laravel. Built a custom migration orchestration command that runs tenant migrations in batches of 20 with retry logic and Slack failure alerts. Configured lazy database connections with a 30-second idle timeout to manage connection pool overhead. Designed the central/tenant context-switching pattern so existing Eloquent models — including the AI job-matching and resume-parsing services — worked without modification.
Results & Impact
- Onboarded 200+ tenants with full data isolation
- Migration across all tenants completes in under 4 minutes
- Zero cross-tenant data leaks in production operation
- New tenant provisioning automated to under 30 seconds
- AI job-matching and resume-parsing features shipped without tenancy-layer rework