When to Use
Uselib-commons-js
whenever you need shared logic that’s been tested across Lerian’s ecosystem. It’s especially useful when you want to:
- Integrate with Midaz.
- Share data models across services.
- Reduce boilerplate in TypeScript projects.
Key Features
- Modular architecture: Import only the components you need to keep your project clean and focused.
- TypeScript support: Written in TypeScript from the ground up for a better developer experience and type safety.
- Core utilities: Ready-to-use helpers for logging, context handling, error management, and transaction processing.
- Shared models: Centralized data models that ensure consistency across projects.
- Business logic: Common rules and patterns used by multiple Midaz services, wrapped and ready to use.
Repository Structure
The repository is organized for clarity and modular usage:commons/
: Core modules and utilities.- Configuration files: Includes
.eslintrc.js
,.prettierrc
, andtsconfig.json
to enforce code quality. - Package management: Managed via
package.json
andpackage-lock.json
. - Continuous integration: Automated releases set up with
.github/
workflows and.releaserc.yml
.
Getting Started
Requirements
You’ll need Node.js v23 or later to use this library.1. Install the Library
2. Add the Library to Your Project
To uselib-commons-js
, import the relevant subpackage in the file where you need it. The functions will be available through the named import:
Contributing
We welcome contributions. If you’ve written logic that could benefit other services, let’s bring it intolib-commons-js
.
Make sure your code follows our standards and includes test coverage.
License
- Apache 2.0 - refer to the LICENSE page for details.