Skip to content

This repository provides an example of how to build a server-side application using TypeScript and DDD, following a functional programming approach.

Notifications You must be signed in to change notification settings

oliverigor27/FP-DomainDrivenDesign

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“¦ Server-Side Application Example β€” TypeScript + DDD + Functional Programming

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.


πŸš€ Technologies & Concepts Used

  • 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

🧱 Project Structure

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.


πŸ“₯ Installation

npm install
# or
yarn install

▢️ Running the Application

Development:

npm run dev

πŸ§ͺ Testing

npm test

🎯 Purpose of This Example

This 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)

About

This repository provides an example of how to build a server-side application using TypeScript and DDD, following a functional programming approach.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published