Backend Development
Open Source

MangaSokağı: Type-Safe NestJS & Prisma Backend Architecture

TypeScriptSQLNestJSPrisma ORMPostgreSQLDockerJWTREST APIJest

A modular NestJS REST API engineered on strict dependency injection (DI) and end-to-end type safety, serving as the core transaction engine for the MangaSokağı e-commerce platform.

Tech Stack

TypeScriptSQLNestJSPrisma ORMPostgreSQLDockerJWTREST APIJest

System Metrics

Optimized memory allocation achieved by leveraging NestJS's Dependency Injection (DI) to manage service instances as Singletons
Advanced database connection pooling and query batching managed directly by the Rust-based Prisma Query Engine
High-throughput network I/O sustained by offloading heavy business logic into isolated, asynchronous Service layers

Why Did I Build This?

"Standard Node.js/Express backends inherently lack architectural discipline and are highly prone to spaghetti code in complex e-commerce domains due to loose typing. To handle MangaSokağı's transaction volume and data integrity, I needed to establish an enterprise-grade API layer that strictly decouples controllers from business logic while enforcing rigorous compile-time type checking."

Architecture & Decisions

The system is built upon NestJS's modular architecture, distinctly isolating domains (`admin`, `auth`, `category`, `manga`, `user`). The security layer is enforced via `auth.guard.ts`, a JWT-driven Role-Based Access Control (RBAC) mechanism that intercepts requests at the lifecycle's edge. Database connectivity is managed exclusively through a globally injected `prisma.service.ts`. By leveraging Prisma's auto-generated client (`generated/prisma`), the architecture guarantees absolute end-to-end type safety from the database schema up to the HTTP response payload. The entire runtime is encapsulated using Docker for deterministic deployment isolation.

Key Features

  • 01.Strict architectural decoupling of Controller and Business Logic layers (Separation of Concerns)
  • 02.Endpoint-level JWT authorization enforced by custom execution context interceptors (`auth.guard.ts`)
  • 03.Compile-time error catching and memory-safe database queries via Prisma ORM's auto-generated client
  • 04.Deterministic database seeding module for automated environment initialization and CI/CD pipelines
  • 05.Optimized Docker containerization for highly portable and scalable microservice deployments
This project demonstrates an enterprise-grade backend architecture tailored for robust e-commerce platforms. Security countermeasures like the AuthGuard act as low-level interceptors, aggressively dropping unauthorized payloads before they consume controller-level memory allocation. Furthermore, the Prisma-generated client entirely eliminates human error in Data Transfer Objects (DTOs), functioning as an immutable contract that prevents backend schema refactors from silently breaking frontend components.