@quiqflow-org/quiqflow-multi-tenants-utils
v1.0.5
Published
Shared multi-tenant helpers (schema resolution, connection management, middleware) for Quiqflow services.
Maintainers
Readme
quiqflow-multi-tenants-utils
Quiqflow multi-tenant management utilities.
This package provides utility functions and helpers for developing, managing, and operating tenant-aware applications and services within the Quiqflow ecosystem.
Features
- Tenant isolation: Utilities for handling multiple tenants with clear separation.
- Configuration management: Simplifies the loading and handling of tenant-specific configurations.
- Helpers for onboarding/provisioning: Facilitates new tenant setup and management flows.
- Security and context management: Assists in establishing secure context for tenant operations.
- Extensible and framework-agnostic: Easily integrates with Node.js/TypeScript backends and microservices.
Table of Contents
Installation
npm install quiqflow-multi-tenants-utils
# or
yarn add quiqflow-multi-tenants-utilsUsage
Import the package in your TypeScript/Node.js project:
import { getTenantContext, TenantConfigLoader } from 'quiqflow-multi-tenants-utils';
// Example: Retrieve tenant context from a request
const tenantId = req.headers['x-tenant-id'];
const tenantContext = getTenantContext(tenantId);Or in JavaScript:
const { getTenantContext, TenantConfigLoader } = require('quiqflow-multi-tenants-utils');API Reference
📑 NOTE: Consult the inline TypeScript documentation or see API details if available.
getTenantContext(tenantId: string): TenantContext
Retrieves or builds a tenant-specific context object using the provided tenant identifier.
TenantConfigLoader
A utility to load and cache tenant-specific configuration files.
Example:
const configLoader = new TenantConfigLoader('/path/to/configs');
const tenantConfig = configLoader.loadConfig(tenantId);Additional helper functions may include:
- Middleware for Express.js/Koa to inject tenant context
- Utilities for tenant-aware logging
- Helper types and guards for safe multi-tenant code
Examples
See the /examples directory (if present) or review test files for usage patterns and integration scenarios.
Contributing
Contributions are welcome!
Please open issues or pull requests for bug fixes, new features, or improvements.
- Fork the repository.
- Create a new branch (
git checkout -b feature/my-feature). - Commit your changes (
git commit -am 'Add new feature'). - Push to the branch (
git push origin feature/my-feature). - Create a pull request.
License
This project is licensed under the MIT License.
About
quiqflow-multi-tenants-utils is maintained by the Quiqflow team.
For questions or support, please open an issue.
