Checkinly is a microservices-based application designed to manage hotel bookings. It consists of several services, including User Service, Hotel Service, Booking Service, and Payment Service. Each service is built with Spring Boot and Kotlin, and they communicate with each other using Kafka for event-driven communication. The services are containerized using Docker and can be deployed in a Kubernetes cluster.
- User management with JWT authentication
- Hotel management with room availability tracking
- Booking management with Kafka integration
- Payment management with MongoDB
- Redis caching for room availability
- Dockerized services for easy deployment
- Kubernetes deployment with NGINX Ingress
- Docker
- Docker Compose
- Kubernetes cluster
- Helm (optional, for installing NGINX Ingress Controller)
- MongoDB
- Kafka
- Redis
Clone the repository to your local machine:
git clone https://github.com/yourusername/checkinly.git
cd checkinly
Navigate to each service directory and build the services using Maven:
cd backend/user-service
mvn clean install
cd ../hotel-service
mvn clean install
cd ../booking-service
mvn clean install
cd ../payment-service
mvn clean install
Build the Docker images for each service:
cd backend/user-service
docker build -t user-service:latest .
cd ../hotel-service
docker build -t hotel-service:latest .
cd ../booking-service
docker build -t booking-service:latest .
cd ../payment-service
docker build -t payment-service:latest .
Use Docker Compose to run all the services along with MongoDB, Kafka, and Redis:
docker-compose up --build
The services will be accessible at the following URLs:
- **User Service: http://localhost:8081
- **Hotel Service: http://localhost:8082
- **Booking Service: http://localhost:8083
- **Payment Service: http://localhost:8084
Install the NGINX Ingress Controller in your Kubernetes cluster:
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install nginx-ingress ingress-nginx/ingress-nginx
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/main/deploy/static/provider/cloud/deploy.yaml
Apply the Kubernetes deployment and service files for each service:
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/user-service-deployment.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/user-service-service.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/hotel-service-deployment.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/hotel-service-service.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/booking-service-deployment.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/booking-service-service.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/payment-service-deployment.yml
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/payment-service-service.yml
Create an Ingress resource to define the routing rules for your services:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: checkinly-ingress
annotations:
nginx.ingress.kubernetes.io/rewrite-target: /
nginx.ingress.kubernetes.io/auth-url: "http://user-service/api/user/authenticate"
nginx.ingress.kubernetes.io/auth-signin: "http://user-service/login"
spec:
rules:
- host: checkinly.local
http:
paths:
- path: /api/user/authenticate
pathType: Prefix
backend:
service:
name: user-service
port:
number: 80
- path: /api/user
pathType: Prefix
backend:
service:
name: user-service
port:
number: 80
- path: /api/booking
pathType: Prefix
backend:
service:
name: booking-service
port:
number: 80
- path: /api/payment
pathType: Prefix
backend:
service:
name: payment-service
port:
number: 80
- path: /
pathType: Prefix
backend:
service:
name: frontend
port:
number: 80
Apply the Ingress resource:
kubectl apply -f file:///c%3A/Users/Deniz/JavaPlayground/checkinly/kubernetes/ingress.yml
Add an entry to your /etc/hosts
file to map checkinly.local
to your Kubernetes cluster's IP address:
<your-cluster-ip> checkinly.local
Now you can access the application at http://checkinly.local
.
- Get All Users:
GET /users
- Get User by ID:
GET /users/{id}
- Create User:
POST /users
- Update User:
PUT /users/{id}
- Delete User:
DELETE /users/{id}
- Authenticate User:
POST /users/authenticate
- Get All Hotels:
GET /hotels
- Get Hotel by ID:
GET /hotels/{id}
- Create Hotel:
POST /hotels
- Update Hotel:
PUT /hotels/{id}
- Delete Hotel:
DELETE /hotels/{id}
- Get All Rooms:
GET /rooms
- Get Rooms by Hotel ID:
GET /rooms/hotel/{hotelId}
- Get Available Rooms by Hotel ID:
GET /rooms/hotel/{hotelId}/available
- Create Room:
POST /rooms
- Update Room:
PUT /rooms/{id}
- Delete Room:
DELETE /rooms/{id}
- Get All Bookings:
GET /bookings
- Get Booking by ID:
GET /bookings/{id}
- Create Booking:
POST /bookings
- Update Booking:
PUT /bookings/{id}
- Delete Booking:
DELETE /bookings/{id}
- Get All Payments:
GET /payments
- Get Payment by ID:
GET /payments/{id}
- Create Payment:
POST /payments
- Update Payment:
PUT /payments/{id}
- Delete Payment:
DELETE /payments/{id}
The following environment variables can be configured for each service:
SPRING_DATA_MONGODB_URI
: MongoDB connection URISPRING_KAFKA_BOOTSTRAP_SERVERS
: Kafka bootstrap serversREDIS_HOST
: Redis hostREDIS_PORT
: Redis port
To run the tests for each service, navigate to the service directory and use the following command:
mvn test
Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.
This project is licensed under the MIT License. See the LICENSE file for details.
For any questions or support, please contact [email protected].