Overview
eridu-tech is a modular, adapter-first TypeScript library for building
production-ready backend applications. Every component ships with in-memory
adapters for fast, deterministic testing — and pluggable adapters to swap in
real infrastructure without touching your
business logic.
Here is an index of every component, grouped by responsibility.
Foundation
The building blocks that power the rest of the ecosystem.
- Middleware and AOP — Composable middleware pipeline with before/after hooks and error handling — the foundation for every component's plugin system.
- Collection — Type-safe collection utilities with powerful query, transform, and pagination primitives.
- Serde — Serialize and deserialize data with a built-in SuperJSON adapter (Date, Map, Set, BigInt) and custom serializers — the backbone for all data interchange across the ecosystem.
- Codec — Encode and decode data with a unified, type-safe interface — includes a built-in Base64 codec and lets you build custom codecs for any protocol.
- Execution Context — Type-safe, composable context propagation for request IDs, user info, and tracing metadata across async boundaries — without thread-local hacks.
- Typed Config Access — Standardized type-safe access to domain configuration variables — with optional schema validation and full TypeScript inference.
- Typed Env Access — Type-safe environment
variable access from multiple sync/async sources with parsing, defaults, and
validation — never read
process.envraw again.
Storage
Persist and retrieve data behind a single, portable API.
- Cache — Caching with pluggable stores (in-memory, Redis, etc.), TTL policies, and stampede protection.
- File Storage — Abstract file storage with adapters for local disk, S3-compatible, and other backends — upload, stream, and serve with one API.
Reliability
Keep your services available and responsive under load and failure.
- Circuit Breaker — Prevent cascading failures with configurable thresholds, half-open recovery, and custom fallback strategies.
- Rate Limiter — Throttle request rates with configurable limits, sliding windows, and pluggable backends — protect your services from overload.
- Resilience — Timeout, fallback, and retry, with configurable policies and backoffs.
Concurrency
Coordinate access to shared resources across processes and machines.
- Lock — Distributed lock primitives with lease management, blocking and non-blocking acquisition, and automatic release.
- Shared Lock — Read-write distributed locks for coordinating concurrent access with shared and exclusive modes.
- Semaphore — Rate-limit concurrent access to shared resources with dynamic permit allocation.
Messaging
Decouple your services with reliable, asynchronous communication.
- Event Bus — Pub/sub event bus for dispatching and listening to events with pluggable transport backends — independent of underlying technology.
Web
Serve HTTP and build framework-agnostic APIs.
- HTTP Router — Framework-agnostic HTTP router built on the Hono router engine — implements the Winter TC fetch standard with middleware chains and typed path parameters.
Utilities
Small, focused helpers shared across the ecosystem.
- Backoff policies — Predefined constant and exponential backoff policies with jitter support for controlling retry and resilience delays.
- FileSize — An easy way to define, manipulate, and compare file sizes — designed for easy integration with external file-size libraries.
- TimeSpan — An easy way to define, manipulate, and compare durations — designed for easy integration with external time libraries like Luxon and Dayjs.