# kovkir/bmstu-dips-course-project architecture

> Architecture diagram of the GitHub repository kovkir/bmstu-dips-course-project, 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/kovkir/bmstu-dips-course-project
- Repository: https://github.com/kovkir/bmstu-dips-course-project

## Overview

This is a flight-booking application: users browse and filter flights, authenticate or register, purchase and manage tickets, and view account/bonus information; administrators can view request statistics. The frontend routes pages through service/request modules, while backend directories separate gateway, domain services, and persistence. Sampled code confirms authentication token storage and gateway-to-statistics event posting, plus Kafka consumption into statistics storage. Other service-to-service wiring is not established by the excerpts, so those links are omitted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/App.tsx) (App routes), [`frontend/src/pages/FlightsPage.tsx`](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/pages/FlightsPage.tsx) (Booking pages), [`frontend/src/pages/AuthorizationPage.tsx`](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/pages/AuthorizationPage.tsx) (Auth pages), [`frontend/src/services/GatewayService.ts`](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/services/GatewayService.ts) (Client services)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Web client"]
  node_app["App routes<br/>[App.tsx]"]
  node_pages["Booking pages<br/>[FlightsPage.tsx]"]
  node_authui["Auth pages"]
  node_clientservices["Client services<br/>[GatewayService.ts]"]
  node_authclient["Auth service<br/>[AuthService.ts]"]
end

subgraph group_gateway["API gateway"]
  node_gatewayapi["Gateway API<br/>[api.py]"]
  node_gatewayroutes["Booking routes<br/>[gateway.py]"]
  node_gatewaylogic["Gateway logic<br/>[gateway.py]"]
  node_gatewaymain["Gateway runtime<br/>[main.py]"]
end

subgraph group_domain["Domain services"]
  node_flight["Flight service<br/>[api.py]"]
  node_tickets["Ticket service<br/>[ticket.py]"]
  node_bonus["Bonus service<br/>[api.py]"]
  node_auth["Auth service<br/>[api.py]"]
end

subgraph group_observability["Statistics pipeline"]
  node_statistics["Statistics API<br/>[api.py]"]
  node_consumer["Statistics consumer<br/>[main.py]"]
end

subgraph group_storage["Persistence"]
  node_statsstore[("Statistics store<br/>[statistics.py]")]
  node_authstore[("User store<br/>[user.py]")]
  node_flightstore[("Flight data<br/>[flight.py]")]
  node_ticketstore[("Ticket data<br/>[ticket.py]")]
  node_bonusstore[("Privilege data<br/>[privilege.py]")]
end

node_user(("User"))
node_kafka["Kafka topic"]

node_user -->|"uses"| node_app
node_app -->|"routes"| node_pages
node_app -->|"routes"| node_authui
node_pages -->|"requests"| node_clientservices
node_authui -->|"authenticates"| node_authclient
node_clientservices -->|"calls"| node_gatewayapi
node_authclient -->|"calls"| node_auth
node_gatewayapi -->|"dispatches"| node_gatewayroutes
node_gatewayroutes -->|"dispatches"| node_gatewaylogic
node_gatewaymain -->|"posts request logs"| node_statistics
node_kafka -->|"delivers messages"| node_consumer
node_consumer -->|"writes records"| node_statsstore

click node_app "https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/App.tsx"
click node_pages "https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/pages/FlightsPage.tsx"
click node_authui "https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/pages/AuthorizationPage.tsx"
click node_clientservices "https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/services/GatewayService.ts"
click node_authclient "https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/services/AuthService.ts"
click node_gatewayapi "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/routers/api.py"
click node_gatewayroutes "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/routers/gateway.py"
click node_gatewaylogic "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/services/gateway.py"
click node_flight "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/flight_service/app/routers/api.py"
click node_tickets "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/ticket_service/app/routers/ticket.py"
click node_bonus "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/bonus_service/app/routers/api.py"
click node_auth "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/auth_service/app/controller/api.py"
click node_statistics "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/statistics_service/app/routers/api.py"
click node_gatewaymain "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/main.py"
click node_consumer "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/consumer_service/app/main.py"
click node_statsstore "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/statistics_service/app/models/statistics.py"
click node_authstore "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/auth_service/app/model/user.py"
click node_flightstore "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/flight_service/app/models/flight.py"
click node_ticketstore "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/ticket_service/app/models/ticket.py"
click node_bonusstore "https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/bonus_service/app/models/privilege.py"

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_pages,node_authui,node_clientservices,node_authclient,node_user toneBlue
class node_gatewayapi,node_gatewayroutes,node_gatewaylogic,node_gatewaymain toneAmber
class node_flight,node_tickets,node_bonus,node_auth toneMint
class node_statistics,node_consumer toneRose
class node_statsstore,node_authstore,node_flightstore,node_ticketstore,node_bonusstore,node_kafka toneIndigo
```

## Components

### Web client

- [App routes](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Booking pages](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/pages/FlightsPage.tsx): `frontend/src/pages/FlightsPage.tsx`
- [Auth pages](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/pages/AuthorizationPage.tsx): `frontend/src/pages/AuthorizationPage.tsx`
- [Client services](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/services/GatewayService.ts): `frontend/src/services/GatewayService.ts`
- [Auth service](https://github.com/kovkir/bmstu-dips-course-project/blob/main/frontend/src/services/AuthService.ts): `frontend/src/services/AuthService.ts`

### API gateway

- [Gateway API](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/routers/api.py): `backend/gateway_service/app/routers/api.py`
- [Booking routes](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/routers/gateway.py): `backend/gateway_service/app/routers/gateway.py`
- [Gateway logic](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/services/gateway.py): `backend/gateway_service/app/services/gateway.py`
- [Gateway runtime](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/gateway_service/app/main.py): `backend/gateway_service/app/main.py`

### Domain services

- [Flight service](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/flight_service/app/routers/api.py): `backend/flight_service/app/routers/api.py`
- [Ticket service](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/ticket_service/app/routers/ticket.py): `backend/ticket_service/app/routers/ticket.py`
- [Bonus service](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/bonus_service/app/routers/api.py): `backend/bonus_service/app/routers/api.py`
- [Auth service](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/auth_service/app/controller/api.py): `backend/auth_service/app/controller/api.py`

### Statistics pipeline

- [Statistics API](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/statistics_service/app/routers/api.py): `backend/statistics_service/app/routers/api.py`
- [Statistics consumer](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/consumer_service/app/main.py): `backend/consumer_service/app/main.py`

### Persistence

- [Statistics store](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/statistics_service/app/models/statistics.py): `backend/statistics_service/app/models/statistics.py`
- [User store](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/auth_service/app/model/user.py): `backend/auth_service/app/model/user.py`
- [Flight data](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/flight_service/app/models/flight.py): `backend/flight_service/app/models/flight.py`
- [Ticket data](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/ticket_service/app/models/ticket.py): `backend/ticket_service/app/models/ticket.py`
- [Privilege data](https://github.com/kovkir/bmstu-dips-course-project/blob/main/backend/bonus_service/app/models/privilege.py): `backend/bonus_service/app/models/privilege.py`

### Other components

- **User**
- **Kafka topic**

## Connections

- User → App routes: uses
- App routes → Booking pages: routes
- App routes → Auth pages: routes
- Booking pages → Client services: requests
- Auth pages → Auth service: authenticates
- Client services → Gateway API: calls
- Auth service → Auth service: calls
- Gateway API → Booking routes: dispatches
- Booking routes → Gateway logic: dispatches
- Gateway runtime → Statistics API: posts request logs
- Kafka topic → Statistics consumer: delivers messages
- Statistics consumer → Statistics store: writes records
