I started this project to practice technologies, design architecture, and development methodologies such as BDD and TDD. Here I'll show the overview of used technologies, the user interface, and the process of bringing this project to life.
The project consists of 3 main components, Reservation Service
, Payment Service
, and Frontend
.
![main-project-diagram](https://private-user-images.githubusercontent.com/67066372/294309787-d37b18a9-4a73-4c2c-947d-46f10577f6cb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3MDQ5NjAsIm5iZiI6MTcyNTcwNDY2MCwicGF0aCI6Ii82NzA2NjM3Mi8yOTQzMDk3ODctZDM3YjE4YTktNGE3My00YzJjLTk0N2QtNDZmMTA1NzdmNmNiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA3VDEwMjQyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1YWNjZGQ1NzU5MTkyNDNlYzBkNzYyMWM2MjBhMWNkODhkZTFhOTMyOWI4YzA1ZDA3ZDQ2MDdkYmYxZjczMGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.KHG1iyqQ50ts5JdQOnaJuTcTZWzetTKD5_mluHbExW8)
- Searching trips
- Making reservation
- Making payment
- Checking reservation details
- Canceling reservation
- Seat Locking
The Reservation System uses a robust stack of technologies:
Reservation Service | Payment Service | Frontend | Other |
---|---|---|---|
Java 17 | Golang 1.21 | React.js | Docker |
Spring Boot 3.2.0 | axios | Kubernetes | |
Postgresql 12 | Minikube | ||
Liquibase | Intellij | ||
Hibernate | Figma | ||
Cucumber | Whimsical | ||
Spock | |||
Testcontainers |
I tried to make the payment process similar to the Stripe flow
- The user decides to reserve a ticket. That sends a request to the backend for payment.
- Backend contacts a Payment Service to generate a special key for the payment (client secret)
- The backend then sends this key back to the user.
- The user uses this key to make a secure payment with their credit card through the Payment Service.
- Once the payment is complete, the Payment Service automatically notifies the backend using a webhook.
- Backend finalizes the payment process.
![main-project-diagram](https://private-user-images.githubusercontent.com/67066372/293980780-c13ef325-c0be-4c37-ba75-f20be855132b.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3MDQ5NjAsIm5iZiI6MTcyNTcwNDY2MCwicGF0aCI6Ii82NzA2NjM3Mi8yOTM5ODA3ODAtYzEzZWYzMjUtYzBiZS00YzM3LWJhNzUtZjIwYmU4NTUxMzJiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA3VDEwMjQyMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTVmNDYxMTZkZjQxMDZjZGJhNmVhZjNjODQ3YjUwZTRjNDVhMmQ2Mjk3MmNmYjljN2I1MWFiYjg1ZDE0YmNjYjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.8kS3I8sNwob9XXKzYNk3VO-IIh1FBhiCqhsV2NlaBd8)
The project began with a consideration of both functional and non-functional requirements. To visualize the system's structure, I used Whimsical to create diagrams and database relation diagram.
For the project implementation I used Domain-Driven Design (DDD) approach, and hexagonal architecture. This allowed for a clean separation of concerns and facilitated the implementation of domain-specific logic.
- First Implementations:
- I started by implementing the Reservation Service and the Trip List feature, enabling users to search and filter available trips.
- I added unit tests, and I implemented Cucumber end-to-end test to align with a Behavior-Driven Development (BDD) approach.
- Implementing e2e test was a bit challenging. I had to solves issues like run Spring App and Database and fill it with test data automatically for e2e test.
- Evolution of backend service:
- With some initial implementation in place, I started aligning with Test-Driven Development (TDD) and Behavior-Driven Development (BDD) approach. I have to admit implementing all scenarios of e2e test before implementing actual code is quite helpful. It made me think about functionalities and my service API. Thanks to this approach later on I didn't have to make many changes in my code.
- I implemented other features like retrieving reservation details, canceling reservation and the main feature - making reservation.
- Thanks to upfront implemented e2e test scenarios during development I didn't have to run the app and manually call endpoints for testing. I only run e2e test scenarios to validate if implemented feature works properly.
- As the last feature I implemented a seat lock system to lock the seat after user choose it from UI. Thanks to this we can avoid issue with other customer reserving this same seat before first customer finishes his reservation.
- Frontend in React.js
- First I started with designing a User Interface in Figma. Thanks to this I have prepared, colors, required pages, and functionalities for the website. So that during implementation I can focus only on implementing a website and not on how it should look like.
- I chose React because I wanted to practice it more. I did a few simple websites in React in the past. I feel good with React I didn't have many issues. However, I know it was just a simple website.
- The only problem I had was with dynamic typing in JavaScript. Very often I didn't know what field name object has that I passed as a parameter. IDE often didn't show errors and later on, I had to spend some time on debugging issues - which were caused by using a wrong field name. Probably that's why TypeScipt exists :D
- Payment microservice in Golang
- I found that there are more and more job offers for Golang developers so I wanted to try this language and create a simple microservice for handling payment transactions.
- The language seems to be very light however it has a lot of useful tools implemented into the language eg: unit testing or handling Rest API. Certainly, I would like to practice more with this language in the future.
- Kubernetes
- Kubernetes is a very common way of managing services so I wanted to use it as well in my project. In this case, I use Minikube to run it locally.
- I created a docker image of my Spring Boot, React, and Go apps and ran it on the Kubernetes cluster.
- I prepared Manifest yaml files that can be found in
/kubernetes/chars/
directory - More about how to run project on Kubernetes locally here - instruction