# rdcnaren/hotelwebapi architecture

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

- Interactive diagram: https://gitdiagram.com/rdcnaren/hotelwebapi
- Repository: https://github.com/rdcnaren/hotelwebapi

## Overview

This repository implements a hotel-management web application, an ASP.NET API, and shared DTOs. A user reaches the MVC home controller, which uses the hotel service; the API exposes hotel and amenity CRUD plus registration and login, with EF Core persistence and JWT generation for authentication. The source index supports the MVC service registration and controller dependencies, and the API persistence/auth links. The README is empty, and the sampled evidence does not establish the MVC service’s HTTP routing to the API, so that link is left dashed and unverified.

Main entry points: [`FirstWeb_API/Data/ApplicationDbContext.cs`](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Data/ApplicationDbContext.cs) (EF Core context), [`FirstWeb_API/Services/AuthService.cs`](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Services/AuthService.cs) (Auth service), [`FirstWeb_API/Controllers/HotelsController.cs`](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/HotelsController.cs) (Hotel endpoints), [`FirstWeb_API/Controllers/HotelsAmenitiesController.cs`](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/HotelsAmenitiesController.cs) (Amenity endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_home["Home workflow<br/>[HomeController.cs]"]
  node_hotel_client["Hotel client service<br/>[HotelService.cs]"]
  node_web_contracts["Service interfaces<br/>[IHotelService.cs]"]
  node_mvc_views["MVC views"]
end

subgraph group_api["API endpoints"]
  node_hotel_api["Hotel endpoints"]
  node_amenity_api["Amenity endpoints"]
end

subgraph group_identity["Identity"]
  node_auth_api["Auth endpoints<br/>[AuthController.cs]"]
  node_auth_service["Auth service<br/>[AuthService.cs]"]
  node_auth_contract["Auth interface<br/>[IAuthService.cs]"]
end

subgraph group_data["Persistence and contracts"]
  node_db_context[("EF Core context")]
  node_hotel_entity["Hotel entity<br/>[Hotel.cs]"]
  node_amenity_entity["Amenity entity<br/>[HotelAmenities.cs]"]
  node_user_entity["User entity<br/>[User.cs]"]
  node_dto["Shared DTOs<br/>[RoyalHotel.DTO]"]
  node_api_response["API response wrapper<br/>[ApiResponse.cs]"]
end

node_visitor(("Web user"))

node_visitor -->|"requests pages"| node_home
node_home -->|"uses service"| node_hotel_client
node_home -.->|"renders"| node_mvc_views
node_hotel_client -.->|"calls API"| node_hotel_api
node_hotel_client -->|"implements"| node_web_contracts
node_hotel_api -->|"queries and saves"| node_db_context
node_hotel_api -->|"maps hotel data"| node_dto
node_hotel_api -->|"wraps results"| node_api_response
node_amenity_api -->|"queries and saves"| node_db_context
node_amenity_api -->|"maps amenity data"| node_dto
node_amenity_api -->|"wraps results"| node_api_response
node_auth_api -->|"delegates auth"| node_auth_service
node_auth_service -->|"implements"| node_auth_contract
node_auth_service -->|"reads and writes"| node_db_context
node_auth_service -->|"creates users"| node_user_entity
node_auth_service -->|"maps auth data"| node_dto
node_db_context -->|"stores hotels"| node_hotel_entity
node_db_context -->|"stores amenities"| node_amenity_entity
node_db_context -->|"stores users"| node_user_entity

click node_home "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWebApplication/Controllers/HomeController.cs"
click node_hotel_client "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWebApplication/Services/HotelService.cs"
click node_web_contracts "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWebApplication/Services/IServices/IHotelService.cs"
click node_mvc_views "https://github.com/rdcnaren/hotelwebapi/tree/master/FirstWebApplication/Views/Home"
click node_hotel_api "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/HotelsController.cs"
click node_amenity_api "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/HotelsAmenitiesController.cs"
click node_auth_api "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/AuthController.cs"
click node_auth_service "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Services/AuthService.cs"
click node_auth_contract "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Services/IAuthService.cs"
click node_db_context "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Data/ApplicationDbContext.cs"
click node_hotel_entity "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Models/Hotel.cs"
click node_amenity_entity "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Models/HotelAmenities.cs"
click node_user_entity "https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Models/User.cs"
click node_dto "https://github.com/rdcnaren/hotelwebapi/tree/master/RoyalHotel.DTO"
click node_api_response "https://github.com/rdcnaren/hotelwebapi/blob/master/RoyalHotel.DTO/ApiResponse.cs"

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_home,node_hotel_client,node_web_contracts,node_mvc_views,node_visitor toneBlue
class node_hotel_api,node_amenity_api toneAmber
class node_auth_api,node_auth_service,node_auth_contract toneMint
class node_db_context,node_hotel_entity,node_amenity_entity,node_user_entity,node_dto,node_api_response toneRose
```

## Components

### Web application

- [Home workflow](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWebApplication/Controllers/HomeController.cs): `FirstWebApplication/Controllers/HomeController.cs`
- [Hotel client service](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWebApplication/Services/HotelService.cs): `FirstWebApplication/Services/HotelService.cs`
- [Service interfaces](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWebApplication/Services/IServices/IHotelService.cs): `FirstWebApplication/Services/IServices/IHotelService.cs`
- [MVC views](https://github.com/rdcnaren/hotelwebapi/tree/master/FirstWebApplication/Views/Home): `FirstWebApplication/Views/Home`

### API endpoints

- [Hotel endpoints](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/HotelsController.cs): `FirstWeb_API/Controllers/HotelsController.cs`
- [Amenity endpoints](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/HotelsAmenitiesController.cs): `FirstWeb_API/Controllers/HotelsAmenitiesController.cs`

### Identity

- [Auth endpoints](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Controllers/AuthController.cs): `FirstWeb_API/Controllers/AuthController.cs`
- [Auth service](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Services/AuthService.cs): `FirstWeb_API/Services/AuthService.cs`
- [Auth interface](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Services/IAuthService.cs): `FirstWeb_API/Services/IAuthService.cs`

### Persistence and contracts

- [EF Core context](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Data/ApplicationDbContext.cs): `FirstWeb_API/Data/ApplicationDbContext.cs`
- [Hotel entity](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Models/Hotel.cs): `FirstWeb_API/Models/Hotel.cs`
- [Amenity entity](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Models/HotelAmenities.cs): `FirstWeb_API/Models/HotelAmenities.cs`
- [User entity](https://github.com/rdcnaren/hotelwebapi/blob/master/FirstWeb_API/Models/User.cs): `FirstWeb_API/Models/User.cs`
- [Shared DTOs](https://github.com/rdcnaren/hotelwebapi/tree/master/RoyalHotel.DTO): `RoyalHotel.DTO`
- [API response wrapper](https://github.com/rdcnaren/hotelwebapi/blob/master/RoyalHotel.DTO/ApiResponse.cs): `RoyalHotel.DTO/ApiResponse.cs`

### Other components

- **Web user**

## Connections

- Web user → Home workflow: requests pages
- Home workflow → Hotel client service: uses service (evidence: `FirstWebApplication/Controllers/HomeController.cs`)
- Home workflow → MVC views: renders
- Hotel client service → Hotel endpoints: calls API
- Hotel client service → Service interfaces: implements (evidence: `FirstWebApplication/Services/HotelService.cs`)
- Hotel endpoints → EF Core context: queries and saves (evidence: `FirstWeb_API/Controllers/HotelsController.cs`)
- Hotel endpoints → Shared DTOs: maps hotel data (evidence: `FirstWeb_API/Controllers/HotelsController.cs`)
- Hotel endpoints → API response wrapper: wraps results (evidence: `FirstWeb_API/Controllers/HotelsController.cs`)
- Amenity endpoints → EF Core context: queries and saves (evidence: `FirstWeb_API/Controllers/HotelsAmenitiesController.cs`)
- Amenity endpoints → Shared DTOs: maps amenity data (evidence: `FirstWeb_API/Controllers/HotelsAmenitiesController.cs`)
- Amenity endpoints → API response wrapper: wraps results (evidence: `FirstWeb_API/Controllers/HotelsAmenitiesController.cs`)
- Auth endpoints → Auth service: delegates auth (evidence: `FirstWeb_API/Controllers/AuthController.cs`)
- Auth service → Auth interface: implements (evidence: `FirstWeb_API/Services/AuthService.cs`)
- Auth service → EF Core context: reads and writes (evidence: `FirstWeb_API/Services/AuthService.cs`)
- Auth service → User entity: creates users (evidence: `FirstWeb_API/Services/AuthService.cs`)
- Auth service → Shared DTOs: maps auth data (evidence: `FirstWeb_API/Services/AuthService.cs`)
- EF Core context → Hotel entity: stores hotels (evidence: `FirstWeb_API/Data/ApplicationDbContext.cs`)
- EF Core context → Amenity entity: stores amenities (evidence: `FirstWeb_API/Data/ApplicationDbContext.cs`)
- EF Core context → User entity: stores users (evidence: `FirstWeb_API/Data/ApplicationDbContext.cs`)
