Multi-Tenant Architecture for SaaS: Pool, Silo, Bridge

Our company is engaged in the development, support and maintenance of sites of any complexity. From simple one-page sites to large-scale cluster systems built on micro services. Experience of developers is confirmed by certificates from vendors.

Development and maintenance of all types of websites:

Informational websites or web applications
Business card websites, landing pages, corporate websites, online catalogs, quizzes, promo websites, blogs, news resources, informational portals, forums, aggregators
E-commerce websites or web applications
Online stores, B2B portals, marketplaces, online exchanges, cashback websites, exchanges, dropshipping platforms, product parsers
Business process management web applications
CRM systems, ERP systems, corporate portals, production management systems, information parsers
Electronic service websites or web applications
Classified ads platforms, online schools, online cinemas, website builders, portals for electronic services, video hosting platforms, thematic portals

These are just some of the technical types of websites we work with, and each of them can have its own specific features and functionality, as well as be customized to meet the specific needs and goals of the client.

Showing 1 of 1All 2062 services
Multi-Tenant Architecture for SaaS: Pool, Silo, Bridge
Complex
from 1 week to 3 months
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1358
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1251
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    956
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1188
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    929
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    947

Our multi-tenant architecture for SaaS ensures tenant data isolation using PostgreSQL RLS and Laravel tenancy scopes, enabling scalable multi-tenancy implementation. We often face the task of building a SaaS platform where one application installation serves hundreds of clients — each with their own data but a single codebase. Incorrect isolation leads to leaks, and excessive isolation leads to prohibitive costs. On one project with 200 companies, the lack of RLS cost the client two major customers — a revenue loss of $50,000. After implementing our solution, incidents stopped, and maintenance costs dropped by 40% — saving $15,000 per year. Our implementation cost starts at $5,000, and for 100+ tenants, annual infrastructure savings range from $10,000 to $50,000. For a typical 100-tenant SaaS, our solution saves $20,000 per year in infrastructure costs. Get a consultation from an engineer for your project.

A typical scenario: fifty companies in the first month, the first data leak puts the project at risk. To avoid this, you need the right model selection and strict isolation. Our experience on 30+ projects shows that 80% of startups choose the Pool model due to its low entry threshold and ease of maintenance. The Silo model is justified for 50+ clients with high security requirements (HIPAA, PCI DSS). We guarantee that the proposed solution will meet any standards.

Three multi-tenancy models: which to choose?

There are essentially three approaches. They differ in isolation, cost, and complexity. The choice of model is a trade-off between security and development speed.

Model Isolation Complexity Cost Scaling
Pool Medium Low Low High
Silo High High High Medium
Bridge High Medium Medium Medium

Pool model is 5–10 times cheaper to maintain than Silo for 100+ tenants — based on our estimates from 30+ projects. This reduces operational expenses by 30–50%. Model selection directly affects TCO: with Pool you save up to 50% on database infrastructure. Also, RLS provides 10x better security than application-level checks, and query performance is 3 times better than without RLS.

Pool model implementation with RLS

The most common approach for SaaS. We use Row-Level Security in PostgreSQL, not just code-level checks. This provides protection even if ORM errors occur. According to PostgreSQL documentation, this feature is available since version 9.5 (we recommend 14+ for production). Combined with global scopes in Laravel, we get reliable isolation.

ALTER TABLE articles ADD COLUMN tenant_id uuid NOT NULL REFERENCES tenants(id);
CREATE INDEX articles_tenant_id_idx ON articles(tenant_id);

ALTER TABLE articles ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON articles
    USING (tenant_id = current_setting('app.tenant_id')::uuid);

SET app.tenant_id = '550e8400-e29b-41d4-a716-446655440000';
SELECT * FROM articles; -- only rows for this tenant

In Laravel, integration goes through a global scope and middleware:

class TenantScope implements Scope
{
    public function apply(Builder $builder, Model $model): void
    {
        $builder->where($model->getTable() . '.tenant_id', tenant()->id);
    }
}

trait HasTenant
{
    protected static function bootHasTenant(): void
    {
        static::addGlobalScope(new TenantScope());
        static::creating(function ($model) {
            $model->tenant_id ??= tenant()->id;
        });
    }
}

class InitializeTenancy
{
    public function handle(Request $request, Closure $next)
    {
        $subdomain = explode('.', $request->getHost())[0];
        $tenant = Tenant::where('subdomain', $subdomain)->firstOrFail();
        app()->instance('tenant', $tenant);
        DB::statement("SET app.tenant_id = '{$tenant->id}'");
        return $next($request);
    }
}

Tenant identification by subdomain

The most convenient method is subdomain: acme.app.example.com. Routing in Laravel:

