Coffee Stock

A simple inventory ecosystem designed to showcase Clean Architecture, DDD, and Type-Safe development with Next.js 16.

Motivation & Study Goals

This project started as a deep dive into decoupled software design. The goal was to build a scalable React application where the business logic (Core) remains agnostic of the framework (Next.js) or database (Prisma/Postgres). It serves as a laboratory for implementing DDD principles, boundary separation, and Type-Safe development.

Clean Architecture Folders

  • 📂 src
  •   📂 app // Next.js App Router (UI/Framework)
  •     📂 actions // Type-safe Server Actions
  •   📂 core // THE BRAIN (Zero Dependencies)
  •     📂 domain // Entities, Aggregates (DDD)
  •     📂 ports // Interfaces / Contracts
  •     📂 use-cases // Pure Business Logic
  •   📂 infra // Repositories Impl & Factories
  •   📂 lib // Framework-specific Utils (Zod, Tailwind)
  •   📂 test // Testing Setup & Mocks
1

src/core: The heart. Agnostic to any database or UI framework. TypeScript at its purest form.

2

src/infra: Implementation details. Prisma, External Services, and Factories are mapped here.

3

src/lib: Cross-cutting concerns like Shadcn UI config, Zod schemas, and shared utilities.

Engineering Stack

Next.js 15

React 19, Turbopack, App Router

Prisma Postgres

Type-safe Database Management

Next-Auth (v5)

Secure Server-side Auth

Shadcn UI

Radix UI & Tailwind CSS

React Hook Form

Validated with Zod

Jest & RTL

Unit tests

i18n

Dynamic translations (next-intl)

Storybook

Component Isolation & Docs

CI/CD Pipeline

A robust automation workflow using GitHub Actions to ensure code stability and immutable deployments.

Setup & Cache

Initializes environment and caches pnpm store for ultra-fast builds.

Quality Assurance

Runs ESLint and Prettier check. Any code style violation breaks the build.

Automated Testing

Executes Jest suite. High coverage ensures DDD business rules remain intact.

Production Build

Validates Prisma schemas and Next.js compilation for a type-safe artifact.

Vercel Deployment

Pre-built strategy: what passes in the CI is exactly what goes to production.