Skip to main content

@hex-di ecosystem

Query

Type-Safe Data Querying for TypeScript

Get Started
npm install @hex-di/query

:: features

Why Query?

Declarative Queries

Define what data you need, not how to fetch it. The query layer handles caching and deduplication.

Cache Management

Automatic cache invalidation, optimistic updates, and stale-while-revalidate patterns.

Pagination

Cursor-based and offset pagination with type-safe page tokens.

Port-Based

Queries are ports. Swap implementations between REST, GraphQL, or in-memory for testing.

React Integration

useQuery and useMutation hooks that resolve from your DI graph.

Deduplication

Identical in-flight queries are merged. No duplicate network requests.

:: ecosystem

Part of the HexDI Stack

Query integrates seamlessly with the HexDI dependency injection ecosystem. Use it standalone or compose it with other libraries.

Explore HexDI