Skip to content

Raydium and Multi-Tenancy

A living reference for architects, engineers, and product owners


Purpose

Raydium is a micro-framework that lets a single codebase operate any number of fully isolated “tenants” (client sites, regional brands, white-label instances, etc.). WordPress itself remains untouched: for each request Raydium decides which tenant you’re serving, loads only that tenant’s environment, and then boots an ordinary single-site WordPress run. Isolation lives entirely in configuration, not in forked code or patched core.


Core Ideas at a Glance

PrincipleWhat It Means in Practice
Up-stream orchestrationAll tenant logic happens before WordPress loads. WP gets standard constants; it never “knows” multiple tenants exist.
Config over forksTenants are defined by simple JSON & .env files—not separate Git repos—so updates ship once.
Service container disciplineEvery shared resource (DB, cache, mail, logs) is requested from a lightweight dependency-injection container that’s already seeded with the tenant’s settings.
Middleware pipelineRequest processing is a lineup of small, swappable steps (security, tenant resolution, auth, logging…) that you can reorder without touching WP hooks.

High-Level Lifecycle

Incoming Request


1. Framework Boot
   – load global env & settings
   – build service container


2. Tenant Resolution
   – map host / path → tenant ID
   – merge tenant-specific env & config


3. Middleware Chain
   – security headers
   – authentication
   – rate limits, logging, etc.


4. WordPress Hand-Off
   – include wp-blog-header.php
   – WP runs exactly once, with tenant’s
     DB credentials & table prefix


5. Response
   – send headers & body
   – record per-tenant logs / metrics

Tenant Anatomy

LayerGlobal DefaultTenant Override (optional)
DatabaseOne shared server or clusterSeparate credentials / table prefix
CacheShared Redis / MemcachedUnique namespace per tenant
LogsCentral storage directorySub-folder %tenant_id%/…
Feature FlagsOff by defaultEnable per tenant via env variable
Templates / AssetsCommon theme & assetsTenant-specific theme folder (inheritance supported)

Developer Workflow

  1. Add a TenantCreate a record in the tenant map, copy a template env file, fill in DB credentials and any flags.
  2. Run LocallyHost alias → tenant domain; the framework routes each host to its env on the fly.
  3. Ship UpdatesMerge once, deploy once; every tenant automatically receives the fix or feature.
  4. DebugTail the tenant’s dedicated log folder or watch aggregated dashboards—no mixed messages.

Operational Gains

Challenge without RaydiumHow Multi-Tenancy Solves It
Patch explosion (same hot-fix in 30 repos)One patch, one pipeline, all tenants updated
Data-leak risk (shared WP multisite tables)Isolated tables / DBs chosen per request
Slow spin-up (new repo, new CI job)Add JSON entry + env file → site is live
Plugin compatibility doubtsWordPress core stays vanilla, so 99 % of plugins “just work”

Beta Caveats

  • API still fluid – File names and middleware IDs may rename; track release notes.
  • Docs lag edge-cases – Exotic tenancy rules (wildcard paths, CLI cron) are evolving.
  • Governance required – Because tenants share code, reckless commits can affect all sites; keep CI quality gates strict.

Roadmap Highlights

  1. GUI Tenant Manager – Web UI for non-technical staff to add/edit tenants.
  2. Tenant-Scoped Asset Builds – Automatic theme & CSS/JS compilation per tenant.
  3. First-class Docker/K8s Charts – Blue-green deployments with tenant-aware health probes.
  4. Pluggable Auth Middleware – Drop-in SSO or JWT modules without touching core.

Should You Adopt Now?

Good FitNot Yet
Agencies/SaaS juggling 5–100+ client sites with one dev teamProjects locked to shared cPanel hosting
Teams comfortable editing env/JSON & using Composer in CI/CDStakeholders needing point-and-click set-up today
Early adopters who can give beta feedbackRegulated industries forbidding beta dependencies

Key Takeaway

Raydium’s multi-tenancy is invisible to WordPress and transparent to users. By moving every tenant decision into a thin PHP shell before the WP bootstrap, you get:

  • Isolation worthy of separate installs
  • Maintenance speed of a single repo
  • Zero intrusion into WordPress core

If that balance—isolate data, unify code—matches your long-term scalability goals, Raydium is already proving itself in the field. Clone, experiment, and help shape the 1.0 release.