XRAPH/Work/SaaS starter
TypeScript · since 2019

Ultimate Backend

A multi-tenant SaaS starter on NestJS: microservices behind Apollo Federation, CQRS backed by EventStoreDB, tenant resolution, billing and authentication already wired to each other. I wrote it because I kept rebuilding the same first two weeks of every project, and it is still the repository most people know me from.

Language
TypeScript
Category
SaaS starter
Since
2019
Stars
2,899
In production
01+
Repository
01

In production

1 named · more on the way
01

Multi-tenant SaaS platforms

Several teams

Tenancy skeletonAdopted as the CQRS and tenancy foundation for products that needed federation and event sourcing from the first commit rather than as a later migration.

2020Under NDA
More adopters being confirmed

Shipping something on Ultimate Backend? The list is only as complete as the people who tell me. Ask to be on it, or just say what got in your way.

Get listed
02

Anatomy

4 modules
01

Tenancy

Tenant and application scope propagated through context.

02

CQRS

Command and query separation with an event store behind it.

03

Federation

Apollo Federation across the service boundary.

04

Identity

Authentication and permission checks at the store layer.

03

Why it exists

Design notes

#What it is

A multi-tenant SaaS starter built on NestJS, published in September 2019 and still the repository most people know me from.

#What is in it

  • Microservices behind Apollo Federation, so each service owns its slice of the graph.
  • CQRS with EventStoreDB for the write side.
  • Tenant resolution wired through the request path rather than bolted onto each resolver.
  • Authentication, billing and account management already connected to each other.
  • Docker and Kubernetes manifests for local and cluster running.

#Why I wrote it

I had rebuilt the same first two weeks of a project three times in a year, repeating the same federation setup, the same tenant middleware and the same auth-to-billing wiring, and made slightly different decisions each time for no reason I could reconstruct.

That instinct is the same one that produced Forge six years later. The difference is that Ultimate Backend is a template you copy and diverge from, while Forge is a dependency you upgrade. I would make the second choice again.

#What came out of it

NestJS Event Store was extracted when people started asking for only the CQRS-and-EventStore part. NestJS Casbin and the Casbin MongoDB adapter came out of its authorization layer. The federation gateway module was deprecated once official federation support landed, which is the correct end for that kind of package.

04

Signals

GitHub
Stars
2,899
Language
TypeScript
Since
2019
Adopters
01