{"id":16446590,"url":"https://github.com/tshemsedinov/patterns-javascript","last_synced_at":"2025-04-05T08:03:45.821Z","repository":{"id":248610608,"uuid":"829189941","full_name":"tshemsedinov/Patterns-JavaScript","owner":"tshemsedinov","description":"Patterns for JavaScript, Node.js, and TypeScript","archived":false,"fork":false,"pushed_at":"2025-03-27T15:06:38.000Z","size":60,"stargazers_count":156,"open_issues_count":0,"forks_count":19,"subscribers_count":15,"default_branch":"en","last_synced_at":"2025-03-29T07:02:47.546Z","etag":null,"topics":["backend","design-patterns","di","frontend","gof","grasp","ioc","nodejs","patterns","solid"],"latest_commit_sha":null,"homepage":"https://youtube.com/@TimurShemsedinov","language":null,"has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tshemsedinov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-16T00:12:52.000Z","updated_at":"2025-03-28T10:49:55.000Z","dependencies_parsed_at":"2025-03-14T10:30:28.690Z","dependency_job_id":null,"html_url":"https://github.com/tshemsedinov/Patterns-JavaScript","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"5d38eea89fe9596b4b5c9395eb146f3a06a1ff44"},"previous_names":["tshemsedinov/patterns-javascript"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tshemsedinov%2FPatterns-JavaScript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tshemsedinov%2FPatterns-JavaScript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tshemsedinov%2FPatterns-JavaScript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tshemsedinov%2FPatterns-JavaScript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tshemsedinov","download_url":"https://codeload.github.com/tshemsedinov/Patterns-JavaScript/tar.gz/refs/heads/en","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247305930,"owners_count":20917207,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","design-patterns","di","frontend","gof","grasp","ioc","nodejs","patterns","solid"],"created_at":"2024-10-11T09:48:10.879Z","updated_at":"2025-04-05T08:03:45.813Z","avatar_url":"https://github.com/tshemsedinov.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧩 Patterns for JavaScript, TypeScript, Node.js\n\n\u003e Rethinking GRASP (General Responsibility Assignment Software Patterns), SOLID (Single responsibility, Open–closed, Liskov substitution, Interface segregation, Dependency inversion), GoF (Gang of Four) patterns, for Frontend (browsers) \u0026 Backend (node.js, other runtimes) development with JavaScript and TypeScript\n\nTranslations:\n[EN](https://github.com/tshemsedinov/Patterns-JavaScript/tree/en),\n[UA](https://github.com/tshemsedinov/Patterns-JavaScript/tree/ua),\n[RU](https://github.com/tshemsedinov/Patterns-JavaScript/tree/ru).\n\n- 🧩 Patterns\n  - 📢 [GoF patterns for Node.js and JavaScript (seminar fragment)](https://youtu.be/7TjzsZCQQqg)\n  - 🏭 Creational patterns\n    - [Abstract factory](https://github.com/HowProgrammingWorks/AbstractFactory) — creates related objects belonging to one family without specifying their concrete classes, e.g., UI components for different platforms.\n    - [Builder](https://github.com/HowProgrammingWorks/Builder) — step-by-step assembly of a complex configurable object, often using chaining, e.g., Query Builder or Form Generator.\n    - [Factory](https://github.com/HowProgrammingWorks/Factory) — function or method that creates objects using different techniques: assembling from literals and methods, mixins, setPrototypeOf.\n    - [Factory Method](https://github.com/HowProgrammingWorks/FactoryMethod) — chooses the correct abstraction to create an instance; in JavaScript, this can be implemented using `if`, `switch`, or selection from a collection (dictionary).\n    - [Prototype](https://github.com/HowProgrammingWorks/PrototypePattern) — creates objects by cloning a prepared instance to save resources (not to be confused with [Prototype-programming](https://github.com/HowProgrammingWorks/Prototype), which is closer to Flyweight).\n    - [Flyweight](https://github.com/HowProgrammingWorks/Flyweight) — saves memory allocation by sharing common state among multiple instances.\n    - [Singleton](https://github.com/HowProgrammingWorks/Singleton) — provides global access to a single instance; often considered an anti-pattern, easiest implemented via ESM/CJS module caching exported refs.\n    - [Object Pool](https://github.com/HowProgrammingWorks/Pool) — reuses pre-created objects to save resources during frequent creation and destruction.\n  - 🤝 Structural patterns\n    - [Adapter](https://github.com/HowProgrammingWorks/Adapter) — converts an incompatible interface into a compatible one, enabling third-party component usage without altering its code; can even transform a function contract into an object or vice versa.\n    - [Wrapper](https://github.com/HowProgrammingWorks/Wrapper) — function wrapper that delegates calls and adds behavior; a specialized case of Adapter.\n    - Boxing — wraps primitives into object types to add methods or unify interfaces, e.g., narrowing `String` to `AddressString`.\n    - Decorator \n    - [Decorator](https://github.com/HowProgrammingWorks/Decorator) — dynamically extends behavior without inheritance, typically via composition and declarative syntax, effectively adding metadata.\n    - [Proxy](https://github.com/HowProgrammingWorks/Proxy) — controls access to an object by intercepting calls, reads, and writes; useful for lazy initialization, caching, and security; can be implemented via GoF or native JavaScript Proxy.\n    - [Bridge](https://github.com/HowProgrammingWorks/Bridge) — separates two or more abstraction hierarchies via composition or aggregation, allowing them to evolve independently.\n    - [Composite](https://github.com/HowProgrammingWorks/Composite) — implements a common interface to uniformly handle individual objects and their tree structures, e.g., DOM or file systems.\n    - [Facade](https://github.com/HowProgrammingWorks/Facade) — simplifies access to a complex system, providing a unified and clear interface, hiding and protecting internal complexity.\n    - [Flyweight](https://github.com/HowProgrammingWorks/Flyweight) — saves memory allocation by sharing common state among multiple instances.\n    - Active Record — domain object encapsulating a database record, providing methods to directly perform CRUD operations (create, read, update, delete) and domain-specific queries on itself.\n    - Data access object (DAO) — abstraction defining an interface to persist and retrieve domain objects, isolating domain logic from specific storage implementations.\n    - Data transfer object (DTO) — an anemic object (just plain data) carrier without domain behavior, designed explicitly for transferring structured data across application boundaries, layers, modules, or subsystems.\n    - Data Access Layer (DAL) — a layer abstracting access to multiple DAOs or raw data sources. Can be represented as Facade pattern. Often includes transformations.\n    - Repository — domain-centric abstraction for data access that returns domain entities, not raw data or DTOs.\n  - ⚡ Behavioral patterns\n    - [Chain of Responsibility](https://github.com/HowProgrammingWorks/ChainOfResponsibility) — passes control through a chain of handlers, selecting a responsible one; all handlers can read, but only one will modify.\n    - [Middleware](https://www.youtube.com/watch?v=RS8x73z4csI) — handler chain similar to CoR, but each can modify state and pass control to the next one, potentially leading to race conditions and conflicts.\n    - [Command](https://github.com/HowProgrammingWorks/Command) — encapsulates an action (execution request) and parameters into an object, allowing queuing, cancellation, repetition, etc.\n    - [Interpreter](https://github.com/HowProgrammingWorks/Interpreter) — implements a DSL language (Domain Specific Language) or parses expressions into AST (Abstract Syntax Tree) for interpretation.\n    - [Iterator](https://github.com/HowProgrammingWorks/Iterator) — sequentially traverses collections or streams element-by-element without exposing all data; JavaScript provides built-in Iterator and AsyncIterator.\n    - [Mediator](https://github.com/HowProgrammingWorks/Mediator) — optimizes communication between N components, centralizing interaction to reduce coupling from `N*(N-1)/2` down to `N`.\n    - [Memento](https://github.com/HowProgrammingWorks/Memento) — saves and restores snapshots of an object's state without direct access to its internal state.\n    - [Observable](https://github.com/HowProgrammingWorks/Observer) — notifies subscribers about changes to an object's state via Events:\n      - [EventEmitter](https://github.com/HowProgrammingWorks/EventEmitter) for Node.js: Observable + listener\n      - [EventTarget](https://github.com/HowProgrammingWorks/Events) for Web API: EventTarget + Event (CustomEvent) + listener\n      - [Signals](https://github.com/HowProgrammingWorks/Signals)\n    - [State](https://github.com/HowProgrammingWorks/State) — implements a Finite State Machine (FSM) where methods represent transitions, and state is composed into abstraction and switched during transitions.\n    - [Strategy](https://github.com/HowProgrammingWorks/Strategy) — selects interchangeable behavior at runtime from a collection of implementations: functions, objects, or classes\n    - [Template method](https://github.com/HowProgrammingWorks/TemplateMethod) — defines algorithm steps, allowing subclasses to override individual steps while defaulting to the superclass behavior.\n    - [Visitor](https://github.com/HowProgrammingWorks/Visitor) — adds operations to objects without altering their classes, separating structure and behavior into distinct abstractions.\n    - [Revealing Constructor](https://github.com/HowProgrammingWorks/RevealingConstructor) — changes behavior without inheritance, injecting functionality into constructors via functions or objects describing the behavior.\n    - [Actor](https://github.com/HowProgrammingWorks/Actor) – Encapsulates state and behavior, communicating asynchronously via message passing and processing messages in a queue. Ensures thread-safe and async-safe concurrent operations by isolating actor state.\n    - [Reactor (event-loop)](https://github.com/HowProgrammingWorks/Reactor) - Handles concurrent events synchronously by adding them to queue and dispatching them to registered handlers. Implements event-driven async processing on the top of the sync one; commonly used in I/O-bound systems.\n    - [Proactor](https://github.com/HowProgrammingWorks/Proactor) - Event loop where operations started by user-land code but completed by an external agent (for example I/O subsystem), which then triggers a completion handler when the operation finishes (returning data to callback).\n    - Service Locator — \n- 🧩 GRASP patterns\n  - 📢 Intro video\n    - [GRASP Overview](https://youtu.be/ExauFjYV_lQ)\n    - Part 1 - [GRASP for Node.js and Javascript](https://youtu.be/vm8p4jIQwp4)\n    - Part 2 - coming soon\n  - [Information expert](https://youtu.be/cCHL329_As0)\n  - Creator\n  - Controller\n  - Indirection\n  - [Low coupling](https://youtu.be/IGXdPOZ3Fyk)\n  - [High cohesion](https://youtu.be/IGXdPOZ3Fyk)\n  - Polymorphism\n  - Protected variations\n  - [Pure fabrication](https://youtu.be/CV577a0RHBM)\n  - [Real code examples](https://youtu.be/4AMVQ2-2DcM)\n- 🧩 SOLID Patterns\n  - 📢 Intro video: [SOLID for Node.js and Javascript](https://youtu.be/B2guSV8EMn0)\n  - [SOLID Interview questions](https://youtu.be/-9OM6-6pZw8)\n  - [Single responsibility principle](https://youtu.be/o4bQywkBKOI)\n  - [Open/closed principle](https://github.com/HowProgrammingWorks/OpenClosed)\n  - [Liskov substitution principle](https://youtu.be/RbhYxygxroc)\n  - [Interface segregation principle](https://github.com/HowProgrammingWorks/InterfaceSegregation)\n  - [Dependency inversion principle](https://github.com/HowProgrammingWorks/DependencyInversion)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftshemsedinov%2Fpatterns-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftshemsedinov%2Fpatterns-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftshemsedinov%2Fpatterns-javascript/lists"}