This project implements an event-driven architecture where events/messages are sent from a client to a Kafka queue via a tRPC server, and subsequently to an end provider/service. The project is organized in a monorepo and includes repository management tools such as lint, Husky, and Commitlint.
We'll use Docker to simplify the installation process.
- Docker: Ensure Docker is installed on your machine. You can download it from here.
In root, run:
docker compose up -d
Install project deps. Go to root and run:
npm install
Make sure Docker image is running succesfully. Go to root and run:
npm run dev:kafka
The script will start a Kafka consumer that is using batching.
you can disable batching by setting KAFKA_MESSAGE_BATCHING
env variable to false
.
Go to root and run:
npm run dev:server
Make sure server is running succesfully. Go to root and run:
npm run dev:client
Go to localhost.
The Docker compose command installed and ran Kafdrop image as well. Go to localhost:19000 to review results.
We are using Mocha and Chai for testing, alongside nyc for HTML report.
From a specific package root, run:
npm run test
OR From root, run:
npm run test:all
- You can also run per package - see package.json scripts.
From a specific package root, run:
npm run test:coverage:open
OR from root, run:
npm run test:coverage:open:<packageName>
For specific package.
OR
npm run test:coverage:open:all
For all packages.