$ account TanStack
TanStack Query is a multi-framework, protocol-agnostic library for managing asynchronous server state in web applications. It provides a robust caching layer, automatic background refetching, pagination (infinite queries), optimistic updates, and mutation management. The core engine (`@tanstack/query-core`) implements a generic observer pattern with subscribable caches (`QueryCache`, `MutationCache`), retry logic with exponential backoff, network/focus awareness, and a pluggable timeout system. Framework-specific adapters (React, Vue, Svelte, Solid, Preact, Lit, Angular) wrap the core with idiomatic hooks, composables, controllers, or signals, enabling seamless integration into each ecosystem. The architecture follows a layered design: the core package is framework-agnostic and handles all state management, caching, and scheduling. Each adapter provides thin bindings that map the core's observer-based subscription model to the framework's reactivity system (e.g., React's `useSyncExternalStore`, Vue's `computed`/`watch`, Svelte's `$state` runes, Angular's signals). Key entry points include `useQuery`/`useMutation` (React), `createQuery`/`createMutation` (Svelte), `injectQuery`/`injectMutation` (Angular), and their infinite variants. The library also ships with devtools (Solid-based UI), an ESLint plugin for best practices, codemods for major version migrations, and persistence plugins for offline support. Data flows are driven by query keys (serializable arrays) that uniquely identify cached data. Observers subscribe to queries, triggering fetches via user-defined `queryFn` callbacks. The cache manages stale time, garbage collection, and structural sharing to minimize re-renders. Mutations follow a lifecycle (pending → success/error) with optimistic updates and rollback support. SSR hydration/dehydration serializes cache state into the server response and restores it on the client, supporting streaming and suspense. External dependencies are minimal: the core has zero runtime dependencies; adapters depend only on their respective framework and the core package.
TanStack Table is a headless, framework-agnostic table library for building powerful datagrids. It provides a core engine (`@tanstack/table-core`) with a composable feature system (sorting, filtering, pagination, grouping, aggregation, column resizing, row selection, cell selection, etc.) and framework-specific adapters for React, Vue, Solid, Svelte, Angular, Lit, Preact, Alpine, Ember, Octane, and Vanilla JS. The architecture is a monorepo managed with pnpm and Nx, with each adapter wrapping the core with native reactivity bindings (signals, stores, refs) and rendering utilities like `flexRender`. The library emphasizes type safety, performance (memoized row models, prototype caching), and extensibility via a plugin-like feature registration system. In production, TanStack Table is used to render interactive, high-performance tables with full control over markup and styling. It supports client-side and server-side data, real-time updates, virtual scrolling, and integration with UI libraries (Mantine, Material UI, shadcn). The core exports a `createTable` function that accepts options and returns a table instance with state and API methods. Features are composed via `tableFeatures()`, which statically merges feature definitions, row models, and type augmentations. Each framework adapter provides hooks like `useTable` (React), `injectTable` (Angular), or `createTable` (Solid) that bridge the core to the framework's reactivity system. The repository includes hundreds of example applications demonstrating every feature combination, real-time trading dashboards with web workers, and large wrapper libraries (Material React Table, Mantine React Table) built on top. Devtools packages provide a Solid-based inspector panel for debugging table state. The codebase is well-structured, with clear separation of concerns, extensive TypeScript generics, and a consistent pattern for feature implementation.