Skip to content

Mansoor-P/hotel-booking-api-microservices

Repository files navigation

Hotlel Booking API - Microservices with Okta Security

This project demonstrates the creation of a microservices architecture using Spring Boot. It integrates REST APIs, services, service registry, API gateway, and GitHub configuration. Additionally, it secures the microservices with Okta for JWT OAuth authentication.

Microservices Architecture

Key Technologies

Java 17 Spring Boot 3 Spring Cloud Netflix
Spring Cloud Config Spring Security Spring Data JPA
Hibernate MySQL MongoDB
JUnit 5

Step 1: Setting Up Your Environment

Step 2: Creating a REST API

  • Project Setup: Create a new Spring Boot project using Spring Initializr.
  • Define REST Controller: Use @RestController and @RequestMapping annotations to define REST endpoints.
  • Implement CRUD Operations: Set up endpoints for Create, Read, Update, and Delete operations.

Step 3: Implementing Services

  • Define Service Layer: Use the @Service annotation to define service classes.
  • Business Logic: Implement the necessary business logic in the service classes.

Step 4: Implementing Service Registry

  • Add Eureka Server Dependency: Include spring-cloud-starter-netflix-eureka-server in your pom.xml.
  • Configure Eureka Server: Use @EnableEurekaServer annotation to enable Eureka server functionality.
  • Register Services: Services automatically register with Eureka Server when started. Learn more about Eureka Server.

Step 5: Implementing API Gateway

  • Add Zuul Dependency: Include spring-cloud-starter-netflix-zuul in your pom.xml.
  • Configure Zuul: Enable Zuul proxy functionality by using @EnableZuulProxy annotation.
  • Route Configuration: Define routes to direct requests to the appropriate microservices. Learn more about Zuul API Gateway.

Step 6: GitHub Configuration

  • Create GitHub Repository: Set up a repository to host your microservices project on GitHub.
  • Version Control: Initialize Git in your project directory and link it to your GitHub repository.
  • Push Code to GitHub: Commit and push your code to the repository. Learn more about GitHub.

Step 7: Securing with Okta JWT OAuth

  • Add Okta Dependency: Include Okta dependencies in your pom.xml. Follow Okta setup instructions on Okta Developer.
  • Configure Okta: Set up an Okta Developer account and configure an OAuth 2.0 application.
  • Security Configuration: Integrate Okta with Spring Security for JWT OAuth authentication. Learn more about Okta integration with Spring Security here.

Step 8: Next Steps

About

This repository contains a Travel Booking Platform implemented using microservices architecture with Java and Spring Boot. The project is designed with scalability and flexibility in mind, utilizing several independent microservices that communicate through RESTful APIs. Okta is used for securing the microservices with JWT OAuth authentication.

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages