Bazaar API

About the Project

Bazaar API is a production-style backend built to model the real mechanics of an online marketplace. It handles authentication, product management, carts, orders, and reviews while enforcing clear domain boundaries and role-based access.

The project focuses on translating business rules into clean, maintainable backend logic. Buyers, sellers, and admins each have defined capabilities, and every feature is backed by persistent data, validation, and authorization. The goal was not to build a demo API, but a backend that reflects how real commerce systems behave.

Bazaar API was also built to be extended. Its structure supports future features like moderation, search, payments, and media uploads without needing architectural rewrites.

How It Was Built

The API is built using Nest.js with a modular architecture that separates concerns by domain. Each feature area lives in its own module with controllers handling routing and services encapsulating business logic.

Prisma is used as the database layer, providing type-safe access to PostgreSQL and enforcing relational integrity across users, products, carts, orders, and reviews. DTOs and validation pipes ensure all incoming data is validated at the boundary.

Authentication is handled using JWTs, with guards applied at the route level to enforce access rules. Role-based authorization determines what actions buyers, sellers, and admins are allowed to perform.

The project supports local development with Docker and uses Prisma migrations to manage schema changes in a repeatable way.

Key Features

  • Role-based access for buyers, sellers, and admins
  • One persistent cart per user with server-side state
  • Order creation with item snapshots and total calculation
  • Review system restricted to verified purchases
  • Modular Nest.js architecture with clear domain boundaries
  • Type-safe database access with Prisma
  • DTO-based validation and guarded routes
  • Marketplace-ready data model supporting future expansion
TypeScriptNest.jsPrismaPostgreSQLDocker