Skip to content

This is a personal project exhibiting the understanding of tech stack used in this project especially in the world of microservices.

Notifications You must be signed in to change notification settings

yash1th-yerra/Job-App-Microservice-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Job Application Microservice API

Introduction

This project is a microservices-based application designed to demonstrate the integration of multiple services that communicate with each other efficiently. The architecture leverages industry-standard tools and technologies such as Spring Boot, Eureka for service discovery, RabbitMQ for messaging, Zipkin for distributed tracing, and PostgreSQL as the relational database management system.

The application is structured as a collection of loosely coupled, independently deployable services that work together to offer a complete solution for handling company data, job postings, user reviews, and secure JWT ,OAuth2 and role based authentication. Each service is containerized using Docker and orchestrated using Docker Compose for seamless setup and scaling

App

Key Components

1. Company Management Service (companyms)

This service is responsible for handling company data, including:

  • Adding, updating, and retrieving company profiles.
  • Managing company-specific details like locations, industries, and job listings.

2. Job Management Service (jobms)

This service is dedicated to managing job-related information, such as:

  • Posting job listings.
  • Viewing available jobs.
  • Managing job categories and job descriptions.

3. Review Management Service (reviewms)

This service manages user feedback and reviews for job postings and companies. Key features include:

  • Collecting user reviews for companies and jobs.
  • Displaying aggregated review data for users to make informed decisions.

4. Security Service (security)

The security service is built to provide secure access to the platform using JWT (JSON Web Tokens) for authentication and authorization. Features include:

  • User registration and login.
  • Generating and validating JWT tokens.
  • Protecting API endpoints with role-based access control.

5. API Gateway (gateway)

The API Gateway routes client requests to the appropriate microservices. It also handles cross-cutting concerns such as:

  • Rate limiting
  • Load balancing
  • Security filters (authentication and authorization)
  • Centralized error handling gateway

6. Service Registry (servicereg)

Eureka is used as the service discovery tool, allowing services to dynamically register and find each other without hardcoding URLs. This ensures that the system remains flexible and scalable as new services are added.

7. Configuration Server (configserver)

The Spring Cloud Config Server manages external configuration for all services, ensuring that configurations are consistent across different environments (development, production, etc.).

8. PostgreSQL Database (postgres)

The system uses PostgreSQL to persist user credentials and other data, including job listings, company profiles, and reviews. This relational database is chosen for its robust support for transactions and scalability. basic-microservice-architecture

9. RabbitMQ

RabbitMQ is used for asynchronous communication between services, providing a messaging layer for event-driven architecture. It ensures that services can communicate without tight coupling, enhancing system resilience and scalability. before_mssg_queue

msg_broker

msg_broker_2

10. Zipkin (Tracing)

Zipkin is integrated for distributed tracing, allowing developers to trace requests as they travel through different microservices. This is essential for debugging and monitoring the health of the system.

11. PgAdmin

PgAdmin is used for managing the PostgreSQL database. It provides a user-friendly web interface for viewing and manipulating data, which helps in database administration tasks.

12. Containerized: The entire system is containerized using Docker and orchestrated using Docker Compose, making it easy to set up, deploy, and scale the application.

dockerizing

13. Deployment: Minikube(Kubernetes Dev Environment)

Kubernetes Architecture

kubernetes

Technologies Used

  • Backend: Spring Boot
  • Service Discovery: Eureka
  • Configuration Management: Spring Cloud Config
  • Authentication: JWT (JSON Web Tokens),OAuth2
  • Database: PostgreSQL
  • Messaging: RabbitMQ
  • Tracing: Zipkin
  • API Gateway: Spring Cloud Gateway
  • Containerization: Docker, Docker Compose
  • Deployment: Minikube(Kubernetes Dev Environment)

Project Structure

The project consists of the following main components:

  1. Company Management Service (companyms)
  2. Job Management Service (jobms)
  3. Review Management Service (reviewms)
  4. Security Service (security)
  5. Gateway Service (gateway)
  6. Service Registry (servicereg)
  7. Config Server (configserver)
  8. PostgreSQL Database (postgres)
  9. RabbitMQ for messaging
  10. Zipkin for distributed tracing
  11. PgAdmin for database management

Setup and Installation

Prerequisites

  • Docker: Ensure Docker is installed and running on your machine.
  • Docker Compose: Ensure Docker Compose is installed.

Steps to Run the Application

  1. Clone the repository: git clone <your-repository-url> cd <your-project-directory>
  • Navigate to the docker-compose.yml file directory.

  • Build and start all the services using Docker Compose: docker-compose up --build

  • This will start all the services in the background. You can check the logs for any errors or to confirm everything started properly.

  • Access the Services:

    • API Gateway: http://localhost:8084
    • Security Service (Login, Register): http://localhost:9090
    • PgAdmin (for PostgreSQL database management): http://localhost:5050
    • Zipkin (Tracing): http://localhost:9411
    • Service Registry (Eureka): http://localhost:8761
  • The services will automatically register with Eureka, and you can access them through the API Gateway.

Sample Workflow

  1. Register a User: Use the /user/register endpoint to register a new user.
  2. Login: Use the /user/login endpoint to authenticate the user and receive a JWT token.
  3. Access Job Postings: Use the JWT token to access job postings via the API Gateway.
  4. Submit a Review: Submit user feedback through the Review Management service.

Architecture Diagram

           +---------------------+      
           |  API Gateway         |
           +---------+-----------+
                     |
       +-------------+-------------+
       |                           |
+------+-------+             +-----+------+
| Company MS   |             |  Job MS    |
+--------------+             +------------+
       |                           |
       |                           |
+------v-------+             +-----v------+
| Review MS    |             |  Security  |
+--------------+             +------------+
       |                           |
       |                  +--------v--------+
       |                  |  Eureka (SR)    |
       |                  +--------+--------+
       |                           |
+------v------+             +------v-------+
|  Config     |             |  PostgreSQL  |
+-------------+             +--------------+
       |                           |
+------v-------+             +-----v------+
|  RabbitMQ    |             |   Zipkin   |
+--------------+             +------------+

Troubleshooting

  • Error: Service not found in Eureka: Ensure that all services are running properly and that Eureka server is up. Check the logs for any issues.
  • Database connection errors: Make sure that PostgreSQL is up and running, and the correct environment variables (DB_DEFAULT_USERNAME, DB_DEFAULT_PASSWORD) are set in the docker-compose.yml.

Conclusion

This project is a comprehensive microservices application designed to showcase the integration of Spring Boot with tools like Eureka, RabbitMQ, PostgreSQL, and Zipkin. It provides a scalable architecture where each service is independently deployable and can be managed through Docker and Docker Compose. The application is designed to be secure, scalable, and easy to manage, making it suitable for a variety of real-world use cases.

License

This project is licensed under the MIT License.

About

This is a personal project exhibiting the understanding of tech stack used in this project especially in the world of microservices.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages