This repository provides an example of how to build a server-side application using TypeScript, following Domain-Driven Design (DDD) principles combined with a functional programming approach.
The project follows a package-by-feature architecture, where each feature encapsulates its own domain, DTOs, controllers, and handlers. Currently, the repository includes the Users module as a reference implementation.
- TypeScript β static typing for safer, predictable development
- Domain-Driven Design (DDD) β clear domain boundaries and domain-focused code organization
- Functional Programming β pure functions, immutability, and explicit data transformations
- Package-by-Feature Architecture β features grouped by domain instead of technical layers
The project structure is organized by domain feature. Here is the current structure based on the Users module:
src/
βββ Modules/
βββ SeedWork/
β βββ ...shared domain utilities, base types
β
βββ Users/
βββ Controllers/
β βββ ...HTTP controllers for user routes
β
βββ Domain/
β βββ ...entities, value objects, Derivers, Invariants
β
βββ DTOs/
β βββ ...data transfer objects used across use cases and controllers
β
βββ Handlers/
βββ ...application handlers
This layout isolates each moduleβs responsibilities while keeping domain logic separate from HTTP and application-level code.
npm install
# or
yarn installDevelopment:
npm run devnpm testThis repository aims to demonstrate:
- Practical application of DDD in TypeScript
- How functional programming helps reduce side effects and increase predictability
- How to structure server-side applications using package-by-feature
- A complete reference of a feature module (Users)