functional-ts

Installation
SKILL.md

Functional Domain Modeling in TypeScript

Principles for writing domain models in server-side TypeScript. Instead of class-based OOP, this approach maximizes the TypeScript type system through a functional style.

1. Type-Driven Domain Modeling

Represent states with discriminated unions using kind as the unified discriminant. Use type (not interface), companion objects, branded types, Readonly<>, function property notation, and one-concept-per-file structure.

Validation library detection: Check dependencies / devDependencies in the project's package.json for branded type syntax:

Details: domain-modeling.md

2. State Transitions via Functions

Express state transitions with pure functions. The argument type constrains valid source states, and the return type makes the target state explicit. Invalid transitions become compile errors. Use assertNever for exhaustiveness checking.

Installs
17
GitHub Stars
42
First Seen
Apr 7, 2026
functional-ts — iwasa-kosui/functional-ts-principles