This project involves the development of two distinct services: a User Review Service and a Restaurant Definition Service. The User Review Service enables users to register, submit reviews for restaurants, and receive personalized restaurant recommendations based on their location and preferences. On the other hand, the Restaurant Definition Service focuses on managing restaurant data, allowing for the addition, update, and deletion of restaurant information. Both services aim to provide efficient and user-friendly solutions for handling user reviews and restaurant definitions, contributing to an enhanced dining experience for users.
The schematic representation of the application architecture is provided below. This visual illustrates the fundamental components and relationships within the application.
- Gateway-Service
API Gateway serves as a central entry point for all incoming requests to the system. It logs both incoming requests and outgoing responses, sending them to a queue for further processing. Additionally, it facilitates request routing and load balancing. I've incorporated additional functionality for logging purposes, leveraging Spring Cloud Gateway.
- Logging Service
The Logging Service monitors the log queue, capturing incoming messages and persisting them into a MongoDB database. This queue employs a retry mechanism, attempting to process messages multiple times. In case the processing fails after several attempts, the service routes the messages to a dead letter queue for further analysis or manual intervention. This ensures robustness in handling log data and provides a safety net for messages that couldn't be processed successfully initially.
- Config Server
The Config Server is responsible for centralizing configuration data for distributed system applications. It maintains all configuration information and serves it to other systems upon request. By centralizing configuration management, this service ensures consistency and enables easy updates across the system. It simplifies the process of managing configuration parameters for various components, enhancing maintainability and scalability of the overall system.
- Service Registry
The Service Registry acts as a centralized directory where microservices within the system can register themselves. It provides a dynamic and up-to-date catalog of available services and their locations, facilitating service discovery and communication between different components of the system. By maintaining an accurate and real-time registry of services, it enables seamless scalability, load balancing, and fault tolerance within the distributed system architecture.
- Review Service
The Review Service is responsible for managing user reviews for restaurants. It interacts with both the user service and the restaurant service via RESTful requests and maintains its own PostgreSQL database. Whenever a review is submitted, it adds an entry to the score update queue, enabling asynchronous updating of the average scores for restaurants. This service ensures efficient handling of user feedback, updating restaurant ratings in real-time without impacting user experience.
- Recommendation Service
The Recommendation Service provides users with three restaurant recommendations based on their current location within a 10 km radius and the ratings of the restaurants. It gathers the user's location and sends a request to the restaurant database using SolrJ to retrieve three restaurant recommendations. It applies the query efficiently on Solr, prioritizing response speed to ensure a seamless user experience. This service focuses on delivering fast and relevant restaurant suggestions to users, enhancing their satisfaction with the recommendation process.
- Restaurant Service
The Restaurant Service manages restaurant definitions within the system. When saving restaurant data, alongside necessary information, latitude and longitude values are also expected in this service. It supports operations such as creating, deleting, updating, and listing restaurants. Restaurant data is stored in Apache Solr, and queries are directed to Solr for efficient retrieval and manipulation. This service ensures comprehensive management of restaurant entities while leveraging the power of Solr for fast and effective data operations.
- User Service
The User Service is responsible for managing user entities within the system. It allows users to be created, deleted, updated, and listed. Additionally, users have addresses associated with them, which include latitude and longitude information. This allows the Recommendation Service to provide location-based recommendations to users. The User Service ensures comprehensive user management and facilitates the provision of personalized recommendations based on user locations.
- Zipkin
All services are integrated with Zipkin for tracing purposes. Zipkin serves as a centralized system for collecting and correlating timing data across distributed services. By connecting to Zipkin, each service can contribute to distributed tracing, allowing me to monitor and analyze the flow of requests throughout the entire system. This integration enhances observability and facilitates troubleshooting and optimization efforts across the distributed architecture.
All services listed below has their own Swagger documentation with detailed explanation of service api's. But with service-registry, endpoints will be shown by each other as below.
Uri | Method | Description |
---|---|---|
/ |
POST |
Creates new user. |
/{id} |
GET |
Gets user by provided id. |
/ |
GET |
Gets all users |
/{id} |
PATCH |
Updates user info. |
/deactivate/{id} |
PATCH |
Deactivate user. (Soft Delete) |
/{id} |
DELETE |
Deletes user. (Hard Delete) |
Uri | Method | Description |
---|---|---|
/ |
POST |
Creates new address. |
/{id} |
GET |
Gets address by provided id. |
/with-userId/{userId} |
GET |
Gets addresses by provided user id. |
/ |
GET |
Gets all addresses |
/{id} |
PATCH |
Updates address info. |
/deactivate/{id} |
PATCH |
Deactivate address. (Soft Delete) |
/{id} |
DELETE |
Deletes address. (Hard Delete) |
Uri | Method | Description |
---|---|---|
/ |
POST |
Creates new restaurant. |
/{id} |
GET |
Gets restaurant by provided id. |
/ |
GET |
Gets all restaurants. |
/{id} |
PATCH |
Updates restaurant info. |
/deactivate/{id} |
PATCH |
Deactivate restaurant. (Soft Delete) |
/{id} |
DELETE |
Deletes restaurant. (Hard Delete) |
Uri | Method | Description |
---|---|---|
/ |
POST |
Creates new review. |
/{id} |
GET |
Gets review by provided id. |
/ |
GET |
Gets all reviews. |
/with-userId/{userId} |
GET |
Gets all reviews by provided user id. |
/with-restaurantId/{restaurantId} |
GET |
Gets all reviews by provided restaurant id. |
/{id} |
PATCH |
Updates review info. |
/{id} |
DELETE |
Deletes review. (Hard Delete) |
Uri | Method | Description |
---|---|---|
/{userId} |
GET |
Gets 3 restaurant recommendations by provided user id. |
Clone the project
git clone https://github.com/mehmet-akif-tanisik/n11-talenthub-backend-bootcamp-final-case
- You should go to n11-talenthub-final-project-be/ to run docker compose file.
docker-compose up
- Open n11-talenthub-final-project-be folder in your preferred IDE. Go to terminal and run command below for all services in the project.
mvn clean install
- Then First thing first Config Server should be up and running, and we are ready to run other services one by one.
- Open n11-talenthub-final-project-fe folder in your preferred IDE or Editor. Go to terminal.
npm run dev
It is as easy as explained above. Now we are ready to see front end.