@optimatech88/titomeet-shared-lib
v1.0.54
Published
A shared library designed to centralize the **Prisma schema**, **database models**, and **common NestJS utilities** used across microservices in the Titomeet ecosystem. This ensures consistent data structure and logic reuse between backend services.
Downloads
132
Readme
@optimatech88/titomeet-shared-lib
A shared library designed to centralize the Prisma schema, database models, and common NestJS utilities used across microservices in the Titomeet ecosystem. This ensures consistent data structure and logic reuse between backend services.
📦 Features
- Centralized Prisma schema
- Shared NestJS modules & services (e.g. auth utilities, helpers)
- Built-in Seeder utilities using
nestjs-seeder - Ships with TypeScript and supports Prisma generation
- Ready-to-integrate with any NestJS microservice
🚀 Installation
Install the shared library in your microservice project:
yarn add @optimatech88/titomeet-shared-libor
npm install @optimatech88/titomeet-shared-lib⚙️ Usage
1. Configure Prisma to use the shared schema
In your consuming service's package.json, add:
{
"prisma": {
"schema": "node_modules/@optimatech88/titomeet-shared-lib/prisma/schema.prisma"
}
}2. Generate Prisma Client
After installation or updates, run:
npx prisma generateThis will generate the Prisma Client in your consuming service's node_modules/@prisma/client based on the shared schema.
3. Import Shared Services or Prisma Client
Example usage in a NestJS app:
import { PrismaService } from '@optimatech88/titomeet-shared-lib';You can also import other shared services, modules, helpers, and types from this library.
🧪 Development
To contribute or update the library:
Install dependencies:
yarn installMake changes to the Prisma schema or NestJS modules.
To create a new migration and update your local dev database:
npm run migrate:devGenerate Prisma Client:
npm run generateBuild the library:
npm run build
📦 Publishing
Before publishing a new version:
Bump the package version:
npm version patch # or minor/majorPublish to npm:
npm publish
The prepare script will ensure Prisma and the build are up-to-date before publishing.
⚠️ Important Notes
- Only one microservice should run migrations in production. Others should sync using
prisma generate. - Avoid using
prisma db pushin production environments. - Use
prisma migrate devfor evolving your schema and developing locally. - Always regenerate Prisma client in consuming services after package updates.
📄 License
ISC
✨ Author
Built with ❤️ by the OptimaTech Team
