RefactoringGuru/design-patterns-typescript

Design Pattern Examples in TypeScript

TypeScript

1,461

130 commits

updated Apr 15, 2026

See the code

README

Design Patterns in TypeScript

This repository is part of the Refactoring.Guru project.

It contains TypeScript examples for all classic GoF design patterns. Each pattern includes two examples:

  • Conceptual examples show the internal structure of patterns, including detailed comments.

  • RealWorld examples show how patterns can be used in real-world web applications.

Requirements

For simplicity reasons, the examples are console apps. In order to launch them, you have to install Node.js and NPM on your computer and then install TypeScript compiler and TypeScript Node extension like this:

npm install -g typescript
npm install -g ts-node

When you have all the required software installed, the examples can be launched via the command line as follows:

ts-node src/Path-to-example/Example.ts

For the best experience, I recommend working with examples with these IDEs:

Contributor's Guide

I appreciate any help, whether it's a simple fix of a typo or a whole new example. Please read the Contributor's Guide to get more information.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Creative Commons License

Credits

Authors: Alexey Pyltsyn (@lex111) and Alexander Shvets (@neochief)

Contributors: See the list of contributors

design-patterns
typescript

RefactoringGuru/design-patterns-typescript

Design Pattern Examples in TypeScript

TypeScript

1,461

130 commits

updated Apr 15, 2026

See the code

README

Design Patterns in TypeScript

This repository is part of the Refactoring.Guru project.

It contains TypeScript examples for all classic GoF design patterns. Each pattern includes two examples:

  • Conceptual examples show the internal structure of patterns, including detailed comments.

  • RealWorld examples show how patterns can be used in real-world web applications.

Requirements

For simplicity reasons, the examples are console apps. In order to launch them, you have to install Node.js and NPM on your computer and then install TypeScript compiler and TypeScript Node extension like this:

npm install -g typescript
npm install -g ts-node

When you have all the required software installed, the examples can be launched via the command line as follows:

ts-node src/Path-to-example/Example.ts

For the best experience, I recommend working with examples with these IDEs:

Contributor's Guide

I appreciate any help, whether it's a simple fix of a typo or a whole new example. Please read the Contributor's Guide to get more information.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Creative Commons License

Credits

Authors: Alexey Pyltsyn (@lex111) and Alexander Shvets (@neochief)

Contributors: See the list of contributors

design-patterns
typescript

Significant stargazers

Junwoo Ji

314 followers · starred Feb 2021

YeonJuan

306 followers · starred Aug 2020

xiaoyang-sde

348 followers · starred Aug 2021

KooshaPari

18 followers · starred Mar 2026