Skip to content

Pattern Catalog

Browse patterns by category or framework scope. Each pattern is a complete, copy-pasteable solution.


By Framework Scope

Framework-Agnostic

These patterns work in any JavaScript/TypeScript project — vanilla, React, Vue, Node.js. No framework lock-in.

PatternDescriptionLibraries
Common SnippetsOne-liners: cn(), localStorage TTL, password validation, isDistinct, clipboard, download helpersNone (or lodash)
API Client — Coreky instance with retry logic, error normalization, and production-safe messagingky
ObservabilityLazy-loaded error tracking with pluggable backends (Sentry, custom API, console)Optional @sentry/react

React

These require React. Most work with any React setup — no UI library required.

PatternDescriptionLibraries
Theme SystemDark / light / system theme with CSS class injection and localStorage persistenceReact, Tailwind
Provider CompositionCompose global React providers at the app root without nesting hellReact
Auth FlowComplete auth: Zustand store (4 storage modes), token refresh, API injectionReact, Zustand, ky
Route GuardsProtect private routes, redirect unauthenticated users, preserve redirect targetTanStack Router
Rate-Limited LoginClient-side exponential backoff for auth formsReact, react-hook-form
Entity CRUDFeature-based folder structure: list + sheet/drawer + mutations + cache invalidationTanStack Query, react-hook-form, zod
Error Boundary SystemCatch React errors + uncaught runtime errors, auto-reload on chunk-load failuresreact-error-boundary
Page State ManagementSync page title and breadcrumbs from deep components up to the root layout headerZustand
Accessible AnimationFramer Motion primitives that respect prefers-reduced-motionFramer Motion
Multi-Layer TestingUnit tests (Node) + browser tests (Chromium) + E2E with store reset utilitiesVitest, Playwright

Ant Design

These are tightly coupled to Ant Design components and patterns.

PatternDescriptionLibraries
Table with Synced PaginationTable with URL-synced pagination, filter tags, and Excel exportAnt Design, lodash, xlsx
Responsive Form GridDeclarative form layout with responsive columns and conditional field visibilityAnt Design
File Upload PipelineUpload wrapped for form usage with size validationAnt Design
Dashboard LayoutApplication shell with sidebar/navbar variantsAnt Design, Zustand

By Domain

Getting Started

PatternScopeDescription
Common SnippetsFramework-agnosticOne-liners and micro-patterns
Theme SystemReactDark / light / system theme
Provider CompositionReactCompose global providers cleanly

Authentication

PatternScopeDescription
Auth FlowReactComplete auth stack with 4 storage modes
Route GuardsReactProtect private routes
Rate-Limited LoginReactExponential backoff for auth forms

Data Fetching

PatternScopeDescription
API ClientFramework-agnosticky with retry, auth, and error normalization
Entity CRUDReactFeature-based CRUD with sheets and mutations

Tables & Lists

PatternScopeDescription
Table with Synced PaginationAnt DesignURL-synced pagination and Excel export

Forms

PatternScopeDescription
Responsive Form GridAnt DesignDeclarative responsive form layout
File Upload PipelineAnt DesignUpload with size validation for forms

Layout

PatternScopeDescription
Dashboard LayoutAnt DesignSidebar and navbar shell variants
Page State ManagementReactSync title and breadcrumbs to root layout

Error Handling

PatternScopeDescription
Error Boundary SystemReactCatch errors, auto-reload on chunk-load
ObservabilityFramework-agnosticLazy-loaded error tracking

Animation

PatternScopeDescription
Accessible AnimationReactFramer Motion with reduced-motion support

Testing

PatternScopeDescription
Multi-Layer TestingReactUnit + browser + E2E testing strategy

How to Use a Pattern

  1. Pick by scope — Are you using Ant Design? Start with the Ant Design section. Building from scratch? Check Framework-Agnostic or React.
  2. Read the pattern page — Understand the problem it solves and what libraries it requires.
  3. Copy the files into your project (we recommend src/lib/patterns/<name>/).
  4. Wire them up following the "Usage" section.
  5. Adapt as needed — the code is yours.

Contributing a Pattern

See the homepage for instructions on adding new patterns.