2.0.2 • Published 10 months ago

@synet/patterns v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

@synet/patterns

Pattern Recognition.

Code is just a series of altered patterns. The programmer creates the pattern and makes us anticipate a resolution... then holds back. Makes you wait for it.

There's patterns in everything and everyone.

Patterns

Welcome! 👋

I’m 0en, and this is my personal collection of software patterns. Battle-tested, refined, and unified across all my projects and Synet.

Why?

We all use patterns. I used them everywhere: in products, libraries, and experiments. But over time, I realized that patterns, when reused and evolved in isolation, become incompatible. This leads to inconsistencies, cognitive load, and subtle bugs. I found myself importing the same pattern from different libraries, each with its own quirks, instead of using a single, consistent, and well-tested implementation.

So I built Patterns.

This library unites all my products and libraries under one set of stable, maintained, and carefully crafted patterns. I use these patterns myself, and I maintain them with care. Use them! They’re hihly stable, consistent, and designed to make your codebase better.


Base Patterns

Each pattern has its own documentation and examples.blob/main/docs: /blob/main/docs/<pattern>.md

  • Result Represent the outcome of operations that might fail, with a simple, type-safe API Read more
  • Value Object Immutable objects defined by their property values, not identity Read more
  • Mapper Transform between domain and infrastructure models, keeping your domain logic clean Read more
  • Guard Type-safe validation helpers for strings, numbers, arrays, objects, and dates Read more
  • UniqueId Type-safe, immutable unique identifiers (UUID v4 by default) Read more
  • Mediator Decouple request/response logic with a central dispatcher Read more
  • Specification Encapsulate and compose business rules and queries TBD
  • Observer & EventEmitter Event-driven architecture, decoupling components with observer/subject and event emitter patterns Read more | EventEmitter

Realtime Patterns

Unified abstractions for realtime communication (Supabase, WebSocket, GUN, etc). read more

Client Side

Realtime Service - Consumer pattern Realtime Provider & Channel - Patterns for implementing provider and channel for client consumption with examples.


Contributing

I maintain these patterns for my own projects, but PRs and issues are welcome! If you find a bug or want to suggest an improvement or new pattenr, open an issue or pull request.

2.0.2

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

1.1.7

10 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago