Open-source multi-tenant API gateway

Turn your microservices
into multi-tenant products.

Before your code runs, the SOAJS gateway knows which customer is calling, what they are allowed to use and who the user is. Tenant keys, per-API ACL and OAuth work together, so each customer gets exactly the access in their package. Rate limiting, caching and idempotency come with it. You write the business logic.

Free and open source, Apache-2.0Node.js, Go and PythonCloud, on-prem or air-gappedMCP-ready for AI agents
orders/index.js: your whole handler
service.get('/orders', (req, res) => {
  // The gateway already resolved the tenant, applied
  // its package ACL to this API and checked the user.
  const { tenant, urac, inputmaskData } = req.soajs;

  orders.list(tenant.id, urac._id, inputmaskData, (err, data) =>
    res.json(req.soajs.buildResponse(err, data)));
});

New · MCP for AI agents

Every service is an MCP tool. With each customer's permissions.

AI agents connect to one gateway endpoint and see your APIs as tools. The tenant's package and the user's ACL decide which ones, exactly as they do for your apps. A tool call is an ordinary API call: OAuth, ACL, rate limiting and idempotency apply before your service runs.

  • No MCP server to write. SOAJS services describe their APIs from config.js; Node.js, Python and Go services from their Swagger.
  • No second permission system. An agent gets what its key's package and its user allow. Give agents their own key and package to narrow it further.
  • No way around your rules. Every tool call goes through the same gateway checks as any other call, and counts toward your rate limits and activity tracking.

Connect an agent →

MCP client configuration
{
  "mcpServers": {
    "acme": {
      "url": "https://api.example.com/soajs/mcp",
      "headers": {
        "key": "<Acme's agent key>",
        "Authorization": "Bearer <user token>"
      }
    }
  }
}

Sound familiar?

The plumbing every multi-tenant product ends up rebuilding

Every customer needs different access

Plans, partners and enterprise deals turn into per-customer flags and special cases in business logic, one if at a time.

With SOAJS: each customer's key maps to a product package, and its ACL decides, API by API, what that customer can call.

Every service re-implements auth

Copy-pasted token checks drift across teams and languages until nobody is sure which rules apply where.

With SOAJS: OAuth tokens, tenant keys and user groups are checked once, at the gateway, for every service.

Traffic rules live in ten places

Rate limits, response caches and safe retries get rebuilt in each service, or skipped.

With SOAJS: rate limiting, GET caching and Idempotency-Key replay protection are gateway settings, per service.

Sockets and jobs skip the rules

Real-time servers and background workers grow a second, weaker copy of your access control.

With SOAJS: they authenticate through the same gateway and get the same ACL as HTTP calls.

Tenants × ACL × OAuth

One set of services. Every customer gets exactly what they bought.

The power is in the combination. The key says which customer is calling, their package's ACL says what they can reach, and the OAuth token says which user is acting. The gateway applies all three on every request.

Example: one Commerce product, three packages, the same three APIs
CallerGET /catalogPOST /ordersGET /reports
AcmePro packagePublicSigned-in usersManagers group only
GlobexBasic packagePublicSigned-in usersNot in package
StorefrontGuest packagePublicNot in packageNot in package

Same service, same code. Only the package each key belongs to is different.

  • The key picks the tenant and the package. Each customer application gets its own external keys, with their own expiry.
  • The package ACL decides each API. Public, signed-in only, or limited to user groups, per environment, service version and HTTP method.
  • The OAuth user can widen or narrow access. URAC groups can grant their own packages, so an admin inside a tenant sees more than a regular user.
  • Change access without touching services. Update a package in the console and the gateway enforces it for every service behind it.

What you stop writing

Every check runs before your code does

Every call goes through the same ordered pipeline. Set extKeyRequired, oauth andurac in a service's config and it gets all of them, with no auth code in the service.

Read the gateway reference →

  1. Protect the edgeIP ban list and global maintenance mode.
  2. Resolve the tenantThe external key identifies tenant, application and product package.
  3. Check the package ACLIs this service, version and API in the package the key belongs to?
  4. Validate the tokenOAuth access token, including tenant-restricted and device-bound tokens.
  5. Apply user and tenant accessURAC user, group and per-tenant overrides.
  6. Shape trafficIdempotency-Key replay protection, rate limiting and GET response caching.
  7. Route the callFound through the service registry and forwarded with tenant context attached.

