DEV Community

Benoit Ruiz
Benoit Ruiz

Posted on

15 3

Introduction

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!

Postgres on Neon - Get the Free Plan

No credit card required. The database you love, on a serverless platform designed to help you build faster.

Get Postgres on Neon

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay