Database and API for tracking video playback events per user using kafka and ksqldb.
- Python [v3.8.9]
- Node.js [v16.17.1]
- Docker [=>v20.10.17]
- Docker Compose [=>v2.10.2]
- Sqitch [v1.3.1]
- npm [v8.15.0]
Use docker compose to start the stack,
source .env
docker-compose up
wait for at least one minute until all logs show that ksqldb-server, broker and zookeeper have started.
Run the following script to create the kafka topics, as well as the required schema in ksqldb.
./startup.sh
npm install
npm run start
Build the docker container
docker build -t vidtracking-server .
Start the server by running the container,
docker run --name vidtracking-server \
-v "$(pwd)"/src:/app/src \
-p 3000:3000 \
--network host \
-d vidtracking-server
curl -X POST -H "Content-Type: application/json" -d '{"userId": 123, "videoId": 456, "vidTime": 60}' http://localhost:3000/video
curl -X GET http://localhost:3000/video/456/123
To run and integration test, the kakfa broker and ksqldb server need to be running, along with the server.
Start the server
npm start
Open another terminal, and run the test
npm run test
This project is licensed under the Apache-2.0 license.