Turn FeedPulse from a single-deployment application into a genuine multi-tenant
SaaS.
Approach
Use nestjs-tenant-rls-auth, which already exists and was extracted from a real
production SaaS: PostgreSQL Row-Level Security, JWT with refresh token rotation,
and AsyncLocalStorage-based tenant context.
This is deliberately not built from scratch. The library is the proven part.
Scope
Definition of done
A test that fails loudly if tenant A can ever observe tenant B's data, through
the API or through a queued job.
Turn FeedPulse from a single-deployment application into a genuine multi-tenant
SaaS.
Approach
Use
nestjs-tenant-rls-auth, which already exists and was extracted from a realproduction SaaS: PostgreSQL Row-Level Security, JWT with refresh token rotation,
and
AsyncLocalStorage-based tenant context.This is deliberately not built from scratch. The library is the proven part.
Scope
apiruntimetenant_idto every domain table, with RLS policies enforcing isolationworkerruns outside the HTTP request lifecycle, soAsyncLocalStoragedoes not carry across. The tenant must travel in the job payload and be
re-established before any database access
via the worker path
Definition of done
A test that fails loudly if tenant A can ever observe tenant B's data, through
the API or through a queued job.