Most businesses run on a patchwork of separate tools, each with its own login, its own copy of the customer list and its own rules for who may do what. MC2 brings them together: quoting and invoicing, accounting, payments and subscriptions, each a dedicated application behind a single account. Teams sign in once, move between the businesses they serve, and every application already knows who they are and what they are permitted to do.
Accounting is taken care of as well: MC2's accountants keep the books, leaving owners free to focus on the performance and day-to-day running of their business.
The architecture
Stripe
Payments, outside the platform. Tells it what happened, signed.
Browser
A signed, HttpOnly session cookie. Never a token.
Team device
Registered once, by an admin.
Encrypted tunnel
Every hostname resolves to a private address.
Control plane
The one public door: two ports, nothing else.
Webhooks
Its own host, never behind the gateway. Checks the signature, stores each event once.
Router
One host per app, split by path. TLS, security headers, sign-in rate limits.
App frontends
Server-rendered, one per product, on a shared design layer.
AI agent
Any API can ask it. Acts as the user; no database.
Gateway
Session, entitlement, refresh, a token per API, a proof per request.
Sessions
Tokens, kept server side.
Identity provider
The only issuer. Two-factor, businesses, roles.
Accounts
Businesses, invitations, entitlements, organizations.
Internal only, one caller.
Operations API
Invoices, quotes, expenses.
Accounting API
A double-entry ledger.
Payments API
Checkout, subscriptions, payment events.
Catalogue API
The apps a business can use.
Relational database
A schema per domain and a role per service. The ledger and the audit trail are hash-chained.
Scheduler
Jobs, on a database of their own.
Migrations
Every schema change, before a rollout.
Telemetry
Traces, logs and metrics from every service and the browser. Thirty days kept, dashboards in git.
Alerts
Rules on server errors, memory, disk, certificates and backups.
Team chat
Every alert lands in the team's channel, the moment it fires.
- A requestA request and its answer: browser, tunnel, router, then the gateway, a reverse proxy that forwards it to one API and waits for the reply. Only sign-in pages go from the router straight to the identity provider.
- A webhookStripe telling the platform what happened, on its own host and never through the gateway. The signature is checked and each event stored once, for payments to act on.
- IdentityTokens and proofs: sign-in, refresh, one exchanged token per API, sign-out, services calling each other, and a device joining the network once.
- The agentAny API can ask the AI agent. It acts as the user and never touches the database.
- SessionsThe gateway keeps each session server side, beside it; the browser only holds a cookie naming it.
- StateWhere things are kept: each service's own role and schema in the database.
- TelemetryTraces, logs and metrics from every layer, gathered in one place. Alert rules watch them and post to the team chat, so a failure is seen the moment it happens.
Merge
A key that can only start a build
Checkout
The commit, in the cluster
CI checks
The repository's own, against a real database
Build image
Rootless, tagged with the commit
Pin image
In the deployment repository
Deploy
The cluster syncs itself, migrations first
- A change shippingA merge, built, checked and deployed inside the cluster, with no credentials anywhere else.
Questions about the design
What happens to one request, step by step?
1. The browser calls an app's /api path, carrying only its session cookie.
2. The router sees an API path and hands it to the gateway. There is no route to the API itself.
3. The gateway refuses an unsafe request from another origin, finds the session and checks it is still live: a sign-out anywhere else ends it here.
4. It checks the business has this app. If the account service does not answer, it trusts what it knew for ten minutes at most, then refuses.
5. If the user's token is about to expire it is refreshed, once, however many requests are in flight.
6. The token is exchanged for one meant only for this API and this business, and a proof is signed binding it to this exact request.
7. The cookie, and anything else the client should not have sent, is stripped, and the request goes on.
8. The API checks the signature, its own name as the audience, the proof, and that the user passed two-factor for this business. Only then does the query run, scoped to that business.
Why do tokens never reach the browser?
Because anything the browser holds, a script injected into the page can take. The browser keeps only a signed, HttpOnly cookie. Such a script can still make requests while the page is open, but it cannot carry a token away to use later.
Why does every API get its own token?
A token minted for accounting is worthless at operations, so one leak opens one door, for one business. Every token is also bound to a key, and each request carries a fresh proof signed with it, so a copied token on its own does nothing.
Why does the gateway not issue tokens itself?
The identity provider is the only issuer, so there is exactly one place that decides who someone is. The gateway only asks it for tokens and passes them on, and every service checks them for itself rather than trusting the gateway.
Why not check sign-in at the router?
An auth check bolted onto the router fails open: any route that forgets it is unprotected. Here an API has no route at all, so one without a gateway entry is simply unreachable, and the network denies everything that is not allowed by name.
Where do businesses and roles live?
At the identity provider: a business is an organization and its groups are the roles. The token already says who belongs where and as what, so the database keeps no copy that could drift.
How are services kept out of each other's data?
Each one connects as its own database role and owns one schema. Domains read each other only through narrow views, and no service can rewrite the hash chain that seals the ledger and the audit trail.
When is two-factor needed?
Whenever someone acts for a business. If the sign-in comes back without a second factor, the gateway asks once more, then refuses.
What does it trade away?
One node and one replica of everything: simple and cheap while in development, and the first thing to change before customers.
Tenant isolation is a business id in every query, enforced by checks in CI, rather than row-level security in the database.
Everything passes through one gateway, uploads included: one path to secure and watch, and one path to scale.
Being reachable only on a private network keeps the attack surface tiny, and means there is no public entrance yet.
Where does it stand?
Identity, the gateway, the database and the infrastructure run in development. The product APIs and frontends are being rebuilt on top of them, database first.