The gateway, in full

Everything the gateway does for every service behind it

All of it is configuration: in the registry, the console or a service's config file. None of it is code in your services.

Tenants & keys

  • Tenant, application and product package resolved from each external key
  • Key expiry dates
  • Per-key IP allow and deny lists
  • Per-key device rules by browser and user agent
  • Per-tenant service configuration and tenant profiles
  • Package overrides per network

Access control

  • Package ACL per environment, service, version, HTTP method and API
  • Public, signed-in or group-only APIs
  • Restricted mode: only listed APIs are reachable
  • Application-level ACL overrides
  • User groups that grant their own packages
  • Memberships resolved per product
  • /soajs/acl so sockets and other servers share the same rules
  • /soajs/mcp: the same APIs as MCP tools for AI agents

Identity & tokens

  • OAuth 2.0 access tokens checked on every private API
  • The signed-in user and their groups forwarded to your service
  • Tenant-restricted tokens for cross-tenant pairing
  • Device-bound tokens checked against a device-id header
  • Login through the oauth service: password, LDAP, OpenAM, social, Azure AD, PIN or phone code

Traffic

  • Rate limiting by tenant or by tenant and IP
  • Separate strategies for public and private APIs, overridable per service
  • IP ban list
  • GET response caching with per-API TTL, in memory or MongoDB
  • Idempotency-Key replay protection for writes
  • CORS settings per environment

Routing & operations

  • Service registry and discovery, routing by service name and version
  • Tenant and user context forwarded on every call
  • Proxy calls to another environment's gateway with its own key
  • Roaming between deployments, carrying the verified tenant and user
  • Global and per-service maintenance mode, readiness checks and registry reload
  • Last-seen tracking with triggers by service, method or API
  • Error logs with sensitive values redacted

Runs where you do

  • Node.js gateway on Express 5, scaled out with replicas
  • Go gateway 4.4.34, answering as the Node.js gateway does
  • Kubernetes with Helm, cloud or on-prem
  • Fully air-gapped deployments
  • Services in Node.js, Go or Python behind the same rules

Gateway reference →

How it fits together

A multi-tenant, real-time product on SOAJS

Apps, a real-time server, background jobs and your own services all go through one gateway. Tenancy, ACL and tokens are decided there, once.

Swipe sideways to see the whole diagram.

Example architecture of a multi-tenant product on SOAJSClients call the SOAJS gateway over HTTPS with a tenant key and access token. The real-time socket server authenticates each connection through the gateway and sends every API call through the gateway pipeline. The gateway resolves the tenant, checks the package ACL, validates the OAuth token, applies URAC access and traffic policy, then routes to SOAJS core services or your own microservices. Scheduled jobs call the gateway with their own tenant key. AI agents connect over MCP to /soajs/mcp, see the APIs their key and user allow as tools, and each tool call goes through the same pipeline.ClientsMobile appsiOS · AndroidWeb portalscustomer & admin, as static UIsPartner integrationsserver-to-server API callsAI agentsMCP clients · assistants, copilotsAHTTPS · key + access_tokenEMCP · POST /soajs/mcpBWebSocketReal-time servere.g. Socket.IOauth: GET /soajs/aclemit('api') → gatewaySOAJS gatewaysoajs.controller · scale with replicas1External key → tenanttenant · application · package2Package ACLservice · version · API3OAuth tokenrestricted · device-bound4URAC user & tenantuser · groups · overrides5Trafficrate limit · cache · idempotency6Route via registryservice name + versionMongoDBregistry · tenants · products · ACLDScheduled jobs & other deploymentscron jobs and daemons call the gateway with their own tenant keyeach customer, region or network can be its own tenantSOAJS core servicesoauth · urac · multitenant · consoleCYour microservices · Node.js, Go, PythonAccountsonboarding · organizations · profilesProductcatalog · orders · paymentsMessagingchat · notifications · email & SMSPlatformfiles · analytics · reportingThird-party servicespayments, media, messaging
  1. API calls. Each client app has its own external key, tied to a tenant and a product package. Every request carries that key and the user's access token, and the gateway runs steps 1–6 before your code executes. Device-bound tokens also need the matching device-id header.
  2. Real-time. Your socket server doesn't need its own auth. It validates each connection's key and token with the gateway's /soajs/acl endpoint, then sends API calls through the same gateway pipeline as HTTPS traffic, so one ACL covers both.
  3. Service to service. Services call each other and the core services through SOAJS inter-service connections, with tenant and user context carried on each call. A service only declares extKeyRequired, oauth and urac in its config; it writes no authentication code.
  4. Jobs and deployments. Background jobs are clients too: they call the gateway with their own tenant key and get the same ACL. Model each customer, region or network as a tenant to keep their data and access apart.
  5. AI agents. Agents connect over MCP to /soajs/mcp with their own tenant key and a user's token. They see the APIs that key's package and that user allow as tools, and every tool call goes through steps 1–6 like any API call. MCP for AI agents

