# dongjak-village-guards/backend architecture

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

- Interactive diagram: https://gitdiagram.com/dongjak-village-guards/backend
- Repository: https://github.com/dongjak-village-guards/backend

## Overview

BuyNow is a Django backend for local businesses: customers discover stores and available discounted time slots, then reserve them; owners and administrators have role-specific account and store operations. Pricing utilities and scheduled management commands maintain discount and sales-history data used by availability and reservation features. The source excerpts show key calls and model relationships, but not all URL dispatch or unsampled view behavior, so the graph avoids inferring those links.

Main entry points: [`buynow/reservations/views.py`](https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/views.py) (Reservation API), [`buynow/stores/views.py`](https://github.com/dongjak-village-guards/backend/blob/main/buynow/stores/views.py) (Store API), [`buynow/pricing/management/commands`](https://github.com/dongjak-village-guards/backend/tree/main/buynow/pricing/management/commands) (Pricing Jobs), [`buynow/accounts/views.py`](https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/views.py) (Account API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Accounts &amp; Identity"]
  node_account_api["Account API<br/>[views.py]"]
  node_account_serializers["Account Serializers<br/>[serializers.py]"]
  node_authentication["Firebase Token Auth<br/>[authentication.py]"]
  node_users[("Users<br/>[models.py]")]
end

subgraph group_market["Store Discovery"]
  node_store_api["Store API<br/>[views.py]"]
  node_store_catalog[("Store Catalog &amp; Slots<br/>[models.py]")]
  node_location["Location Services<br/>[kakaoapi.py]"]
end

subgraph group_booking["Reservations"]
  node_reservation_api["Reservation API<br/>[views.py]"]
  node_reservation_serializers["Reservation Serializers<br/>[serializers.py]"]
  node_reservation_data[("Reservations &amp; Likes<br/>[models.py]")]
end

subgraph group_pricing["Pricing &amp; Records"]
  node_pricing_utils["Pricing Utilities<br/>[utils.py]"]
  node_pricing_models[("Pricing Parameters<br/>[models.py]")]
  node_pricing_jobs["Pricing Jobs"]
  node_records[("Sales Records<br/>[models.py]")]
end

node_customer(("Customer"))
node_owner(("Store Owner"))
node_firebase{{"Firebase Auth"}}
node_kakao{{"Kakao Local API"}}
node_logger["Application Logger<br/>[logger.py]"]

node_customer -->|"signs in"| node_account_api
node_owner -->|"signs in"| node_account_api
node_account_api -->|"validates with"| node_account_serializers
node_account_serializers -->|"reads and writes"| node_users
node_authentication -->|"verifies tokens"| node_firebase
node_authentication -->|"creates or retrieves"| node_users
node_customer -.->|"browses stores"| node_store_api
node_owner -.->|"manages stores"| node_store_api
node_store_api -->|"queries catalog"| node_store_catalog
node_store_api -->|"gets coordinates"| node_location
node_location -->|"geocodes addresses"| node_kakao
node_customer -.->|"books a slot"| node_reservation_api
node_owner -.->|"manages slots"| node_reservation_api
node_reservation_api -->|"creates and cancels"| node_reservation_data
node_reservation_api -->|"uses serializers"| node_reservation_serializers
node_reservation_data -->|"references users"| node_users
node_reservation_data -->|"references items and slots"| node_store_catalog
node_reservation_api -->|"uses pricing helpers"| node_pricing_utils
node_pricing_utils -->|"creates item records"| node_records
node_pricing_utils -->|"reads item data"| node_store_catalog
node_pricing_jobs -->|"runs pricing logic"| node_pricing_utils
node_pricing_jobs -->|"uses parameters"| node_pricing_models
node_pricing_jobs -->|"trains from records"| node_records
node_pricing_jobs -->|"updates items"| node_store_catalog
node_account_api -->|"logs events"| node_logger
node_store_api -->|"logs events"| node_logger
node_reservation_api -->|"logs events"| node_logger

click node_account_api "https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/views.py"
click node_account_serializers "https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/serializers.py"
click node_authentication "https://github.com/dongjak-village-guards/backend/blob/main/buynow/config/authentication.py"
click node_users "https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/models.py"
click node_store_api "https://github.com/dongjak-village-guards/backend/blob/main/buynow/stores/views.py"
click node_store_catalog "https://github.com/dongjak-village-guards/backend/blob/main/buynow/stores/models.py"
click node_location "https://github.com/dongjak-village-guards/backend/blob/main/buynow/config/kakaoapi.py"
click node_reservation_api "https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/views.py"
click node_reservation_serializers "https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/serializers.py"
click node_reservation_data "https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/models.py"
click node_pricing_utils "https://github.com/dongjak-village-guards/backend/blob/main/buynow/pricing/utils.py"
click node_pricing_models "https://github.com/dongjak-village-guards/backend/blob/main/buynow/pricing/models.py"
click node_pricing_jobs "https://github.com/dongjak-village-guards/backend/tree/main/buynow/pricing/management/commands"
click node_records "https://github.com/dongjak-village-guards/backend/blob/main/buynow/records/models.py"
click node_logger "https://github.com/dongjak-village-guards/backend/blob/main/buynow/logger.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_account_api,node_account_serializers,node_authentication,node_users toneBlue
class node_store_api,node_store_catalog,node_location toneAmber
class node_reservation_api,node_reservation_serializers,node_reservation_data,node_kakao toneMint
class node_pricing_utils,node_pricing_models,node_pricing_jobs,node_records toneRose
class node_customer,node_owner,node_firebase toneIndigo
class node_logger toneTeal
```

## Components

### Accounts & Identity

- [Account API](https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/views.py): `buynow/accounts/views.py`
- [Account Serializers](https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/serializers.py): `buynow/accounts/serializers.py`
- [Firebase Token Auth](https://github.com/dongjak-village-guards/backend/blob/main/buynow/config/authentication.py): `buynow/config/authentication.py`
- [Users](https://github.com/dongjak-village-guards/backend/blob/main/buynow/accounts/models.py): `buynow/accounts/models.py`

### Store Discovery

- [Store API](https://github.com/dongjak-village-guards/backend/blob/main/buynow/stores/views.py): `buynow/stores/views.py`
- [Store Catalog & Slots](https://github.com/dongjak-village-guards/backend/blob/main/buynow/stores/models.py): `buynow/stores/models.py`
- [Location Services](https://github.com/dongjak-village-guards/backend/blob/main/buynow/config/kakaoapi.py): `buynow/config/kakaoapi.py`

### Reservations

- [Reservation API](https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/views.py): `buynow/reservations/views.py`
- [Reservation Serializers](https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/serializers.py): `buynow/reservations/serializers.py`
- [Reservations & Likes](https://github.com/dongjak-village-guards/backend/blob/main/buynow/reservations/models.py): `buynow/reservations/models.py`

### Pricing & Records

- [Pricing Utilities](https://github.com/dongjak-village-guards/backend/blob/main/buynow/pricing/utils.py): `buynow/pricing/utils.py`
- [Pricing Parameters](https://github.com/dongjak-village-guards/backend/blob/main/buynow/pricing/models.py): `buynow/pricing/models.py`
- [Pricing Jobs](https://github.com/dongjak-village-guards/backend/tree/main/buynow/pricing/management/commands): `buynow/pricing/management/commands`
- [Sales Records](https://github.com/dongjak-village-guards/backend/blob/main/buynow/records/models.py): `buynow/records/models.py`

### Other components

- **Customer**
- **Store Owner**
- **Firebase Auth**
- **Kakao Local API**
- [Application Logger](https://github.com/dongjak-village-guards/backend/blob/main/buynow/logger.py): `buynow/logger.py`

## Connections

- Customer → Account API: signs in (evidence: `buynow/accounts/views.py`)
- Store Owner → Account API: signs in (evidence: `buynow/accounts/views.py`)
- Account API → Account Serializers: validates with (evidence: `buynow/accounts/views.py`)
- Account Serializers → Users: reads and writes (evidence: `buynow/accounts/serializers.py`)
- Firebase Token Auth → Firebase Auth: verifies tokens (evidence: `buynow/config/authentication.py`)
- Firebase Token Auth → Users: creates or retrieves (evidence: `buynow/config/authentication.py`)
- Customer → Store API: browses stores
- Store Owner → Store API: manages stores
- Store API → Store Catalog & Slots: queries catalog (evidence: `buynow/stores/views.py`)
- Store API → Location Services: gets coordinates (evidence: `buynow/stores/views.py`)
- Location Services → Kakao Local API: geocodes addresses (evidence: `buynow/config/kakaoapi.py`)
- Customer → Reservation API: books a slot
- Store Owner → Reservation API: manages slots
- Reservation API → Reservations & Likes: creates and cancels (evidence: `buynow/reservations/views.py`)
- Reservation API → Reservation Serializers: uses serializers (evidence: `buynow/reservations/views.py`)
- Reservations & Likes → Users: references users (evidence: `buynow/reservations/models.py`)
- Reservations & Likes → Store Catalog & Slots: references items and slots (evidence: `buynow/reservations/models.py`)
- Reservation API → Pricing Utilities: uses pricing helpers (evidence: `buynow/reservations/views.py`)
- Pricing Utilities → Sales Records: creates item records (evidence: `buynow/pricing/utils.py`)
- Pricing Utilities → Store Catalog & Slots: reads item data (evidence: `buynow/pricing/utils.py`)
- Pricing Jobs → Pricing Utilities: runs pricing logic (evidence: `buynow/pricing/management/commands/update_discounts.py`)
- Pricing Jobs → Pricing Parameters: uses parameters (evidence: `buynow/pricing/management/commands/update_discounts.py`)
- Pricing Jobs → Sales Records: trains from records (evidence: `buynow/pricing/management/commands/train_records.py`)
- Pricing Jobs → Store Catalog & Slots: updates items (evidence: `buynow/pricing/management/commands/update_discounts.py`)
- Account API → Application Logger: logs events (evidence: `buynow/accounts/views.py`)
- Store API → Application Logger: logs events (evidence: `buynow/stores/views.py`)
- Reservation API → Application Logger: logs events (evidence: `buynow/reservations/views.py`)
