This is an example project with NestJS and Kafka
The main idea of the app is that users would upload SVG images that will be converted into 3D cookie-cutters using an OpenSCAD script, that I created to make custom cookie cutters for Christmas.
Now, the app is divided into 3 parts:
- API
- for CRUD on the database
- Converter
- for converting a SVG image into a 3D STL model
- Notifications
- that would (someday) contain email and websockets gateways to send notifications
It is very much a work in progress, because I spent an unhealthy amount of time making OpenSCAD run in a container while also having access to the file system (all while working on a Windows machine), so most of the app is not ready at all, but the main flow that currently works is this:
There are no notifications at the moment (apart from the notifications app logging to console when user registers) and very little error handling, also no ConfigService and other fancy stuff, just good old process.env...
Ideally, the notifications app would provide a websocket gateway that the user would connect to and it will push events about the conversion status to update the frontend.
Also... there is no frontend, so you need to use a tool like Postman.
-
spin up docker-compose:
npm run docker:up
-
run all apps:
npm run start:all
- or selectively with
nx serve <app-name>
- or selectively with
-
Register user
- POST to
/authz/register
with{ username, password }
- POST to
-
Login
- POST to
/authz/login
with same{ username, password }
- POST to
-
Upload SVG
- POST to
/cookie-cutters
with{ name, svg }
- no file upload, you'll need to manually copy/paste the SVG string, examples are provided in
example-svg
- POST to
-
Wait for the result
- the result will be available as a file with a random name in
/tmp
- this simulates a storage service, which was also originally planned
- the result will be available as a file with a random name in
-
tear down docker-compose:
npm run docker:down
- To view live dependency graph, run
npm run nx dep-graph
npm run test <app-or-lib-name>
npm run test <app-or-lib-name> -- --testFile=<regex-pattern>
- spin up testing containers
npm run docker:up:test
- Run e2e tests
npm run e2e api
npm run e2e converter