# v-zagoruyko/fotoflash-backend architecture

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

- Interactive diagram: https://gitdiagram.com/v-zagoruyko/fotoflash-backend
- Repository: https://github.com/v-zagoruyko/fotoflash-backend

## Overview

FotoFlash is a Django backend for studio-hall rentals. Clients browse locations and extras, request a priced booking, and pay; booking state, bonus points, reminders, and cancellations are managed by backend services. Staff manage the catalog and bookings through Django administration. The graph follows documented API routing and sampled service references; unsampled views and integrations are shown only where the source index supports the relationship.

Main entry points: [`apps/bookings/services.py`](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/services.py) (Booking services), [`config/api_urls.py`](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/config/api_urls.py) (API routing), [`apps/payments/services.py`](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/services.py) (Payment services), [`apps/bookings/tasks.py`](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/tasks.py) (Booking tasks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and access"]
  node_api_routes["API routing<br/>[api_urls.py]"]
  node_user_api["User API<br/>[views.py]"]
  node_catalog_api["Catalog API<br/>[views.py]"]
  node_booking_api["Booking API<br/>[views.py]"]
  node_booking_serializers["Booking serializers<br/>[serializers.py]"]
  node_payment_api["Payment API<br/>[views.py]"]
  node_documents_api["Documents API<br/>[views.py]"]
end

subgraph group_booking["Booking domain"]
  node_catalog_records[("Catalog records<br/>[models.py]")]
  node_booking_services["Booking services<br/>[services.py]"]
  node_pricing["Pricing and quotes<br/>[pricing.py]"]
  node_booking_records[("Booking records<br/>[models.py]")]
  node_bonus_records[("Bonus ledger<br/>[models.py]")]
end

subgraph group_payments["Payments"]
  node_payment_services["Payment services<br/>[services.py]"]
  node_payment_records[("Payment records<br/>[models.py]")]
  node_provider_registry["Provider selection<br/>[__init__.py]"]
  node_tbank["T-Bank provider<br/>[tbank.py]"]
end

subgraph group_operations["Operations and records"]
  node_user_records[("User records<br/>[models.py]")]
  node_documents[("Rules documents<br/>[models.py]")]
  node_booking_tasks["Booking tasks<br/>[tasks.py]"]
  node_booking_emails["Booking emails<br/>[emails.py]"]
  node_celery["Celery runtime<br/>[celery.py]"]
end

node_client(("Client"))
node_staff(("Staff"))
node_bank["T-Bank"]
node_database[("Application database")]

node_client -->|"requests"| node_api_routes
node_staff -.->|"manages"| node_catalog_records
node_api_routes -->|"routes"| node_user_api
node_api_routes -->|"routes"| node_catalog_api
node_api_routes -->|"routes"| node_booking_api
node_api_routes -->|"routes"| node_payment_api
node_api_routes -->|"routes"| node_documents_api
node_user_api -.->|"reads and writes"| node_user_records
node_catalog_api -->|"reads"| node_catalog_records
node_catalog_api -->|"requests booking actions"| node_booking_services
node_booking_api -->|"uses"| node_booking_serializers
node_booking_api -->|"delegates"| node_booking_services
node_booking_services -->|"builds quotes"| node_pricing
node_booking_services -->|"reads"| node_catalog_records
node_booking_services -->|"creates and updates"| node_booking_records
node_booking_services -->|"updates points"| node_bonus_records
node_booking_services -->|"initiates payment actions"| node_payment_services
node_payment_api -.->|"delegates"| node_payment_services
node_payment_services -->|"creates and updates"| node_payment_records
node_payment_services -->|"reads booking"| node_booking_records
node_payment_services -->|"confirms booking"| node_booking_services
node_payment_services -->|"selects provider"| node_provider_registry
node_provider_registry -->|"registers"| node_tbank
node_tbank -->|"sends payment requests"| node_bank
node_documents_api -->|"reads"| node_documents
node_booking_services -->|"queues notifications"| node_booking_tasks
node_booking_tasks -->|"runs lifecycle jobs"| node_booking_services
node_booking_tasks -->|"sends messages"| node_booking_emails
node_booking_emails -->|"reads booking"| node_booking_records
node_booking_emails -->|"reads bonus data"| node_bonus_records
node_booking_emails -->|"reads payment data"| node_payment_records
node_booking_tasks -->|"registers tasks"| node_celery
node_user_records -.->|"persists"| node_database
node_catalog_records -.->|"persists"| node_database
node_booking_records -.->|"persists"| node_database
node_bonus_records -.->|"persists"| node_database
node_payment_records -.->|"persists"| node_database
node_documents -.->|"persists"| node_database

click node_api_routes "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/config/api_urls.py"
click node_user_api "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/users/views.py"
click node_user_records "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/users/models.py"
click node_catalog_api "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/catalog/views.py"
click node_catalog_records "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/catalog/models.py"
click node_booking_api "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/views.py"
click node_booking_serializers "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/serializers.py"
click node_booking_services "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/services.py"
click node_pricing "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/pricing.py"
click node_booking_records "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/models.py"
click node_bonus_records "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bonuses/models.py"
click node_payment_api "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/views.py"
click node_payment_services "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/services.py"
click node_payment_records "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/models.py"
click node_provider_registry "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/providers/__init__.py"
click node_tbank "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/providers/tbank.py"
click node_documents_api "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/documents/views.py"
click node_documents "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/documents/models.py"
click node_booking_tasks "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/tasks.py"
click node_booking_emails "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/emails.py"
click node_celery "https://github.com/v-zagoruyko/fotoflash-backend/blob/main/config/celery.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_api_routes,node_user_api,node_catalog_api,node_booking_api,node_booking_serializers,node_payment_api,node_documents_api,node_client toneBlue
class node_catalog_records,node_booking_services,node_pricing,node_booking_records,node_bonus_records,node_database toneAmber
class node_payment_services,node_payment_records,node_provider_registry,node_tbank toneMint
class node_user_records,node_documents,node_booking_tasks,node_booking_emails,node_celery toneRose
class node_staff,node_bank toneIndigo
```

## Components

### API and access

- [API routing](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/config/api_urls.py): `config/api_urls.py`
- [User API](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/users/views.py): `apps/users/views.py`
- [Catalog API](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/catalog/views.py): `apps/catalog/views.py`
- [Booking API](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/views.py): `apps/bookings/views.py`
- [Booking serializers](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/serializers.py): `apps/bookings/serializers.py`
- [Payment API](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/views.py): `apps/payments/views.py`
- [Documents API](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/documents/views.py): `apps/documents/views.py`

### Booking domain

- [Catalog records](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/catalog/models.py): `apps/catalog/models.py`
- [Booking services](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/services.py): `apps/bookings/services.py`
- [Pricing and quotes](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/pricing.py): `apps/bookings/pricing.py`
- [Booking records](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/models.py): `apps/bookings/models.py`
- [Bonus ledger](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bonuses/models.py): `apps/bonuses/models.py`

### Payments

- [Payment services](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/services.py): `apps/payments/services.py`
- [Payment records](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/models.py): `apps/payments/models.py`
- [Provider selection](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/providers/__init__.py): `apps/payments/providers/__init__.py`
- [T-Bank provider](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/payments/providers/tbank.py): `apps/payments/providers/tbank.py`

### Operations and records

- [User records](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/users/models.py): `apps/users/models.py`
- [Rules documents](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/documents/models.py): `apps/documents/models.py`
- [Booking tasks](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/tasks.py): `apps/bookings/tasks.py`
- [Booking emails](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/apps/bookings/emails.py): `apps/bookings/emails.py`
- [Celery runtime](https://github.com/v-zagoruyko/fotoflash-backend/blob/main/config/celery.py): `config/celery.py`

### Other components

- **Client**
- **Staff**
- **T-Bank**
- **Application database**

## Connections

- Client → API routing: requests (evidence: `config/api_urls.py`)
- Staff → Catalog records: manages
- API routing → User API: routes (evidence: `config/api_urls.py`)
- API routing → Catalog API: routes (evidence: `config/api_urls.py`)
- API routing → Booking API: routes (evidence: `config/api_urls.py`)
- API routing → Payment API: routes (evidence: `config/api_urls.py`)
- API routing → Documents API: routes (evidence: `config/api_urls.py`)
- User API → User records: reads and writes
- Catalog API → Catalog records: reads (evidence: `apps/catalog/views.py`)
- Catalog API → Booking services: requests booking actions (evidence: `apps/catalog/views.py`)
- Booking API → Booking serializers: uses (evidence: `apps/bookings/views.py`)
- Booking API → Booking services: delegates (evidence: `apps/bookings/views.py`)
- Booking services → Pricing and quotes: builds quotes (evidence: `apps/bookings/services.py`)
- Booking services → Catalog records: reads (evidence: `apps/bookings/services.py`)
- Booking services → Booking records: creates and updates (evidence: `apps/bookings/services.py`)
- Booking services → Bonus ledger: updates points (evidence: `apps/bookings/services.py`)
- Booking services → Payment services: initiates payment actions (evidence: `apps/bookings/services.py`)
- Payment API → Payment services: delegates
- Payment services → Payment records: creates and updates (evidence: `apps/payments/services.py`)
- Payment services → Booking records: reads booking (evidence: `apps/payments/services.py`)
- Payment services → Booking services: confirms booking (evidence: `apps/payments/services.py`)
- Payment services → Provider selection: selects provider (evidence: `apps/payments/services.py`)
- Provider selection → T-Bank provider: registers (evidence: `apps/payments/providers/__init__.py`)
- T-Bank provider → T-Bank: sends payment requests (evidence: `apps/payments/providers/tbank.py`)
- Documents API → Rules documents: reads (evidence: `apps/documents/views.py`)
- Booking services → Booking tasks: queues notifications (evidence: `apps/bookings/services.py`)
- Booking tasks → Booking services: runs lifecycle jobs (evidence: `apps/bookings/tasks.py`)
- Booking tasks → Booking emails: sends messages (evidence: `apps/bookings/tasks.py`)
- Booking emails → Booking records: reads booking (evidence: `apps/bookings/emails.py`)
- Booking emails → Bonus ledger: reads bonus data (evidence: `apps/bookings/emails.py`)
- Booking emails → Payment records: reads payment data (evidence: `apps/bookings/emails.py`)
- Booking tasks → Celery runtime: registers tasks (evidence: `apps/bookings/tasks.py`)
- User records → Application database: persists
- Catalog records → Application database: persists
- Booking records → Application database: persists
- Bonus ledger → Application database: persists
- Payment records → Application database: persists
- Rules documents → Application database: persists
