Skip to main content

Car rental backend built for real production loads

Personal ProjectNestJSPostgreSQLTypeScriptVitest
Clean/screaming architecture — module → controller → service → repository

The Challenge

  • TypeScript monorepo discipline: Maintaining TypeScript strict across the whole monorepo with zero compilation errors
  • NestJS clean/screaming architecture layers: Strict separation between module, controller, service, and repository without cross-layer coupling
  • Type-safe queries with Drizzle ORM: Drizzle ORM + PostgreSQL for fully typed queries without an extra abstraction layer
  • JWT auth + Vitest test coverage: JWT authentication with NestJS guards and Vitest unit and integration tests

Solution Architecture

RouteCallDataValidateGuardUnitIntegrationFeature ModuleControllerServiceRepositoryDrizzle ORMPostgreSQLZod ValidationJWT AuthVitest Tests
System architecture diagram showing nodes and connections

Monorepo / TypeScript Strict

TypeScript monorepo with strict mode enabled across the entire project. Zero compilation errors as a non-negotiable requirement.

NestJS Clean Architecture

Separated layers: module (bounded context), controller (HTTP), service (use cases), repository (data access). No cross-layer coupling.

Drizzle + PostgreSQL + Zod

Drizzle ORM for type-safe SQL queries over PostgreSQL. Zod schemas shared across layers for consistent input validation.

JWT Auth + Vitest

NestJS guards for JWT authentication. Unit tests over services and integration tests over repositories with Vitest.

Results

0

TypeScript errors at compile time

100%

Shared Zod validation between layers

Unit + Integration

Test coverage strategy

Car Rental — TypeScript Monorepo + NestJS Clean Architecture | Joel May