Skip to content

About

Design patterns and engineering best practices implemented in React + TypeScript — Singleton, Builder, Facade, custom hooks, SOLID principles

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Repository files navigation

Design Patterns & Engineering Best Practices

A reference repository demonstrating design patterns and software engineering principles implemented in React + TypeScript + Vite. Each pattern is accompanied by practical examples and clear explanations to help developers apply them in real-world frontend and JavaScript/TypeScript projects.

Tech Stack

  • React 18
  • TypeScript
  • Vite
  • ESLint + Prettier

Patterns & Principles Covered

Creational Patterns

  • Singleton — ensuring a class has only one instance
  • Builder — constructing complex objects step by step
  • Factory — creating objects without specifying the concrete class

Structural Patterns

  • Facade — providing a simplified interface to a complex subsystem

Behavioral Patterns / React Patterns

  • Custom Hooks — encapsulating reusable stateful logic
  • State Management Patterns — comparison of different approaches

SOLID Principles

  • Single Responsibility, Open/Closed, Liskov Substitution, Interface Segregation, Dependency Inversion — with code examples

Getting Started

# Clone the repository
git clone https://github.com/brasileirodev/design-patterns.git
cd design-patterns

# Install dependencies
npm install

# Run development server
npm run dev

Project Structure

src/
  patterns/
    creational/    # Singleton, Builder, Factory
    structural/    # Facade
    behavioral/    # Observer, Strategy
  react-patterns/
    custom-hooks/  # Reusable hooks examples
    state/         # State management comparisons

Why This Repository Matters

Understanding design patterns is a mark of software maturity. This repository demonstrates:

  • How to apply classical patterns in modern TypeScript
  • How to write maintainable, scalable React components
  • How SOLID principles translate into real frontend code
  • Practical custom hook patterns used in production React apps

Future Improvements

  • Add Observer pattern example
  • Add Strategy pattern for form validation
  • Add unit tests for each pattern
  • Add a deployed demo with Storybook

License

MIT

About

Design patterns and engineering best practices implemented in React + TypeScript — Singleton, Builder, Facade, custom hooks, SOLID principles

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages