Introduction
π§° @catbee/utils β The Ultimate Utility Toolkit for Node.js & TypeScriptβ
A modular, production-grade utility library for Node.js and TypeScript, built for robust, scalable applications and enterprise Express services. Every utility is tree-shakable, fully typed, and can be imported independently for optimal bundle size.
π Featuresβ
- Type-safe: All utilities are fully typed for maximum safety and IDE support.
- Tree-shakable: Import only what you needβno bloat, no dead code.
- Production-ready: Designed for high-performance, scalable Node.js apps.
- Express-friendly: Includes context, middleware, decorators, and server helpers.
- Comprehensive: Covers arrays, objects, strings, streams, requests, responses, performance, caching, validation, and more.
- Configurable: Global config system with environment variable support.
- Minimal dependencies: Minimal footprint, maximum reliability.
π¦ Installationβ
npm i @catbee/utils
β‘ Quick Startβ
import { chunk, sleep, getLogger, uuid, isEmail } from "@catbee/utils";
// Chunk an array
const result = chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]
// Sleep for 1 second
await sleep(1000);
// Log with context
getLogger().info("App started");
// Generate a secure UUID
console.log(uuid()); // e.g. 2a563ec1-caf6-4fe2-b60c-9cf7fb1bdb7f
// Basic validation
console.log(isEmail("user@example.com")); // true
π Usage Philosophyβ
Import only what you need to keep your bundle size small and your codebase clean:
import { chunk, sleep, TTLCache, getLogger } from "@catbee/utils";
βοΈ Configurationβ
Global configuration management with environment variable support:
- Config β Centralized runtime configuration
π’ Express Serverβ
Enterprise-grade Express server utilities:
- Express Server β Fast, secure, and scalable server setup
π§© Utility Modulesβ
Explore the full suite of utilities, each with detailed API docs and examples:
- Array Utilities β Advanced array manipulation
- Async Utilities β Promise helpers, concurrency, timing
- Cache Utilities β In-memory caching with TTL
- Context Store β Per-request context via AsyncLocalStorage
- Crypto Utilities β Hashing, encryption, tokens
- Date Utilities β Date/time manipulation
- Decorators Utilities β TypeScript decorators for Express
- Directory Utilities β Directory and file system helpers
- Environment Utilities β Env variable management
- Exception Utilities β HTTP and error handling
- File System Utilities β File operations
- HTTP Status Codes β Typed status codes
- ID Utilities β UUID and ID generation
- Logger Utilities β Structured logging with Pino
- Middleware Utilities β Express middleware collection
- Object Utilities β Deep merge, flatten, pick/omit, etc.
- Performance Utilities β Timing, memoization, memory tracking
- Request Utilities β HTTP request parameter parsing/validation
- Response Utilities β Standardized API response formatting
- Stream Utilities β Stream conversion, batching, throttling, line splitting
- String Utilities β Casing, masking, slugifying, formatting
- Type Utilities β Type checking, conversion, guards
- URL Utilities β URL parsing, query manipulation, normalization
- Validate Utilities β Input validation functions
π Licenseβ
MIT Β© catbee-technologies