Complex Reservation
In this project we will write E2E tests, automating our tests and unit tests. To learn more about tests. Learn more about testing here.
A reservation booking system that has the following features and each feature has its own database if it needs (exposing their port are just for you to connect to them with mongo-compass on your local system. But our code is utilizing docker internal networking system to connect and find the appropriate database instance in our compose stack):
- Payment.
- Bill users.
- Persist reservations.
-
Send email notifications.
- In dev env you can see them by going to this url: http://localhost:1080/.
-
Right now we ain’t re-authenticating user in the notification service, though you might wanna do or do not do it:
Do it Do not do it Security Sensitivity: E.g trigger financial transactions or access to sensitive data. Trust Between Services: Microservices often operate within a trusted network. Different Security Context: E.g. stricter requirements and regulations. Separation of Concerns: You could argue that it is not notification’s responsibility. There is significant time gap between the initial authentication & notification being sent. Performance Considerations: too much load on auth service.
Topics that can be considered for further discussion
- CI/CD.
- Create client SDK for your microservices.
- Retry mechanism for even-driven communication.
- Which microservice can access another microservice and to which extend.
Learn more
- My own documentation as an introductory info for microservices.
- PATCH vs PUT HTTP verb.
- The concept of machine-2-machine communication and as such permissions.
Start the app in dev env
pnpm i --frozen-lockfile- Copy
.env.examplefiles and create.envfiles. pnpm compose:up.pnpm start.
Run tests
For tests read this doc.
Run e2e tests
cp .env.example .envpnpm i --frozen-lockfile./run-e2e.shadd--buildflag if you need to rebuild your stack.
Run unit tests
pnpm i --frozen-lockfilepnpm test
Update 3rd-party libs
pnpm up --latest
Tech stack
Services
- Payment.
- Reservation.
- Notification.
Libs
Common libraries that we’ll use in different microservices.