DEV Community

Benoit Ruiz
Benoit Ruiz

Posted on


Hello and welcome!

After watching the talk "Domain Modeling Made Functional" from Scott Wlaschin, I got inspired to write a series of articles about Domain Driven Design (DDD for short) in TypeScript. This talk is about DDD using Functional Programming (FP), so I chose to use the fp-ts ecosystem because it's the most mature FP stack in TypeScript, as far as I know. Plus, I've already used fp-ts occasionally so I have some experience with it.

First, I'll introduce a simple domain (as a case study) and a naive type definition. I'll try to describe the flaws of this initial type, and I'll also share some concepts we'll use later to design a better model that fits the domain.

The objective is to define a type that lets us understand the domain constraints and logic without looking at the code implementation.

We are going to write both the type and the implementation. To do so, I'll present 2 solutions:

The code I'm sharing in these articles is available on the ruizb/domain-modeling-ts GitHub repository.

Alright, let's go!

Top comments (0)