# rajasunrise/fiber-hotel architecture

> Architecture diagram of the GitHub repository rajasunrise/fiber-hotel, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/rajasunrise/fiber-hotel
- Repository: https://github.com/rajasunrise/fiber-hotel

## Overview

This is a Go Fiber hotel API. Clients call public signup/login routes or JWT-protected CRUD routes; handlers parse and validate request data, use GORM against MySQL, and return JSON. The route table documents bookings, rooms, facilities, reviews, payments, promotions, employees, content, locations, and users. Sampled handlers confirm the database access pattern, while unsampled controller details and migration behavior are represented only at the directory or entry-point level.

Main entry points: [`routers/routers.go`](https://github.com/rajasunrise/fiber-hotel/blob/main/routers/routers.go) (Route table), [`database/database.go`](https://github.com/rajasunrise/fiber-hotel/blob/main/database/database.go) (GORM connection), [`models/request/requeser.go`](https://github.com/rajasunrise/fiber-hotel/blob/main/models/request/requeser.go) (Request models), [`controllers/review_controller.go`](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/review_controller.go) (Review CRUD)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_app["Fiber server<br/>[main.go]"]
  node_routes["Route table<br/>[routers.go]"]
end

subgraph group_identity["Identity"]
  node_auth["JWT middleware<br/>[middleware.go]"]
  node_account["Signup and login"]
  node_users["User CRUD<br/>[user_controller.go]"]
end

subgraph group_hotel["Hotel operations"]
  node_bookings["Booking CRUD"]
  node_payments["Payment CRUD"]
  node_rooms["Room CRUD<br/>[room_controller.go]"]
  node_reviews["Review CRUD"]
end

subgraph group_catalog["Hotel catalog"]
  node_facilities["Facility CRUD"]
  node_promotions["Promotion CRUD"]
  node_employees["Employee CRUD"]
  node_locations["Location CRUD"]
  node_content["Content CRUD"]
end

subgraph group_persistence["Persistence"]
  node_requestmodels["Request models<br/>[requeser.go]"]
  node_entities["Entity models"]
  node_database["GORM connection<br/>[database.go]"]
  node_mysql[("MySQL database")]
  node_migrations["Schema migrations<br/>[migrate.go]"]
end

node_client(("API client"))

node_client -->|"HTTP requests"| node_app
node_app -->|"runs migrations"| node_migrations
node_app -->|"registers routes"| node_routes
node_routes -->|"dispatches public"| node_account
node_routes -->|"installs JWT"| node_auth
node_auth -->|"protects routes"| node_users
node_routes -->|"dispatches protected"| node_users
node_routes -->|"dispatches protected"| node_bookings
node_routes -->|"dispatches protected"| node_payments
node_routes -->|"dispatches protected"| node_rooms
node_routes -->|"dispatches protected"| node_reviews
node_routes -->|"dispatches protected"| node_facilities
node_routes -->|"dispatches protected"| node_promotions
node_routes -->|"dispatches protected"| node_employees
node_routes -->|"dispatches protected"| node_locations
node_routes -->|"dispatches protected"| node_content
node_account -->|"accesses data"| node_database
node_users -->|"accesses data"| node_database
node_bookings -->|"accesses data"| node_database
node_payments -->|"accesses data"| node_database
node_rooms -->|"accesses data"| node_database
node_reviews -->|"accesses data"| node_database
node_facilities -->|"accesses data"| node_database
node_promotions -->|"accesses data"| node_database
node_employees -->|"accesses data"| node_database
node_locations -->|"accesses data"| node_database
node_content -->|"accesses data"| node_database
node_database -->|"queries"| node_mysql
node_migrations -->|"updates schema"| node_database
node_account -->|"parses requests"| node_requestmodels
node_bookings -->|"parses requests"| node_requestmodels
node_reviews -->|"parses requests"| node_requestmodels
node_promotions -->|"parses requests"| node_requestmodels
node_payments -->|"parses requests"| node_requestmodels
node_reviews -->|"queries models"| node_entities
node_promotions -->|"queries models"| node_entities

click node_app "https://github.com/rajasunrise/fiber-hotel/blob/main/main.go"
click node_routes "https://github.com/rajasunrise/fiber-hotel/blob/main/routers/routers.go"
click node_auth "https://github.com/rajasunrise/fiber-hotel/blob/main/middleware/middleware.go"
click node_account "https://github.com/rajasunrise/fiber-hotel/tree/main/controllers"
click node_users "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/user_controller.go"
click node_bookings "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/booking_controller.go"
click node_payments "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/payment_controller.go"
click node_rooms "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/room_controller.go"
click node_reviews "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/review_controller.go"
click node_facilities "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/facility_controller.go"
click node_promotions "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/promotion_controller.go"
click node_employees "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/employee_controller.go"
click node_locations "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/location_controller.go"
click node_content "https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/content_controller.go"
click node_requestmodels "https://github.com/rajasunrise/fiber-hotel/blob/main/models/request/requeser.go"
click node_entities "https://github.com/rajasunrise/fiber-hotel/tree/main/models/entity"
click node_database "https://github.com/rajasunrise/fiber-hotel/blob/main/database/database.go"
click node_migrations "https://github.com/rajasunrise/fiber-hotel/blob/main/database/migrations/migrate.go"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_routes,node_client toneBlue
class node_auth,node_account,node_users toneAmber
class node_bookings,node_payments,node_rooms,node_reviews toneMint
class node_facilities,node_promotions,node_employees,node_locations,node_content toneRose
class node_requestmodels,node_entities,node_database,node_mysql,node_migrations toneIndigo
```

## Components

### API entry

- [Fiber server](https://github.com/rajasunrise/fiber-hotel/blob/main/main.go): `main.go`
- [Route table](https://github.com/rajasunrise/fiber-hotel/blob/main/routers/routers.go): `routers/routers.go`

### Identity

- [JWT middleware](https://github.com/rajasunrise/fiber-hotel/blob/main/middleware/middleware.go): `middleware/middleware.go`
- [Signup and login](https://github.com/rajasunrise/fiber-hotel/tree/main/controllers): `controllers`
- [User CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/user_controller.go): `controllers/user_controller.go`

### Hotel operations

- [Booking CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/booking_controller.go): `controllers/booking_controller.go`
- [Payment CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/payment_controller.go): `controllers/payment_controller.go`
- [Room CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/room_controller.go): `controllers/room_controller.go`
- [Review CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/review_controller.go): `controllers/review_controller.go`

### Hotel catalog

- [Facility CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/facility_controller.go): `controllers/facility_controller.go`
- [Promotion CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/promotion_controller.go): `controllers/promotion_controller.go`
- [Employee CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/employee_controller.go): `controllers/employee_controller.go`
- [Location CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/location_controller.go): `controllers/location_controller.go`
- [Content CRUD](https://github.com/rajasunrise/fiber-hotel/blob/main/controllers/content_controller.go): `controllers/content_controller.go`

### Persistence

- [Request models](https://github.com/rajasunrise/fiber-hotel/blob/main/models/request/requeser.go): `models/request/requeser.go`
- [Entity models](https://github.com/rajasunrise/fiber-hotel/tree/main/models/entity): `models/entity`
- [GORM connection](https://github.com/rajasunrise/fiber-hotel/blob/main/database/database.go): `database/database.go`
- **MySQL database**
- [Schema migrations](https://github.com/rajasunrise/fiber-hotel/blob/main/database/migrations/migrate.go): `database/migrations/migrate.go`

### Other components

- **API client**

## Connections

- API client → Fiber server: HTTP requests
- Fiber server → Schema migrations: runs migrations
- Fiber server → Route table: registers routes
- Route table → Signup and login: dispatches public
- Route table → JWT middleware: installs JWT
- JWT middleware → User CRUD: protects routes
- Route table → User CRUD: dispatches protected
- Route table → Booking CRUD: dispatches protected
- Route table → Payment CRUD: dispatches protected
- Route table → Room CRUD: dispatches protected
- Route table → Review CRUD: dispatches protected
- Route table → Facility CRUD: dispatches protected
- Route table → Promotion CRUD: dispatches protected
- Route table → Employee CRUD: dispatches protected
- Route table → Location CRUD: dispatches protected
- Route table → Content CRUD: dispatches protected
- Signup and login → GORM connection: accesses data
- User CRUD → GORM connection: accesses data
- Booking CRUD → GORM connection: accesses data
- Payment CRUD → GORM connection: accesses data
- Room CRUD → GORM connection: accesses data
- Review CRUD → GORM connection: accesses data
- Facility CRUD → GORM connection: accesses data
- Promotion CRUD → GORM connection: accesses data
- Employee CRUD → GORM connection: accesses data
- Location CRUD → GORM connection: accesses data
- Content CRUD → GORM connection: accesses data
- GORM connection → MySQL database: queries
- Schema migrations → GORM connection: updates schema
- Signup and login → Request models: parses requests
- Booking CRUD → Request models: parses requests
- Review CRUD → Request models: parses requests
- Promotion CRUD → Request models: parses requests
- Payment CRUD → Request models: parses requests
- Review CRUD → Entity models: queries models
- Promotion CRUD → Entity models: queries models
