# kokinf/tourgor architecture

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

- Interactive diagram: https://gitdiagram.com/kokinf/tourgor
- Repository: https://github.com/kokinf/tourgor

## Overview

Tourgor is a web application for browsing and booking tours, with client accounts, passenger/document management, and administrative and manager dashboards. The main flow is a visitor searching active tours, viewing a tour, and—after authentication—creating a booking; staff manage bookings, users, and tours. The sampled code shows the server wiring, handler-to-service calls, and service-to-repository delegation. The README is empty, and several handler, service, and repository implementations were not excerpted, so uncertain links are omitted.

Main entry points: [`internal/service/service.go`](https://github.com/kokinf/tourgor/blob/main/internal/service/service.go) (Service layer), [`internal/app/app.go`](https://github.com/kokinf/tourgor/blob/main/internal/app/app.go) (Server setup and routes), [`internal/repository/repository.go`](https://github.com/kokinf/tourgor/blob/main/internal/repository/repository.go) (Repository assembly), [`internal/repository/user.go`](https://github.com/kokinf/tourgor/blob/main/internal/repository/user.go) (User storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_browser["Browser pages"]
  node_browser_js["Search and profile UI"]
end

subgraph group_http["HTTP application"]
  node_server["Server setup and routes<br/>[app.go]"]
  node_client_handlers["Client handlers<br/>[handler.go]"]
  node_auth_handlers["Authentication handlers<br/>[handler.go]"]
  node_admin_handlers["Admin handlers<br/>[handler.go]"]
  node_manager_handlers["Manager handlers<br/>[handler.go]"]
end

subgraph group_domain["Business services"]
  node_service["Service layer<br/>[service.go]"]
  node_auth_service["Authentication services<br/>[auth.go]"]
  node_tour_service["Tour services<br/>[tour.go]"]
  node_passenger_service["Passenger services<br/>[passenger.go]"]
  node_manager_service["Manager operations<br/>[manager.go]"]
  node_models["Domain models"]
end

subgraph group_data["Persistence"]
  node_repository["Repository assembly<br/>[repository.go]"]
  node_users_repo["User storage<br/>[user.go]"]
  node_tours_repo["Tour storage<br/>[tour.go]"]
  node_bookings_repo["Booking storage<br/>[booking.go]"]
  node_passengers_repo["Passenger storage<br/>[passenger.go]"]
  node_documents_repo["Document storage<br/>[document.go]"]
end

node_visitor(("Visitor / user"))
node_postgres[("PostgreSQL")]

node_visitor -->|"uses"| node_browser
node_browser_js -.->|"requests tours"| node_server
node_server -->|"routes requests"| node_client_handlers
node_server -->|"routes auth"| node_auth_handlers
node_server -->|"routes admin"| node_admin_handlers
node_server -->|"routes management"| node_manager_handlers
node_server -->|"initializes"| node_repository
node_server -->|"initializes"| node_service
node_server -->|"opens connection"| node_postgres
node_client_handlers -->|"calls"| node_service
node_auth_handlers -->|"authenticates"| node_service
node_admin_handlers -->|"calls"| node_service
node_manager_handlers -->|"calls"| node_service
node_client_handlers -->|"renders pages"| node_browser
node_admin_handlers -->|"renders dashboard"| node_browser
node_manager_handlers -->|"renders dashboard"| node_browser
node_service -->|"delegates user work"| node_users_repo
node_service -.->|"delegates auth"| node_auth_service
node_service -.->|"delegates tours"| node_tour_service
node_service -.->|"delegates passengers"| node_passenger_service
node_manager_service -->|"updates bookings"| node_bookings_repo
node_manager_service -->|"creates managers"| node_users_repo
node_manager_service -->|"updates tour price"| node_tours_repo
node_repository -->|"constructs"| node_users_repo
node_repository -->|"constructs"| node_tours_repo
node_repository -->|"constructs"| node_bookings_repo
node_repository -->|"constructs"| node_passengers_repo
node_repository -->|"constructs"| node_documents_repo
node_users_repo -.->|"queries"| node_postgres
node_tours_repo -.->|"queries"| node_postgres
node_bookings_repo -.->|"queries"| node_postgres
node_passengers_repo -.->|"queries"| node_postgres
node_documents_repo -.->|"queries"| node_postgres

click node_browser "https://github.com/kokinf/tourgor/tree/main/web/templates"
click node_browser_js "https://github.com/kokinf/tourgor/tree/main/web/static/js"
click node_server "https://github.com/kokinf/tourgor/blob/main/internal/app/app.go"
click node_client_handlers "https://github.com/kokinf/tourgor/blob/main/internal/handler/client/handler.go"
click node_auth_handlers "https://github.com/kokinf/tourgor/blob/main/internal/handler/auth/handler.go"
click node_admin_handlers "https://github.com/kokinf/tourgor/blob/main/internal/handler/admin/handler.go"
click node_manager_handlers "https://github.com/kokinf/tourgor/blob/main/internal/handler/manager/handler.go"
click node_service "https://github.com/kokinf/tourgor/blob/main/internal/service/service.go"
click node_auth_service "https://github.com/kokinf/tourgor/blob/main/internal/service/auth.go"
click node_tour_service "https://github.com/kokinf/tourgor/blob/main/internal/service/tour.go"
click node_passenger_service "https://github.com/kokinf/tourgor/blob/main/internal/service/passenger.go"
click node_manager_service "https://github.com/kokinf/tourgor/blob/main/internal/service/manager.go"
click node_models "https://github.com/kokinf/tourgor/tree/main/internal/model"
click node_repository "https://github.com/kokinf/tourgor/blob/main/internal/repository/repository.go"
click node_users_repo "https://github.com/kokinf/tourgor/blob/main/internal/repository/user.go"
click node_tours_repo "https://github.com/kokinf/tourgor/blob/main/internal/repository/tour.go"
click node_bookings_repo "https://github.com/kokinf/tourgor/blob/main/internal/repository/booking.go"
click node_passengers_repo "https://github.com/kokinf/tourgor/blob/main/internal/repository/passenger.go"
click node_documents_repo "https://github.com/kokinf/tourgor/blob/main/internal/repository/document.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_browser,node_browser_js,node_visitor toneBlue
class node_server,node_client_handlers,node_auth_handlers,node_admin_handlers,node_manager_handlers,node_postgres toneAmber
class node_service,node_auth_service,node_tour_service,node_passenger_service,node_manager_service,node_models toneMint
class node_repository,node_users_repo,node_tours_repo,node_bookings_repo,node_passengers_repo,node_documents_repo toneRose
```

## Components

### Web experience

- [Browser pages](https://github.com/kokinf/tourgor/tree/main/web/templates): `web/templates`
- [Search and profile UI](https://github.com/kokinf/tourgor/tree/main/web/static/js): `web/static/js`

### HTTP application

- [Server setup and routes](https://github.com/kokinf/tourgor/blob/main/internal/app/app.go): `internal/app/app.go`
- [Client handlers](https://github.com/kokinf/tourgor/blob/main/internal/handler/client/handler.go): `internal/handler/client/handler.go`
- [Authentication handlers](https://github.com/kokinf/tourgor/blob/main/internal/handler/auth/handler.go): `internal/handler/auth/handler.go`
- [Admin handlers](https://github.com/kokinf/tourgor/blob/main/internal/handler/admin/handler.go): `internal/handler/admin/handler.go`
- [Manager handlers](https://github.com/kokinf/tourgor/blob/main/internal/handler/manager/handler.go): `internal/handler/manager/handler.go`

### Business services

- [Service layer](https://github.com/kokinf/tourgor/blob/main/internal/service/service.go): `internal/service/service.go`
- [Authentication services](https://github.com/kokinf/tourgor/blob/main/internal/service/auth.go): `internal/service/auth.go`
- [Tour services](https://github.com/kokinf/tourgor/blob/main/internal/service/tour.go): `internal/service/tour.go`
- [Passenger services](https://github.com/kokinf/tourgor/blob/main/internal/service/passenger.go): `internal/service/passenger.go`
- [Manager operations](https://github.com/kokinf/tourgor/blob/main/internal/service/manager.go): `internal/service/manager.go`
- [Domain models](https://github.com/kokinf/tourgor/tree/main/internal/model): `internal/model`

### Persistence

- [Repository assembly](https://github.com/kokinf/tourgor/blob/main/internal/repository/repository.go): `internal/repository/repository.go`
- [User storage](https://github.com/kokinf/tourgor/blob/main/internal/repository/user.go): `internal/repository/user.go`
- [Tour storage](https://github.com/kokinf/tourgor/blob/main/internal/repository/tour.go): `internal/repository/tour.go`
- [Booking storage](https://github.com/kokinf/tourgor/blob/main/internal/repository/booking.go): `internal/repository/booking.go`
- [Passenger storage](https://github.com/kokinf/tourgor/blob/main/internal/repository/passenger.go): `internal/repository/passenger.go`
- [Document storage](https://github.com/kokinf/tourgor/blob/main/internal/repository/document.go): `internal/repository/document.go`

### Other components

- **Visitor / user**
- **PostgreSQL**

## Connections

- Visitor / user → Browser pages: uses
- Search and profile UI → Server setup and routes: requests tours
- Server setup and routes → Client handlers: routes requests (evidence: `internal/app/app.go`)
- Server setup and routes → Authentication handlers: routes auth (evidence: `internal/app/app.go`)
- Server setup and routes → Admin handlers: routes admin (evidence: `internal/app/app.go`)
- Server setup and routes → Manager handlers: routes management (evidence: `internal/app/app.go`)
- Server setup and routes → Repository assembly: initializes (evidence: `internal/app/app.go`)
- Server setup and routes → Service layer: initializes (evidence: `internal/app/app.go`)
- Server setup and routes → PostgreSQL: opens connection (evidence: `internal/app/app.go`)
- Client handlers → Service layer: calls (evidence: `internal/handler/client/handler.go`)
- Authentication handlers → Service layer: authenticates (evidence: `internal/handler/auth/handler.go`)
- Admin handlers → Service layer: calls (evidence: `internal/handler/admin/handler.go`)
- Manager handlers → Service layer: calls (evidence: `internal/handler/manager/handler.go`)
- Client handlers → Browser pages: renders pages (evidence: `internal/handler/client/handler.go`)
- Admin handlers → Browser pages: renders dashboard (evidence: `internal/handler/admin/handler.go`)
- Manager handlers → Browser pages: renders dashboard (evidence: `internal/handler/manager/handler.go`)
- Service layer → User storage: delegates user work (evidence: `internal/service/service.go`)
- Service layer → Authentication services: delegates auth
- Service layer → Tour services: delegates tours
- Service layer → Passenger services: delegates passengers
- Manager operations → Booking storage: updates bookings (evidence: `internal/service/manager.go`)
- Manager operations → User storage: creates managers (evidence: `internal/service/manager.go`)
- Manager operations → Tour storage: updates tour price (evidence: `internal/service/manager.go`)
- Repository assembly → User storage: constructs (evidence: `internal/repository/repository.go`)
- Repository assembly → Tour storage: constructs (evidence: `internal/repository/repository.go`)
- Repository assembly → Booking storage: constructs (evidence: `internal/repository/repository.go`)
- Repository assembly → Passenger storage: constructs (evidence: `internal/repository/repository.go`)
- Repository assembly → Document storage: constructs (evidence: `internal/repository/repository.go`)
- User storage → PostgreSQL: queries
- Tour storage → PostgreSQL: queries
- Booking storage → PostgreSQL: queries
- Passenger storage → PostgreSQL: queries
- Document storage → PostgreSQL: queries
