Hazem Azzam.

CASE STUDY — FULL STACKBookTomb

YEAR
2026 — Present
ROLE
Full Stack Developer & Product Owner
TEAM SIZE
1 person

Case study by Hazem Azzam

01 — OVERVIEW

What it is

A personal book library platform — a NestJS + Prisma backend built strictly on Clean Architecture, with an admin dashboard, Android app and website in progress.

02 — CHALLENGES

Key challenges

  1. 01Prisma 7's breaking changes: the prisma-client generator emits ESM by default, which crashes a CommonJS NestJS app — solved by pinning moduleFormat="cjs" and runtime="nodejs" and moving to a multi-file schema folder with one .prisma file per module.
  2. 02Prisma 7 requires an explicit driver adapter, so the Prisma service had to be rebuilt on @prisma/adapter-pg + pg rather than relying on the implicit engine connection.
  3. 03Making deduplication safe under concurrency without a distributed lock — the (sha256, uploaderId) unique index is the lock, and the insert conflict is itself the deduplication signal.
  4. 04Keeping the domain layer genuinely framework-free: no NestJS decorators, no Prisma types, no argon2 imports — forcing every dependency through ports and mappers at the infrastructure edge.
  5. 05Upstash exposes one Redis database over both REST and TCP; the health check uses REST while BullMQ needs TCP, so the REST token had to be documented as doubling as the TCP password.
  6. 06@nestjs/schedule shipped an ESM-only release that broke the CommonJS build — resolved by downgrading to the last CJS-compatible version.

03 — ACHIEVEMENTS

Key achievements

  1. 01Designed and shipped a strict Clean Architecture backend — four layers per module (domain / application / infrastructure / presentation) with ports modelled as abstract classes that double as DI tokens, and a composition root per module.
  2. 02Built JWT authentication with refresh-token rotation, token families and reuse detection: replaying a already-used refresh token invalidates the entire token family.
  3. 03Implemented an upload-intent flow with per-uploader content deduplication keyed on (sha256, uploaderId), using the database's unique constraint itself as the lock instead of an application-level mutex.
  4. 04Shipped a global rate-limiting policy (120 req/min) with tighter per-route caps for login, registration and upload-intent, exempting the health endpoint so uptime monitors are never throttled.
  5. 05Authored a complete documentation set — per-module READMEs, architecture/testing/documentation conventions, Docker and database operations guides, plus a learn-by-doing lesson series for the identity module.
  6. 06Wrote a 1,600-line hand-authored OpenAPI 3.0.3 specification as the single source of truth for the API, with inline examples per response and shared error envelopes — importable directly into Apidog.

04 — STACK

Technologies used

  • TypeScript
  • Jest
  • REST API design
  • OpenAPI
  • Clean Architecture
  • Node.js
  • PostgreSQL
  • NestJS
  • Prisma
  • JWT
  • Redis
  • Docker
  • Cloudflare R2