Hotel Service API
π¨
A comprehensive hotel management REST API built with Java, Spring Boot, and PostgreSQL. Manages property information, room inventory, bookings, guest profiles, and hotel operations.
Features
| Feature | Description | Icon |
|---|---|---|
| Room Inventory | Manage rooms, availability, and room types | ποΈ |
| Reservation Management | Create, modify, and cancel reservations | π |
| Guest Profiles | Maintain guest information and history | π€ |
| Pricing Management | Dynamic pricing, seasonal rates, and promotions | π° |
| Occupancy Tracking | Real-time occupancy and revenue metrics | π |
| Check-in/Check-out | Manage guest arrival and departure processes | πͺ |
| Multi-Tenant Support | Support multiple hotel properties per tenant | π’ |
Architecture Overview
flowchart TD
A[Client] -->|REST API| B(HotelController)
B --> C[ReservationService]
C --> D[RoomService]
C --> E[GuestService]
D --> F[RoomRepository]
E --> G[GuestRepository]
C --> H[ReservationRepository]
F --> I[(PostgreSQL)]
G --> I
H --> I
Hold "Alt" / "Option" to enable pan & zoom
API Endpoints
Note: Real API endpoints to be provided and included here.
| Method | Endpoint | Description | Notes/Parameters |
|---|---|---|---|
| POST | /api/v1/properties |
Create property | tenantId header, property details |
| GET | /api/v1/properties/{id} |
Get property details | |
| POST | /api/v1/rooms |
Create room | Property ID, room type, amenities |
| POST | /api/v1/reservations |
Create reservation | Guest info, room, dates |
Sequence: Create Reservation
sequenceDiagram
participant U as Guest
participant API as HotelController
participant R as ReservationService
participant S as RoomService
participant Repo as ReservationRepository
U->>API: POST /reservations (guest, dates, room type)
API->>R: validate reservation
R->>S: check room availability
S-->>R: rooms available
R->>Repo: save reservation
Repo-->>R: reservation created
R->>S: update room status
S-->>R: room reserved
R-->>API: ReservationResponse
API-->>U: 201 Created + reservation details
Hold "Alt" / "Option" to enable pan & zoom
Database Schema
erDiagram
properties {
UUID id PK
UUID tenant_id
VARCHAR property_name
VARCHAR address
VARCHAR city
VARCHAR country
VARCHAR phone
TIMESTAMP created
TIMESTAMP updated
}
rooms {
UUID id PK
UUID property_id FK
VARCHAR room_number
VARCHAR room_type
INTEGER capacity
DECIMAL price_per_night
VARCHAR status
TIMESTAMP created
TIMESTAMP updated
}
reservations {
UUID id PK
UUID room_id FK
UUID guest_id FK
DATE check_in_date
DATE check_out_date
DECIMAL total_price
VARCHAR status
TIMESTAMP created
TIMESTAMP updated
}
guests {
UUID id PK
UUID tenant_id
VARCHAR first_name
VARCHAR last_name
VARCHAR email
VARCHAR phone
VARCHAR country
TIMESTAMP created
}
properties ||--o{ rooms : "has"
rooms ||--o{ reservations : "booked_in"
guests ||--o{ reservations : "makes"
Hold "Alt" / "Option" to enable pan & zoom
Getting Started
Prerequisites
- Java 17+
- PostgreSQL
- Gradle
Setup
git clone https://github.com/Olanna-tech/hotel-service-java.git
cd hotel-service-java
./gradlew build
Database
- Configure your PostgreSQL credentials in
src/main/resources/application.yml. - Run Flyway migrations (auto on startup).
Run
./gradlew bootRun
Configuration
Set the following environment variables in application.yml:
hotel:
currency: USD
timezone: UTC
check-in-time: 15:00
check-out-time: 11:00
cancellation-deadline-hours: 24
Contributing
Pull requests are welcome! For major changes, please open an issue first.
License
Contact
- Olanna
- support@Olanna.tech