# d-coder7/quickcommerce architecture

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

- Interactive diagram: https://gitdiagram.com/d-coder7/quickcommerce
- Repository: https://github.com/d-coder7/quickcommerce

## Overview

QuickCommerce is a FastAPI commerce API. Requests enter through the application’s registered routers; the visible checkout flow coordinates cart retrieval, product lookup, stock reservation, order creation, sale confirmation, and cart clearing. The graph preserves the documented-by-code domains and core modules, but several routers, repositories, and infrastructure files were not excerpted, so their internal calls are not inferred. Redis is shown as an external service because the sampled services use it for carts and catalog caching.

Main entry points: [`app/main.py`](https://github.com/d-coder7/quickcommerce/blob/main/app/main.py) (FastAPI application), [`app/services/order.py`](https://github.com/d-coder7/quickcommerce/blob/main/app/services/order.py) (Order service), [`app/routers/inventory.py`](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/inventory.py) (Inventory routes), [`app/services/catalog.py`](https://github.com/d-coder7/quickcommerce/blob/main/app/services/catalog.py) (Catalog service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_application["FastAPI application<br/>[main.py]"]
  node_user_routes["User routes<br/>[users.py]"]
  node_catalog_routes["Catalog routes<br/>[catalog.py]"]
  node_inventory_routes["Inventory routes<br/>[inventory.py]"]
  node_cart_routes["Cart routes<br/>[cart.py]"]
  node_order_routes["Order routes<br/>[orders.py]"]
  node_health_routes["Health routes<br/>[health.py]"]
end

subgraph group_commerce["Commerce workflows"]
  node_catalog_service["Catalog service<br/>[catalog.py]"]
  node_cart_service["Cart service<br/>[cart.py]"]
  node_order_service["Order service<br/>[order.py]"]
  node_catalog_repository["Catalog repository<br/>[catalog.py]"]
  node_inventory_repository["Inventory repository<br/>[inventory.py]"]
  node_order_repository["Order repository<br/>[order.py]"]
end

subgraph group_identity["Identity"]
  node_user_service["User service<br/>[user.py]"]
  node_user_repository["User repository<br/>[user.py]"]
  node_security["Authentication<br/>[security.py]"]
end

subgraph group_data["Domain data"]
  node_catalog_models["Catalog models<br/>[catalog.py]"]
  node_inventory_models["Inventory model<br/>[inventory.py]"]
  node_order_models["Order models<br/>[order.py]"]
  node_user_models["User model<br/>[user.py]"]
end

subgraph group_platform["Platform services"]
  node_database[("Database access<br/>[database.py]")]
  node_redis_client["Redis client<br/>[redis.py]"]
  node_configuration["Configuration<br/>[config.py]"]
  node_logging["Logging<br/>[logging.py]"]
  node_request_logging["Request logging<br/>[logging.py]"]
end

node_client(("API client"))
node_redis_store[("Redis")]

node_client -->|"sends requests"| node_application
node_application -->|"registers"| node_user_routes
node_application -->|"registers"| node_catalog_routes
node_application -->|"registers"| node_inventory_routes
node_application -->|"registers"| node_cart_routes
node_application -->|"registers"| node_order_routes
node_application -->|"registers"| node_health_routes
node_application -->|"installs"| node_request_logging
node_application -->|"configures"| node_logging
node_application -->|"disposes engine"| node_database
node_application -->|"closes client"| node_redis_client
node_inventory_routes -->|"calls"| node_inventory_repository
node_inventory_routes -->|"invalidates cache"| node_catalog_service
node_inventory_routes -->|"requires admin"| node_security
node_order_service -->|"reads and clears cart"| node_cart_service
node_order_service -->|"loads products"| node_catalog_repository
node_order_service -->|"reserves stock"| node_inventory_repository
node_order_service -->|"creates order"| node_order_repository
node_cart_service -->|"loads products"| node_catalog_repository
node_cart_service -->|"checks stock"| node_inventory_repository
node_catalog_service -->|"loads catalog"| node_catalog_repository
node_catalog_service -->|"reads availability"| node_inventory_repository
node_catalog_service -->|"caches catalog"| node_redis_store
node_cart_service -->|"stores carts"| node_redis_store
node_security -->|"loads user"| node_user_repository
node_security -->|"reads token settings"| node_configuration

click node_application "https://github.com/d-coder7/quickcommerce/blob/main/app/main.py"
click node_user_routes "https://github.com/d-coder7/quickcommerce/blob/main/app/routers/users.py"
click node_catalog_routes "https://github.com/d-coder7/quickcommerce/blob/main/app/routers/catalog.py"
click node_inventory_routes "https://github.com/d-coder7/quickcommerce/blob/main/app/routers/inventory.py"
click node_cart_routes "https://github.com/d-coder7/quickcommerce/blob/main/app/routers/cart.py"
click node_order_routes "https://github.com/d-coder7/quickcommerce/blob/main/app/routers/orders.py"
click node_health_routes "https://github.com/d-coder7/quickcommerce/blob/main/app/routers/health.py"
click node_catalog_service "https://github.com/d-coder7/quickcommerce/blob/main/app/services/catalog.py"
click node_cart_service "https://github.com/d-coder7/quickcommerce/blob/main/app/services/cart.py"
click node_order_service "https://github.com/d-coder7/quickcommerce/blob/main/app/services/order.py"
click node_catalog_repository "https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/catalog.py"
click node_inventory_repository "https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/inventory.py"
click node_order_repository "https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/order.py"
click node_user_service "https://github.com/d-coder7/quickcommerce/blob/main/app/services/user.py"
click node_user_repository "https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/user.py"
click node_security "https://github.com/d-coder7/quickcommerce/blob/main/app/core/security.py"
click node_catalog_models "https://github.com/d-coder7/quickcommerce/blob/main/app/models/catalog.py"
click node_inventory_models "https://github.com/d-coder7/quickcommerce/blob/main/app/models/inventory.py"
click node_order_models "https://github.com/d-coder7/quickcommerce/blob/main/app/models/order.py"
click node_user_models "https://github.com/d-coder7/quickcommerce/blob/main/app/models/user.py"
click node_database "https://github.com/d-coder7/quickcommerce/blob/main/app/core/database.py"
click node_redis_client "https://github.com/d-coder7/quickcommerce/blob/main/app/core/redis.py"
click node_configuration "https://github.com/d-coder7/quickcommerce/blob/main/app/core/config.py"
click node_logging "https://github.com/d-coder7/quickcommerce/blob/main/app/core/logging.py"
click node_request_logging "https://github.com/d-coder7/quickcommerce/blob/main/app/middleware/logging.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_application,node_user_routes,node_catalog_routes,node_inventory_routes,node_cart_routes,node_order_routes,node_health_routes,node_client toneBlue
class node_catalog_service,node_cart_service,node_order_service,node_catalog_repository,node_inventory_repository,node_order_repository,node_redis_store toneAmber
class node_user_service,node_user_repository,node_security toneMint
class node_catalog_models,node_inventory_models,node_order_models,node_user_models toneRose
class node_database,node_redis_client,node_configuration,node_logging,node_request_logging toneIndigo
```

## Components

### API entry

- [FastAPI application](https://github.com/d-coder7/quickcommerce/blob/main/app/main.py): `app/main.py`
- [User routes](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/users.py): `app/routers/users.py`
- [Catalog routes](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/catalog.py): `app/routers/catalog.py`
- [Inventory routes](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/inventory.py): `app/routers/inventory.py`
- [Cart routes](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/cart.py): `app/routers/cart.py`
- [Order routes](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/orders.py): `app/routers/orders.py`
- [Health routes](https://github.com/d-coder7/quickcommerce/blob/main/app/routers/health.py): `app/routers/health.py`

### Commerce workflows

- [Catalog service](https://github.com/d-coder7/quickcommerce/blob/main/app/services/catalog.py): `app/services/catalog.py`
- [Cart service](https://github.com/d-coder7/quickcommerce/blob/main/app/services/cart.py): `app/services/cart.py`
- [Order service](https://github.com/d-coder7/quickcommerce/blob/main/app/services/order.py): `app/services/order.py`
- [Catalog repository](https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/catalog.py): `app/repositories/catalog.py`
- [Inventory repository](https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/inventory.py): `app/repositories/inventory.py`
- [Order repository](https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/order.py): `app/repositories/order.py`

### Identity

- [User service](https://github.com/d-coder7/quickcommerce/blob/main/app/services/user.py): `app/services/user.py`
- [User repository](https://github.com/d-coder7/quickcommerce/blob/main/app/repositories/user.py): `app/repositories/user.py`
- [Authentication](https://github.com/d-coder7/quickcommerce/blob/main/app/core/security.py): `app/core/security.py`

### Domain data

- [Catalog models](https://github.com/d-coder7/quickcommerce/blob/main/app/models/catalog.py): `app/models/catalog.py`
- [Inventory model](https://github.com/d-coder7/quickcommerce/blob/main/app/models/inventory.py): `app/models/inventory.py`
- [Order models](https://github.com/d-coder7/quickcommerce/blob/main/app/models/order.py): `app/models/order.py`
- [User model](https://github.com/d-coder7/quickcommerce/blob/main/app/models/user.py): `app/models/user.py`

### Platform services

- [Database access](https://github.com/d-coder7/quickcommerce/blob/main/app/core/database.py): `app/core/database.py`
- [Redis client](https://github.com/d-coder7/quickcommerce/blob/main/app/core/redis.py): `app/core/redis.py`
- [Configuration](https://github.com/d-coder7/quickcommerce/blob/main/app/core/config.py): `app/core/config.py`
- [Logging](https://github.com/d-coder7/quickcommerce/blob/main/app/core/logging.py): `app/core/logging.py`
- [Request logging](https://github.com/d-coder7/quickcommerce/blob/main/app/middleware/logging.py): `app/middleware/logging.py`

### Other components

- **API client**
- **Redis**

## Connections

- API client → FastAPI application: sends requests
- FastAPI application → User routes: registers (evidence: `app/main.py`)
- FastAPI application → Catalog routes: registers (evidence: `app/main.py`)
- FastAPI application → Inventory routes: registers (evidence: `app/main.py`)
- FastAPI application → Cart routes: registers (evidence: `app/main.py`)
- FastAPI application → Order routes: registers (evidence: `app/main.py`)
- FastAPI application → Health routes: registers (evidence: `app/main.py`)
- FastAPI application → Request logging: installs (evidence: `app/main.py`)
- FastAPI application → Logging: configures (evidence: `app/main.py`)
- FastAPI application → Database access: disposes engine (evidence: `app/main.py`)
- FastAPI application → Redis client: closes client (evidence: `app/main.py`)
- Inventory routes → Inventory repository: calls (evidence: `app/routers/inventory.py`)
- Inventory routes → Catalog service: invalidates cache (evidence: `app/routers/inventory.py`)
- Inventory routes → Authentication: requires admin (evidence: `app/routers/inventory.py`)
- Order service → Cart service: reads and clears cart (evidence: `app/services/order.py`)
- Order service → Catalog repository: loads products (evidence: `app/services/order.py`)
- Order service → Inventory repository: reserves stock (evidence: `app/services/order.py`)
- Order service → Order repository: creates order (evidence: `app/services/order.py`)
- Cart service → Catalog repository: loads products (evidence: `app/services/cart.py`)
- Cart service → Inventory repository: checks stock (evidence: `app/services/cart.py`)
- Catalog service → Catalog repository: loads catalog (evidence: `app/services/catalog.py`)
- Catalog service → Inventory repository: reads availability (evidence: `app/services/catalog.py`)
- Catalog service → Redis: caches catalog (evidence: `app/services/catalog.py`)
- Cart service → Redis: stores carts (evidence: `app/services/cart.py`)
- Authentication → User repository: loads user (evidence: `app/core/security.py`)
- Authentication → Configuration: reads token settings (evidence: `app/core/security.py`)
