This project is a URL shortening service built using a microservices architecture. It is designed to be scalable, resilient, and maintainable.
The following diagram illustrates the overall architecture of the system:
This diagram shows the flow of a user being redirected from a shortened URL to the original URL.
This diagram shows the sequence of interactions between the services when a new URL is shortened.
The system is composed of the following microservices:
- api-gateway: The single entry point for all client requests. It routes requests to the appropriate downstream service.
- eureka-server: The service registry and discovery server. All other services register with Eureka, allowing them to find and communicate with each other.
- command-service: Handles commands to create and update data, such as creating a new shortened URL.
- query-service: Handles queries for data, such as retrieving the original URL for a given short URL.
- analytics-service: Collects and processes analytics data, such as the number of times a URL has been accessed.
- common: A shared library containing common code and data models used by the other services.
To get started with this project, you will need to have the following installed:
- Java 11 or higher
- Maven
- Docker (optional)
To run the project, you can start each of the services individually. It is recommended to start them in the following order:
eureka-servercommand-servicequery-serviceanalytics-serviceapi-gateway
- Spring Boot: For creating the microservices.
- Spring Cloud: For service discovery (Eureka) and API gateway.
- Maven: For dependency management.
- CQRS: The project follows the Command Query Responsibility Segregation pattern.
