Lens / Scrolloop Sentry

Overview

What it is

Scrolloop Sentry (repository my-auth) is a multi-tenant identity platform I designed and built end to end. It covers password, magic-link, social and passkey sign-in; TOTP, WebAuthn, email-code and backup-code MFA; an OAuth 2.0 and OpenID Connect provider; IAM-style authorization; and enterprise federation through SAML, SCIM and LDAP. A Next.js admin console and hosted login pages sit on top of one NestJS API.

It is self-hostable (Docker Compose for local, Helm planned) and designed to run as a SaaS at sentry.scrolloop.com. It follows an earlier NestJS starter and an @rsxt/auth package, rebuilt around schema-per-tenant isolation from the first commit.

Why I built it

Most products rebuild login, sessions, MFA and roles from scratch and get a subtle part wrong. Hosted providers such as Auth0 solve it but hide the internals. I wanted to own the whole problem and understand it: how a tenant is resolved before a request touches data, how signing keys rotate without breaking tokens, how a magic link survives email scanners and device-code phishing, and how enterprise directories connect without becoming an attack surface.

The goal was a platform an auditor could test: each security claim maps to a control, a place in the code and a test.

The shape of it

• auth-service: NestJS 11, TypeORM, PostgreSQL 16, Redis 7, BullMQ, Argon2id, AES-256-GCM, Pino. Roughly 38,000 lines of TypeScript excluding tests, 195 spec files, 35 entities and 39 migrations.

• admin-portal: Next.js 16 App Router, TanStack Query v5, Tailwind CSS v4 and shadcn/ui. Roughly 27,000 lines, serving platform operators, tenant admins and end users.

• @scrolloop/sdk: a roughly 3,400-line typed client for browser, React and Next.js that never touches the access token.

• A shared package set (database, security, emails with 24 React Email templates, ui, admin-client, config and types), a Fumadocs site with 30 pages, and 11 Playwright journeys that run against the real stack.

How I worked

• Decisions go into ADRs the moment they are made (seven so far), including options rejected and the follow-ups a security review forced.

• Gaps go into a remediation plan with acceptance criteria; every P0 item is closed and the remaining P1 and P2 items are tracked openly.

• A security pass against OWASP ASVS Level 2 on 2026-10-20 produced regression tests for every critical and high finding.

• Frontend work followed an audit and a Figma delivery plan (47 design families, 24 journeys) with one rule: never fake a backend contract.

Where it stands

Pre-1.0. Core flows are verified end to end in CI through typecheck, unit tests, a boot-and-smoke job and the Playwright journeys. Closed: signed SAML SSO, per-tenant signing keys with scheduled rotation, class-validated request bodies, cookie-only access tokens, S256-only PKCE, tenant-aware jobs, per-tenant CORS, link-first auth with step-up, and pre-session MFA enrolment.

Still open: connection handling under high concurrency, audit-log immutability and retention, verified database TLS by default, observability (traces and metrics), release engineering, and a handful of console areas that render Planned shells. The Roadmap section lists them.