Skip to content

Frontend Pattern Library

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.

PatternDescription
FactoryHide instance creation complexity behind simple functions
Module SingletonCross-package state sharing via ES module cache
PatternDescription
AdapterConvert 3rd-party APIs into React-compatible interfaces
PatternDescription
InterceptorTransparent HTTP request/response pipeline processing
StrategyPluggable implementations behind a common interface
ObserverEvent notification without direct coupling
PatternDescription
ProviderContext-based dependency injection with typed hooks
Hook CompositionLayer framework + application logic via hook wrapping