{"id":49573628,"url":"https://github.com/pitercoding/hotel-management","last_synced_at":"2026-05-03T15:39:27.248Z","repository":{"id":345290986,"uuid":"1185256542","full_name":"pitercoding/hotel-management","owner":"pitercoding","description":"[EN] Full-stack application for managing hotel rooms, bookings, and reservations with role-based access. [PT] Aplicação full-stack para gerenciamento de quartos, reservas e hospedagens com controle de acesso por papéis.","archived":false,"fork":false,"pushed_at":"2026-04-13T14:17:34.000Z","size":5925,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-03T15:39:08.577Z","etag":null,"topics":["angular","booking-system","docker","fullstack","h2-database","hotel-management","integration-test","jpa","jwt-authentication","mysql","reservation-system","rest-api","role-based-access","spring-boot","swagger-openapi","unity-test","web-application"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pitercoding.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-18T11:53:57.000Z","updated_at":"2026-04-13T14:22:37.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pitercoding/hotel-management","commit_stats":null,"previous_names":["pitercoding/hotel-management"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pitercoding/hotel-management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fhotel-management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fhotel-management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fhotel-management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fhotel-management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pitercoding","download_url":"https://codeload.github.com/pitercoding/hotel-management/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pitercoding%2Fhotel-management/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32575114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","booking-system","docker","fullstack","h2-database","hotel-management","integration-test","jpa","jwt-authentication","mysql","reservation-system","rest-api","role-based-access","spring-boot","swagger-openapi","unity-test","web-application"],"created_at":"2026-05-03T15:39:26.500Z","updated_at":"2026-05-03T15:39:27.230Z","avatar_url":"https://github.com/pitercoding.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003eHotel Management\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eLanguages:\u003c/strong\u003e\u003cbr\u003e\n  \u003ca href=\"README.pt.md\"\u003ePortuguese\u003c/a\u003e |\n  \u003ca href=\"README.md\"\u003eEnglish\u003c/a\u003e\n\u003c/p\u003e\n\nHotel Management is a **full-stack hotel booking application** built with **Spring Boot**, **Angular**, and **MySQL**. It provides a role-based experience for **administrators** and **customers**, with JWT authentication, protected API routes, room management, and reservation workflows.\n\nThe system supports:\n\n- User registration and login with JWT-based authentication\n- Automatic role handling for `ADMIN` and `CUSTOMER`\n- Admin room management with create, update, delete, and paginated listing\n- Customer room browsing with availability filtering\n- Reservation requests with date range selection and automatic total price calculation\n- Admin reservation review flow with approval or rejection\n- Swagger/OpenAPI documentation for the backend API\n\n## 🎯 Project Motivation\n\nThis project was built to practice a realistic hotel management workflow with clear separation between backend business rules and frontend user flows.\n\nThe main goal was to implement a small but complete reservation platform that demonstrates:\n\n- secure authentication with Spring Security and JWT\n- role-based access to admin and customer features\n- CRUD operations on hotel rooms\n- reservation lifecycle handling from request to approval\n\n## ✅ Current Features\n\n### ⚙️ Backend (Spring Boot + MySQL)\n\n- Authentication API:\n  - `POST /api/auth/signup`\n  - `POST /api/auth/login`\n- Customer API:\n  - `GET /api/customer/rooms/{pageNumber}`\n  - `POST /api/customer/book`\n  - `GET /api/customer/bookings/{userId}/{pageNumber}`\n- Admin API:\n  - `POST /api/admin/room`\n  - `GET /api/admin/rooms/{pageNumber}`\n  - `GET /api/admin/room/{id}`\n  - `PUT /api/admin/room/{id}`\n  - `DELETE /api/admin/room/{id}`\n  - `GET /api/admin/reservations/{pageNumber}`\n  - `PUT /api/admin/reservation/{reservationId}/{reservationStatus}`\n- Security and infrastructure:\n  - JWT authentication filter for protected endpoints\n  - role-based authorization with `ADMIN` and `CUSTOMER`\n  - stateless Spring Security configuration\n  - CORS enabled for frontend/backend local integration\n  - Swagger UI and OpenAPI configuration\n  - actuator health/info exposure\n- Business rules:\n  - new users are created as `CUSTOMER`\n  - a default admin account is created automatically on startup if none exists\n  - customer room listing only returns rooms marked as available\n  - reservations start with `PENDING` status\n  - reservation total price is calculated from room price x number of days\n  - approving or rejecting a reservation updates its status\n  - approved reservations mark the room as unavailable\n- Persistence and tests:\n  - JPA entities for `User`, `Room`, and `Reservation`\n  - repository, service, and controller tests\n  - H2 in-memory configuration for backend tests\n\n### 🖥️ Frontend (Angular + NG-ZORRO)\n\n- Authentication screens:\n  - registration form with validation\n  - login form with JWT storage in `localStorage`\n  - automatic redirect after login based on user role\n- Admin area:\n  - sidebar navigation for room and reservation management\n  - room creation form\n  - paginated dashboard listing rooms\n  - room editing flow\n  - room deletion with confirmation modal\n  - reservations page with approve/reject actions\n- Customer area:\n  - available room listing with pagination\n  - booking modal with check-in/check-out date range selection\n  - personal bookings history with pagination\n- UX behavior:\n  - toast notifications for success, warning, and error feedback\n  - route-level separation between auth, admin, and customer modules\n  - token-aware menu rendering\n  - responsive card/table-based pages using NG-ZORRO components\n\n## 🔄 Application Flow\n\n### 👤 Customer Flow\n\n1. Register a new account\n2. Login as customer\n3. Browse available rooms\n4. Choose a room and submit a booking request with a date range\n5. Check booking history and current reservation status\n\n### 🛠️ Admin Flow\n\n1. Login with an admin account\n2. Create, update, and remove rooms\n3. View paginated reservation requests\n4. Approve or reject reservations\n\n## 🧰 Technologies\n\n### ⚙️ Backend\n\n- Java 17\n- Spring Boot 3\n- Spring Security\n- Spring Data JPA\n- MySQL\n- JWT (`jjwt`)\n- Springdoc OpenAPI / Swagger UI\n- Maven\n- JUnit 5 + H2\n\n### 🖥️ Frontend\n\n- Angular 21\n- TypeScript\n- Angular Router\n- Reactive Forms\n- RxJS\n- NG-ZORRO Ant Design\n- SCSS\n\n### 🚀 DevOps / Tooling\n\n- Docker\n- Docker Compose\n\n## ▶️ How to Run Locally\n\n### 1. 📥 Clone the repository\n\n```bash\ngit clone https://github.com/pitercoding/hotel-management.git\ncd hotel-management\n```\n\n### 2. 🔐 Configure environment variables\n\nCreate a `.env` file in the project root with values like:\n\n```bash\nDB_USER=your_mysql_user\nDB_PASS=your_mysql_password\nDB_NAME=hotel_db\nDB_ROOT_PASS=your_mysql_root_password\nJWT_SECRET=your_jwt_secret\n```\n\n### 3. 🗄️ Start MySQL\n\nYou can use your local MySQL instance or start only the database with Docker:\n\n```bash\ndocker compose up -d mysql\n```\n\n### 4. ⚙️ Run the backend\n\n```bash\ncd backend\n./mvnw spring-boot:run\n```\n\nOn Windows:\n\n```bash\ncd backend\nmvnw.cmd spring-boot:run\n```\n\n### 5. 🖥️ Run the frontend\n\n```bash\ncd frontend\nnpm install\nnpm start\n```\n\n### 6. 🌐 Open the application\n\n- Frontend: `http://localhost:4200`\n- Backend: `http://localhost:8080`\n- Swagger UI: `http://localhost:8080/swagger-ui/index.html`\n\n## 🐳 Run With Docker Compose\n\nTo start the full stack with containers:\n\n```bash\ndocker compose up --build\n```\n\nThis starts:\n\n- MySQL on `3306`\n- Spring Boot backend on `8080`\n- Angular frontend on `4200`\n\n## 👑 Default Admin Account\n\nThe backend creates a default admin user automatically if no admin exists:\n\n- Email: `admin@test.com`\n- Password: `admin`\n\nThis is intended for development/demo use and should be changed in a production-ready setup.\n\n## 🔌 API Notes\n\n- `/api/auth/**` is public\n- `/api/admin/**` requires the `ADMIN` role\n- `/api/customer/**` requires the `CUSTOMER` role\n- The frontend stores the JWT token and user role in `localStorage`\n- Room lists are paginated\n- Customer room search returns only rooms with `available = true`\n- Booking requests are created as `PENDING`\n- Reservation status values handled by the backend are `APPROVED` and `REJECTED`\n\n## 🧪 Testing Status\n\nCurrent status:\n\n- backend repository tests are implemented\n- backend service tests are implemented\n- backend controller tests are implemented\n- frontend component/service spec files are present\n- backend tests use H2 in-memory database configuration\n\nRecommended next test scope:\n\n- add frontend route/auth guard tests\n- add frontend integration tests for login and booking flows\n- add more validation and edge-case coverage for reservation dates\n- add end-to-end tests for admin and customer journeys\n\n## 🔮 Next Improvements\n\n### 📦 Product\n\n- Add room photos upload/storage instead of static image usage\n- Add booking cancellation flow\n- Add availability conflict validation by date range\n- Add search and filters by room type and price\n\n### 🔐 Security and Backend\n\n- Move secrets to a dedicated environment strategy for deployment\n- Add refresh token or token expiration/renewal flow\n- Improve validation and standardized error responses\n- Add database migrations with Flyway or Liquibase\n\n### 🎨 Frontend and UX\n\n- Add route guards for admin/customer modules\n- Improve empty states and loading states\n- Add dashboard metrics for reservations and occupancy\n- Improve mobile navigation behavior\n\n### 🚚 Delivery\n\n- Add CI pipeline for lint, test, and build\n- Add production deployment configuration\n\n## 📁 Folder Structure\n\n```text\nhotel-management/\n|-- backend/                                 # Spring Boot API\n|   |-- src/main/java/com/pitercoding/backend/\n|   |   |-- configs/                         # Security, JWT, CORS, OpenAPI\n|   |   |-- controller/\n|   |   |   |-- admin/                      # Admin room and reservation endpoints\n|   |   |   |-- auth/                       # Signup and login endpoints\n|   |   |   `-- customer/                   # Customer room and booking endpoints\n|   |   |-- dto/                            # Request and response DTOs\n|   |   |-- entity/                         # JPA entities\n|   |   |-- enums/                          # Domain enums\n|   |   |-- repository/                     # Spring Data repositories\n|   |   |-- services/                       # Business logic by domain\n|   |   |-- util/                           # JWT utility\n|   |   `-- BackendApplication.java         # Spring Boot entrypoint\n|   |-- src/main/resources/\n|   |   `-- application.properties          # Main backend configuration\n|   |-- src/test/                           # Backend unit/integration tests\n|   |-- Dockerfile\n|   `-- pom.xml\n|-- frontend/                                # Angular application\n|   |-- src/app/\n|   |   |-- auth/                           # Login, register, auth storage/services\n|   |   |-- modules/\n|   |   |   |-- admin/                      # Admin pages, services, routing\n|   |   |   `-- customer/                   # Customer pages, services, routing\n|   |   |-- app.config.ts                   # Global Angular providers\n|   |   |-- app.routes.ts                   # Root routes\n|   |   |-- app.html                        # Main shell and sidebar layout\n|   |   `-- DemoNgZorroAntdModule.ts        # NG-ZORRO shared imports\n|   |-- public/images/                      # Static brand and UI images\n|   |-- angular.json\n|   |-- Dockerfile\n|   `-- package.json\n|-- docker-compose.yml                       # Multi-container local setup\n|-- README.md                                # Documentation (English)\n`-- README.pt.md                             # Documentation (Portuguese)\n```\n\n## 🖼️ Screenshots \u0026 Visuals\n\n### 🔐 Login Page\n\n![Login Page](frontend/public/screenshots/login_page.png)\n\n### 📝 Register Page\n\n![Register Page](frontend/public/screenshots/register_page.png)\n\n### 🏨 Admin Room View\n\n![Admin Room View](frontend/public/screenshots/admin_room_view.png)\n\n### ➕ Admin Post Room\n\n![Admin Post Room](frontend/public/screenshots/admin_post_room.png)\n\n### 📋 Admin Reservations\n\n![Admin Reservations](frontend/public/screenshots/admin_reservations.png)\n\n### 🛏️ Customer Rooms\n\n![Customer Rooms](frontend/public/screenshots/customer_rooms.png)\n\n### 📖 Customer Bookings\n\n![Customer Bookings](frontend/public/screenshots/customer_bookings.png)\n\n## 📄 License\n\nThis project is licensed under the **MIT License**.\n\n## 👤 Author\n\n**Piter Gomes** - Computer Science Student (6th Semester) \u0026 Full-Stack Developer\n\n[Email](mailto:piterg.bio@gmail.com) | [LinkedIn](https://www.linkedin.com/in/piter-gomes-4a39281a1/) | [GitHub](https://github.com/pitercoding) | [Portfolio](https://portfolio-pitergomes.vercel.app/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpitercoding%2Fhotel-management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpitercoding%2Fhotel-management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpitercoding%2Fhotel-management/lists"}