Welcome to dldr
dldr is a lightweight, efficient utility for batching and caching operations. It automatically groups multiple requests for data within the same tick, reducing redundant operations and improving performance.dldr uses
queueMicrotask under the hood to intelligently batch requests made during the same event loop tick.Why dldr?
When building applications that fetch data, you often encounter the N+1 problem - making separate requests for related data that could be batched together. dldr solves this by:- Automatic Batching - Groups requests made in the same tick
- Deduplication - Ensures each unique key is only fetched once
- Optional Caching - Cache results across ticks for even better performance
- Tiny Footprint - Minimal overhead with maximum impact
- Framework Agnostic - Works with any JavaScript/TypeScript project
Quick Example
Get Started
Installation
Install dldr via npm or JSR in seconds
Quick Start
Get up and running with a working example
Caching
Learn how to cache results across ticks
API Reference
Explore the complete API documentation
Key Features
Batching
Automatically batches requests within the same microtask tick
Deduplication
Prevents duplicate requests for the same key
Caching
Optional caching module for persistent results
Type Safe
Full TypeScript support with complete type inference
Zero Config
Works out of the box with sensible defaults
Flexible
Supports custom identity functions and cache implementations