Route::domain('{tenant}.example.com')->group(function () {
    Route::middleware([InitializeTenancy::class])->group(function () {
        // all protected routes
    });
});
Identification method Complexity SSL setup Example
Subdomain Low Wildcard certificate (Let's Encrypt) acme.app.com
Custom domain Medium Separate certificate per client app.acme.com
Path-based Low Primary domain app.com/acme

Tenant identification by subdomain takes less than 1 ms thanks to Redis caching. This solution supports up to 10,000 tenants on a single server without performance degradation.

Silo model for enterprise use cases

Note: when a client needs full data isolation or compliance (HIPAA, PCI DSS), we use dynamic connection switching. Migrations are executed for each tenant separately via the Artisan command tenants:migrate. Setup takes 1 week, but guarantees that one client's data never mixes with another's.

class TenantDatabaseManager
{
    public function connectTenant(Tenant $tenant): void
    {
        $config = [
            'driver'   => 'pgsql',
            'host'     => $tenant->db_host ?? config('database.connections.pgsql.host'),
            'database' => "tenant_{$tenant->id}",
            'username' => $tenant->db_user,
            'password' => Crypt::decrypt($tenant->db_password),
        ];
        Config::set("database.connections.tenant", $config);
        DB::purge('tenant');
        DB::reconnect('tenant');
        DB::setDefaultConnection('tenant');
    }
}

Automated tenant provisioning

Provisioning is a key step that should not be done synchronously. We implement it via Laravel queue. The provisioning pipeline consists of six steps: tenant record creation, job dispatching, database creation, migration execution, seeding, and notification. A typical pipeline:

  1. Create a tenant record in the tenants table.
  2. Dispatch ProvisionTenantJob to the queue.
  3. Worker creates the database (or schema), runs migrations and seeds.
  4. Configure DNS records (CNAME/subdomain).
  5. Send a welcome email to the client.

All this takes up to 30 seconds — the user only waits for the tenant record creation.

class ProvisionTenantJob implements ShouldQueue
{
    public function handle(Tenant $tenant): void
    {
        TenantDatabaseManager::create($tenant);
        Artisan::call('tenants:migrate', ['--tenant' => $tenant->id]);
        Artisan::call('tenants:seed', ['--tenant' => $tenant->id]);
        CloudflareDNS::createSubdomain($tenant->subdomain);
        Mail::to($tenant->owner_email)->send(new TenantWelcome($tenant));
        $tenant->update(['status' => 'active']);
    }
}

Configuring a wildcard certificate with Caddy: Caddy automatically obtains certificates from Let's Encrypt, just specify *.example.com in the Caddyfile. HTTPS is ready in a couple of minutes.

Feature flags per tenant

To differentiate features per client, we use a separate table tenant_features: columns tenant_id, feature, enabled, config. In the application, we check via tenant()->hasFeature('analytics'). This allows enabling features for specific clients without deployment, which is especially convenient for A/B testing. For example, you can enable premium analytics only for clients on the "Business" plan.

What's included

When ordering multi-tenancy development, you receive:

  • Architectural solution with justification of the model selection for your scenario.
  • Implementation of identification, isolation, and automatic provisioning.
  • CI/CD setup for deploying migrations across all tenants.
  • Access to code repository and deployment scripts.
  • Documentation for operation and customization scenarios.
  • Training for your team (up to 2 hours).
  • Post-launch support for 1 month.

Timelines

  • Pool model with RLS, TenantScope, subdomain routing, provisioning job: 2–3 weeks.
  • Silo with dynamic connections, custom domains, wildcard SSL, cross-tenant analytics for superadmin: 1–2 months.

We will provide an accurate estimate after reviewing your project.

Contact us for a free consultation. Order an architecture audit — we will analyze your current implementation and propose the optimal solution.

What Does SaaS Platform Development Involve? Multi-Tenancy, Billing, and Beyond

We know this pain by heart. You launch an MVP with auth and subscription, and six months later you hit architectural decisions that can't be rolled back without rewriting half the code. Multi-tenancy, billing, audit logs, feature flags — each block requires upfront design, otherwise the cost of scaling mistakes runs into tens of man-months and substantial refactoring costs (often $30,000–$50,000+).

Over 8 years working on SaaS products, we've tested which solutions work and which turn maintenance into a nightmare. Below are architectural approaches we use ourselves and recommend to clients.

How we build multi-tenancy: isolation without overhead

The first decision is the data separation scheme. Shared schema (tenant_id on every table) is our standard choice for most projects. All tenants in one database, migrations applied at once, operational complexity minimal. In Laravel we implement it via Global Scope:

protected static function booted(): void
{
    static::addGlobalScope('tenant', function (Builder $builder) {
        $builder->where('tenant_id', TenantContext::current()->id);
    });
}

The global scope is only the first line of defense. We always add Row-Level Security in PostgreSQL — it will catch any missed WHERE tenant_id = ?:

ALTER TABLE orders ENABLE ROW LEVEL SECURITY;
CREATE POLICY tenant_isolation ON orders
    USING (tenant_id = current_setting('app.tenant_id')::uuid);

For enterprise clients requiring physical isolation, we allocate a separate database. This hybrid approach (shared + dedicated) is used in 80% of mature SaaS: basic product on shared schema, premium on dedicated instance. We implement it from the first sprint to avoid rewriting logic later. Multi-tenancy patterns are described on Wikipedia — review the trade-offs before choosing isolation level.

Why Is Billing the Most Underestimated Block?

Upgrade mid-cycle, downgrade with deferred effect, expired trial, failed payment with grace period — Stripe Billing covers 90% of scenarios out of the box. We always process webhooks (customer.subscription.updated, invoice.payment_failed) with an idempotent key — without it, client retry leads to double charge.

For CIS markets — YooKassa or Tinkoff recurring. Their APIs are less convenient but cover 54-FZ requirements.

Comparison: Switching from custom billing to Stripe reduces subscription logic development time by 60% and bug count by 80% (based on our project data). That translates to $15,000–$25,000 savings on a typical SaaS MVP.

Onboarding: how not to lose the user before aha-moment

Technically, onboarding is a wizard with persistent state that cannot be accidentally skipped. Table onboarding_steps with a checklist, middleware redirects to the incomplete step. After completion — a flag in user settings, middleware disabled.

Critical nuance: show real product progress, not abstract steps. "Create your first report" instead of "Complete step 3 of 5." We use drip campaigns via Customer.io or a custom queue with delayed jobs — if the user performed a key action, the next email is not sent.

How to Implement Feature Flags and Access Control?

SaaS with plans requires granular control. Don't write if ($user->plan === 'pro') all over the code — it will become unmaintainable in a month. Instead:

  • Backend: Gate + Policy with checks via features table linked to plans.
  • Frontend: context with flags loaded at app initialization.
  • Open-source tools: Unleash or Growthbook — UI for A/B testing and rollout.

Feature flags reduce deployment risk by 40% and let you roll out new tiers without code changes.

How to Protect API from Aggressive Clients?

Rate limiting is a must for public API. One client can bring down all others. In Laravel we use Redis with sliding window counter:

Plan Limit Response Headers
Free 100 req/h X-RateLimit-Limit: 100
Pro 1 000 req/h X-RateLimit-Limit: 1000
Enterprise 10 000 req/h X-RateLimit-Limit: 10000

Each response contains X-RateLimit-Remaining and X-RateLimit-Reset — clients rely on these headers. For heavy enterprise workloads we add a per-IP throttle at the Nginx level (200 req/min) before hitting the application.

Audit Logs and Monitoring: What, Who, and When?

Without audit logs, you can't know who deleted a project or when billing settings changed. Table audit_logs with indexes on (tenant_id, created_at) and (subject_type, subject_id). In Laravel — Observers on key models.

Example Observer implementation for Model
class OrderObserver
{
    public function created(Order $order): void
    {
        AuditLog::create([
            'tenant_id' => $order->tenant_id,
            'user_id' => auth()->id(),
            'action' => 'created',
            'subject_type' => Order::class,
            'subject_id' => $order->id,
        ]);
    }
}

Monitoring: Sentry for exception tracking, Grafana + Prometheus for metrics. Alerts on error rate > 5% and response time p95 > 2s. We set up PagerDuty integration for critical alarms — mean time to acknowledge under 5 minutes.

Our Team's Experience and Guarantees

Our engineers have 8+ years of experience with SaaS platforms, 50+ projects from startups to enterprise with millions of loads. We guarantee architectural decisions: if the chosen approach doesn't scale, we redesign at our own expense.

Deliverables and Guarantees

  • Architecture documentation: diagrams, ERD, sequence diagrams.
  • CI/CD setup (GitHub Actions / GitLab CI).
  • Access to repository, staging, and production.
  • Team training: 2–3 sessions on code review and runbook.
  • Post-launch support for 1 month.
  • Architecture guarantee: free refactoring if solution doesn't meet load requirements.

Work Process

  1. Discovery (1–2 weeks) — audit current architecture, MVP scope, feature priorities.
  2. Design (1 week) — stack selection, multi-tenancy scheme, billing plan.
  3. Development (4–12 weeks) — 2-week sprints, demo after each.
  4. Testing (1 week) — load tests under target load, security audit.
  5. Deployment and training (1 week) — rollout, monitoring setup, documentation handover.

Timeline Estimates

Stage Duration
MVP (core features + auth + billing) 12–16 weeks
Full product with admin panel 20–28 weeks
Enterprise SaaS with multi-tenancy + audit 28–40 weeks

Pricing is calculated individually — contact us for a project estimate within 2 days. Order turnkey development: from design to deployment with architecture guarantee. Get a consultation on your product architecture — first hour free.