Connect Spaces runs this pattern in production: 23 microservices and a Socket.IO real-time layer behind one SOAJS gateway. Read the case study.

Beyond the gateway

The rest of the platform

Input validation

Declare each API's inputs, sources and JSON-schema validation in config. Requests arrive at your handler already mapped and validated.

Users, groups and login

The urac and oauth services manage users, groups, invitations and every login method, per tenant.

Console and marketplace

A web console for environments, tenants, keys, products, packages, the service catalog, Git repositories and infrastructure.

Deploy and SDKs

Helm charts for every core service, in-container deployment from source, and SDKs for Node.js, Go and Python.

Configuration, not boilerplate

Three flags instead of an auth layer

A service's config tells the gateway who may call it, which APIs it exposes, and how each input is sourced and validated. By the time your handler runs, the caller is known and the input inreq.soajs.inputmaskData is already clean.

Build your first service →

config.js
module.exports = {
  type: 'service',
  serviceName: 'orders',
  serviceGroup: 'commerce',
  servicePort: 4100,
  requestTimeout: 30,
  extKeyRequired: true, // tenant key + package ACL
  oauth: true,          // access token required
  urac: true,           // user context on req.soajs
  maintenance: { readiness: '/heartbeat', port: { type: 'maintenance' } },
  schema: {
    get: {
      '/orders': {
        _apiInfo: { l: 'List orders', group: 'Orders' },
        limit: {
          source: ['query.limit'],
          default: 50,
          validation: { type: 'integer' }
        }
      }
    }
  }
};

Built on SOAJS

We build our own products on it

Encrypted communications, regulated healthcare, IoT, fintech and social: our team runs each of these on SOAJS. Many more products have been built on it by other teams.

126
microservices across our products
7
multi-tenant products
23
services behind a single gateway in Connect Spaces

Connect Spaces

Secure communications

Chat, end-to-end-encrypted calls and meetings, with separate Spaces per organisation, deployed in the cloud or fully air-gapped.

Aomie

Regulated healthcare

A multi-tenant platform for regulated medical-cannabis care: patients, prescriptions, catalog, orders and compliance, with AI-assisted prescription processing.

INFLUENCE by The London Fund

Venture and capital operations

A venture-as-a-service operating system covering deals, campaigns, accounts and e-signature, with an event-driven financial back end.

Coupond

Retail loyalty and promotions

A loyalty and promotions platform with a rules-based promotions engine, catalog, scan analytics and point-of-sale integrations.

Nell

IoT orchestration

Multi-network IoT orchestration across LoRaWAN, BLE, GPS and Wi-Fi, with fleet device management and logistics tools.

Carrot

Social media and web3

A blockchain-enabled social platform built around modular content Cards, with creator-governed access, AI moderation and tokenised ownership.

SLIC

Creator–brand marketplace

A marketplace connecting creators and brands, with campaign workflows, automated payouts and ROI reporting.

Try it on your own cluster

Install the gateway and core services with Helm, then put your first service behind it.