service-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
- Navigate to
packages/service-utils
- Run
yarn link
- Navigate to
services/backend
- Run
yarn link @lucaapp/service-utils
This will connect your local sources for @lucaapp/service-utils
. When making
changes:
- Run
yarn build
inpackages/service-utils
to compile changes - Run
yarn package-development
inservices/backend
to test changes
Required environment variables for local development:
export DB_HOSTNAME=localhost
export KAFKA_BROKER=localhost:9094
export REDIS_HOSTNAME=localhost
Ensure your docker stack has database
, kafka
, and redis
running (but not
backend
).
-
yarn build
- Compile TypeScript to JavaScript -
yarn ts:check
- Type check without emitting files -
yarn lint
- Run ESLint -
yarn test
- Run tests with Vitest -
yarn test:coverage
- Run tests with coverage report -
yarn test:ci
- Run tests in CI environment -
yarn 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.