About this project

The @rapidrest/core package is a collection of common utilities and core functionality for building RESTful applications in the RapidREST ecosystem. It provides foundational building blocks consumed by other RapidREST libraries and services, including dependency injection, caching, authentication, messaging, observability, and general-purpose helpers. **Object Lifecycle & Dependency Injection** The library includes a ClassLoader that dynamically discovers classes at runtime using folder-based namespace conventions, and an ObjectFactory lightweight DI container. Dependencies can be injected via decorators (@Inject, @Config, @Logger), and object lifecycle is managed through @Init and @Destroy. **Caching & Session Storage** A common SimpleStore interface supports TTL-based record storage with two implementations: MemoryStore for in-process storage and RedisStore backed by Redis for sharing state across multiple application instances. Bulk operations like loadMany, saveMany, loadSet, and saveSet are available. **Auth & Validation** JWTUtils provides creation, signing, verification, and decoding of JSON Web Tokens, with optional password- or key-based payload encryption and compression. UserUtils offers role, scope, and organization-membership checks. ValidationUtils supplies a library of validators for email, URL, phone, UUID, semantic version, IP, date, JSON, and more, usable with the @Validator decorator. **Messaging & Alerting** MessagingUtils sends templated messages (Handlebars) via email, SMS, or Slack from a shared template store. AlertUtils dispatches priority-based incident alerts (P1–P5) with file attachments to external alerting services. NotificationUtils publishes real-time push notifications over Redis pub/sub to individual user channels or broadcast to all subscribers. **Observability** A pre-configured Winston Logger automatically tags log lines with the calling class and method name. TelemetryUtils records application telemetry events and forwards them to a configured collection service. **General Utilities** StringUtils, ObjectUtils, FileUtils, OASUtils (for loading, caching, and querying OpenAPI specs), CacheUtils (bounded eviction caches), and an ApiError class (HTTP-aware with status code and templated messages) are included. **Concurrency** A ThreadPool manages a pool of Node.js worker threads, auto-sized to the CPU count, with typed message passing and automatic restart on worker crashes. The package is ESM-only and targets Node.js >=24.0.0. Required peer dependencies are axios, redis (for RedisStore), reflect-metadata, winston, and winston-transport. Messaging channels dynamically load optional packages (nodemailer, twilio, @slack/bolt) as needed.