`service-utils` is a shared package that provides functionality for backend services to reduce code duplication. It includes utilities for:
npm install @lucaapp/service-utilsservice-utils is a shared package that provides functionality for backend
services to reduce code duplication. It includes utilities for:
- Logging and monitoring
- API validation and OpenAPI documentation
- Error handling
- Database operations
- Authentication and authorization
- Kafka messaging
- HTTP client operations
- And more
1. Navigate to packages/service-utils
2. Run yarn link
3. Navigate to services/backend
4. Run yarn link @lucaapp/service-utils
This will connect your local sources for @lucaapp/service-utils. When making
changes:
1. Run yarn build in packages/service-utils to compile changes
2. Run yarn package-development in services/backend to test changes
Required environment variables for local development:
``shell`
export DB_HOSTNAME=localhost
export KAFKA_BROKER=localhost:9094
export REDIS_HOSTNAME=localhost
Ensure your docker stack has database, kafka, and redis running (but notbackend).
- yarn build - Compile TypeScript to JavaScriptyarn ts:check
- - Type check without emitting filesyarn lint
- - Run ESLintyarn test
- - Run tests with Vitestyarn test:coverage
- - Run tests with coverage reportyarn test:ci
- - Run tests in CI environmentyarn audit
- - Run security audit (ignoring dev dependencies)
The package is automatically published when changes are merged to dev. Follow
semantic-release conventions
in commit messages to trigger appropriate versioning.
The package uses modern versions of key dependencies:
- TypeScript 5.5.3
- Node.js 18
- Express 4.21.2
- Sequelize 6.32.0
- Zod 3.22.3
- Vitest 3.0.5 for testing
See package.json` for a complete list of dependencies.