A catalogue of design patterns used in the Granit frontend SDK, organized by category.
Each pattern documents the general concept, how it is implemented in the @granit/*
packages, and concrete code examples from the SDK.
| Pattern | Description |
|---|
| Factory | Hide instance creation complexity behind simple functions |
| Module Singleton | Cross-package state sharing via ES module cache |
| Pattern | Description |
|---|
| Adapter | Convert 3rd-party APIs into React-compatible interfaces |
| Pattern | Description |
|---|
| Interceptor | Transparent HTTP request/response pipeline processing |
| Strategy | Pluggable implementations behind a common interface |
| Observer | Event notification without direct coupling |
| Pattern | Description |
|---|
| Provider | Context-based dependency injection with typed hooks |
| Hook Composition | Layer framework + application logic via hook wrapping |