Case study 06Back to work

Backend engineering · Security · TypeScript

Identity,
under pressure.

A production oriented authentication service built around the failure paths that simple login demos omit: stolen tokens, replay, brute force, recovery, revocation and auditability.
Tests passing
136
API endpoints
25
Security layers
14
Runtime
Node 20
System thesis

Login is a security workflow, not a form.

A convincing identity service must survive hostile state changes. A password can be guessed. A refresh token can be copied. A reset link can be abused. A valid user can request an operation their role should not allow.

This project makes those boundaries explicit in the architecture and verifies them with unit, integration and end to end tests.

Request path

Four boundaries before trust.

  1. 01Identity

    Password, Google or GitHub OAuth, then TOTP MFA when enabled.

  2. 02Policy

    Zod validation, rate limits, lockout and role checks reject unsafe requests.

  3. 03Session

    Short lived RS256 access tokens pair with rotating refresh token families.

  4. 04Evidence

    Audit events, request IDs, metrics and health checks preserve operational context.

Threat model

Controls mapped to failure modes.

Security claims are presented as concrete mechanisms, not generic feature labels.

01

Credential attack

Argon2id hashing, account lockout and Redis backed sliding window rate limits.

02

Token theft

RS256 access tokens, refresh token rotation, token families and reuse detection.

03

Session abuse

Device level session visibility, revocation, blacklist checks and forced global logout.

04

Privilege misuse

Role based guards, validated request boundaries and structured security audit events.

05

Recovery failure

Single use reset tokens, expiry, secure delivery and session invalidation after reset.

06

Invisible operations

Request IDs, Pino logs, Prometheus metrics, health checks and Grafana dashboards.

Implementation

Typed at every important boundary.

RuntimeNode.js · Express · TypeScript strict mode
StatePostgreSQL · Prisma · Redis
IdentityRS256 JWT · Argon2id · TOTP · Passport
OperationsDocker · Pino · Prometheus · Grafana
TestingJest · Supertest · unit, integration and E2E
ValidationZod schemas · typed error envelopes
Evidence

What the implementation demonstrates.

01RepeatabilityDocker Compose brings up the API, PostgreSQL, Redis, Prometheus and Grafana as one environment.

02Boundary coverageThe test suite covers successful flows and failure paths across authentication, MFA, OAuth, sessions and administration.

03Operational visibilityHealth endpoints, structured logs and metrics expose state that would otherwise remain hidden.

04Known limitThis is a portfolio implementation, not a third party audited identity provider. Production use would still require independent review, load testing and deployment specific hardening.

Engineering case study

Review the architecture, controls and evidence.

The public case study records the system boundaries and known limits without linking to an unpublished repository.

Return to selected work