# randommness/5-musketeers architecture

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

- Interactive diagram: https://gitdiagram.com/randommness/5-musketeers
- Repository: https://github.com/randommness/5-musketeers

## Overview

Pet Guardian is a pet-care shopping and customer-insights website backed by a FastAPI service. The principal workflow is browsing the catalog and retail information, placing orders, and submitting reviews; separate API capabilities provide login, customer dashboards, check-ins, goal-based recommendations, and product pairings. The backend routes requests to service modules, which query the database and, for selected insight and recommendation features, call an LLM. The README confirms the website connects to the API; source excerpts do not establish specific browser-to-route calls, so those links remain broad.

Main entry points: [`app/api.py`](https://github.com/randommness/5-musketeers/blob/main/app/api.py) (Router registry), [`app/services/llm.py`](https://github.com/randommness/5-musketeers/blob/main/app/services/llm.py) (LLM client), [`app/services/check_in_service.py`](https://github.com/randommness/5-musketeers/blob/main/app/services/check_in_service.py) (Check-in insights), [`app/services/goal_achiever_service.py`](https://github.com/randommness/5-musketeers/blob/main/app/services/goal_achiever_service.py) (Goal recommendations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Website"]
  node_site["Website pages"]
  node_webclient["API client<br/>[api.js]"]
end

subgraph group_runtime["API runtime"]
  node_entry["App entry<br/>[main.py]"]
  node_api["Router registry<br/>[api.py]"]
  node_loginroute["Login route<br/>[api_login.py]"]
  node_catalogroute["Catalog route<br/>[api_catalog.py]"]
  node_dashboardroute["Dashboard route"]
  node_retailroute["Retail routes<br/>[api_retail.py]"]
  node_orderroute["Order route<br/>[api_new_order.py]"]
  node_updateroute["Order update route"]
  node_reviewroute["Review route<br/>[api_new_review.py]"]
  node_checkinroute["Check-in route<br/>[first_check_in.py]"]
  node_goalroute["Goal route<br/>[goal_achiever.py]"]
  node_pairroute["Pairing route<br/>[product_pair.py]"]
  node_productsroute["Products route<br/>[products.py]"]
  node_healthroute["Health route<br/>[health.py]"]
end

subgraph group_commerce["Commerce services"]
  node_loginservice["Login service"]
  node_catalogservice["Catalog service"]
  node_retailservice["Retail data"]
  node_orderservice["Order creation"]
  node_updateservice["Order updates"]
  node_reviewservice["Review creation"]
end

subgraph group_insights["Insights services"]
  node_dashboardservice["Customer dashboard"]
  node_checkinservice["Check-in insights"]
  node_goalservice["Goal recommendations"]
  node_pairservice["Product pairing"]
  node_productservice["Product listing"]
end

subgraph group_infra["Data and AI"]
  node_dbsession["DB sessions<br/>[session.py]"]
  node_database[("Application database")]
  node_llmclient["LLM client<br/>[llm.py]"]
end

node_shopper(("Pet owner"))
node_llmapi{{"LLM provider"}}

node_shopper -.->|"uses"| node_site
node_site -.->|"uses"| node_webclient
node_webclient -.->|"calls API"| node_api
node_entry -->|"creates app"| node_api
node_api -->|"registers"| node_loginroute
node_api -->|"registers"| node_catalogroute
node_api -->|"registers"| node_dashboardroute
node_api -->|"registers"| node_retailroute
node_api -->|"registers"| node_orderroute
node_api -->|"registers"| node_updateroute
node_api -->|"registers"| node_reviewroute
node_api -->|"registers"| node_checkinroute
node_api -->|"registers"| node_goalroute
node_api -->|"registers"| node_pairroute
node_api -->|"registers"| node_productsroute
node_api -->|"registers"| node_healthroute
node_loginroute -->|"delegates to"| node_loginservice
node_catalogroute -->|"delegates to"| node_catalogservice
node_dashboardroute -->|"delegates to"| node_dashboardservice
node_retailroute -->|"delegates to"| node_retailservice
node_orderroute -->|"delegates to"| node_orderservice
node_updateroute -->|"delegates to"| node_updateservice
node_reviewroute -->|"delegates to"| node_reviewservice
node_checkinroute -->|"delegates to"| node_checkinservice
node_goalroute -->|"delegates to"| node_goalservice
node_pairroute -->|"delegates to"| node_pairservice
node_productsroute -->|"delegates to"| node_productservice
node_retailservice -->|"queries"| node_database
node_reviewservice -->|"writes review"| node_database
node_checkinservice -->|"reads orders"| node_database
node_goalservice -->|"reads customer data"| node_database
node_pairservice -->|"reads product data"| node_database
node_checkinservice -->|"requests text"| node_llmclient
node_goalservice -->|"requests text"| node_llmclient
node_pairservice -->|"requests pairings"| node_llmclient
node_llmclient -->|"sends prompt"| node_llmapi

click node_site "https://github.com/randommness/5-musketeers/tree/main/frontend"
click node_webclient "https://github.com/randommness/5-musketeers/blob/main/frontend/api.js"
click node_entry "https://github.com/randommness/5-musketeers/blob/main/app/main.py"
click node_api "https://github.com/randommness/5-musketeers/blob/main/app/api.py"
click node_loginroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_login.py"
click node_catalogroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_catalog.py"
click node_dashboardroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_customer_dashboard.py"
click node_retailroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_retail.py"
click node_orderroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_new_order.py"
click node_updateroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_update_order.py"
click node_reviewroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/api_new_review.py"
click node_checkinroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/first_check_in.py"
click node_goalroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/goal_achiever.py"
click node_pairroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/product_pair.py"
click node_productsroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/products.py"
click node_healthroute "https://github.com/randommness/5-musketeers/blob/main/app/routers/health.py"
click node_loginservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_login_service.py"
click node_catalogservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_catalog_service.py"
click node_retailservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_retail_services.py"
click node_orderservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_new_order_service.py"
click node_updateservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_update_order_service.py"
click node_reviewservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_new_review_service.py"
click node_dashboardservice "https://github.com/randommness/5-musketeers/blob/main/app/services/api_customer_dashboard_service.py"
click node_checkinservice "https://github.com/randommness/5-musketeers/blob/main/app/services/check_in_service.py"
click node_goalservice "https://github.com/randommness/5-musketeers/blob/main/app/services/goal_achiever_service.py"
click node_pairservice "https://github.com/randommness/5-musketeers/blob/main/app/services/product_pair_service.py"
click node_productservice "https://github.com/randommness/5-musketeers/blob/main/app/services/products_service.py"
click node_dbsession "https://github.com/randommness/5-musketeers/blob/main/app/db/session.py"
click node_llmclient "https://github.com/randommness/5-musketeers/blob/main/app/services/llm.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_site,node_webclient toneBlue
class node_entry,node_api,node_loginroute,node_catalogroute,node_dashboardroute,node_retailroute,node_orderroute,node_updateroute,node_reviewroute,node_checkinroute,node_goalroute,node_pairroute,node_productsroute,node_healthroute toneAmber
class node_loginservice,node_catalogservice,node_retailservice,node_orderservice,node_updateservice,node_reviewservice toneMint
class node_dashboardservice,node_checkinservice,node_goalservice,node_pairservice,node_productservice toneRose
class node_dbsession,node_database,node_llmclient,node_shopper,node_llmapi toneIndigo
```

## Components

### Website

- [Website pages](https://github.com/randommness/5-musketeers/tree/main/frontend): `frontend`
- [API client](https://github.com/randommness/5-musketeers/blob/main/frontend/api.js): `frontend/api.js`

### API runtime

- [App entry](https://github.com/randommness/5-musketeers/blob/main/app/main.py): `app/main.py`
- [Router registry](https://github.com/randommness/5-musketeers/blob/main/app/api.py): `app/api.py`
- [Login route](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_login.py): `app/routers/api_login.py`
- [Catalog route](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_catalog.py): `app/routers/api_catalog.py`
- [Dashboard route](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_customer_dashboard.py): `app/routers/api_customer_dashboard.py`
- [Retail routes](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_retail.py): `app/routers/api_retail.py`
- [Order route](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_new_order.py): `app/routers/api_new_order.py`
- [Order update route](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_update_order.py): `app/routers/api_update_order.py`
- [Review route](https://github.com/randommness/5-musketeers/blob/main/app/routers/api_new_review.py): `app/routers/api_new_review.py`
- [Check-in route](https://github.com/randommness/5-musketeers/blob/main/app/routers/first_check_in.py): `app/routers/first_check_in.py`
- [Goal route](https://github.com/randommness/5-musketeers/blob/main/app/routers/goal_achiever.py): `app/routers/goal_achiever.py`
- [Pairing route](https://github.com/randommness/5-musketeers/blob/main/app/routers/product_pair.py): `app/routers/product_pair.py`
- [Products route](https://github.com/randommness/5-musketeers/blob/main/app/routers/products.py): `app/routers/products.py`
- [Health route](https://github.com/randommness/5-musketeers/blob/main/app/routers/health.py): `app/routers/health.py`

### Commerce services

- [Login service](https://github.com/randommness/5-musketeers/blob/main/app/services/api_login_service.py): `app/services/api_login_service.py`
- [Catalog service](https://github.com/randommness/5-musketeers/blob/main/app/services/api_catalog_service.py): `app/services/api_catalog_service.py`
- [Retail data](https://github.com/randommness/5-musketeers/blob/main/app/services/api_retail_services.py): `app/services/api_retail_services.py`
- [Order creation](https://github.com/randommness/5-musketeers/blob/main/app/services/api_new_order_service.py): `app/services/api_new_order_service.py`
- [Order updates](https://github.com/randommness/5-musketeers/blob/main/app/services/api_update_order_service.py): `app/services/api_update_order_service.py`
- [Review creation](https://github.com/randommness/5-musketeers/blob/main/app/services/api_new_review_service.py): `app/services/api_new_review_service.py`

### Insights services

- [Customer dashboard](https://github.com/randommness/5-musketeers/blob/main/app/services/api_customer_dashboard_service.py): `app/services/api_customer_dashboard_service.py`
- [Check-in insights](https://github.com/randommness/5-musketeers/blob/main/app/services/check_in_service.py): `app/services/check_in_service.py`
- [Goal recommendations](https://github.com/randommness/5-musketeers/blob/main/app/services/goal_achiever_service.py): `app/services/goal_achiever_service.py`
- [Product pairing](https://github.com/randommness/5-musketeers/blob/main/app/services/product_pair_service.py): `app/services/product_pair_service.py`
- [Product listing](https://github.com/randommness/5-musketeers/blob/main/app/services/products_service.py): `app/services/products_service.py`

### Data and AI

- [DB sessions](https://github.com/randommness/5-musketeers/blob/main/app/db/session.py): `app/db/session.py`
- **Application database**
- [LLM client](https://github.com/randommness/5-musketeers/blob/main/app/services/llm.py): `app/services/llm.py`

### Other components

- **Pet owner**
- **LLM provider**

## Connections

- Pet owner → Website pages: uses (evidence: `README.md`)
- Website pages → API client: uses
- API client → Router registry: calls API (evidence: `README.md`)
- App entry → Router registry: creates app (evidence: `app/main.py`)
- Router registry → Login route: registers (evidence: `app/api.py`)
- Router registry → Catalog route: registers (evidence: `app/api.py`)
- Router registry → Dashboard route: registers (evidence: `app/api.py`)
- Router registry → Retail routes: registers (evidence: `app/api.py`)
- Router registry → Order route: registers (evidence: `app/api.py`)
- Router registry → Order update route: registers (evidence: `app/api.py`)
- Router registry → Review route: registers (evidence: `app/api.py`)
- Router registry → Check-in route: registers (evidence: `app/api.py`)
- Router registry → Goal route: registers (evidence: `app/api.py`)
- Router registry → Pairing route: registers (evidence: `app/api.py`)
- Router registry → Products route: registers (evidence: `app/api.py`)
- Router registry → Health route: registers (evidence: `app/api.py`)
- Login route → Login service: delegates to (evidence: `app/routers/api_login.py`)
- Catalog route → Catalog service: delegates to (evidence: `app/routers/api_catalog.py`)
- Dashboard route → Customer dashboard: delegates to (evidence: `app/routers/api_customer_dashboard.py`)
- Retail routes → Retail data: delegates to (evidence: `app/routers/api_retail.py`)
- Order route → Order creation: delegates to (evidence: `app/routers/api_new_order.py`)
- Order update route → Order updates: delegates to (evidence: `app/routers/api_update_order.py`)
- Review route → Review creation: delegates to (evidence: `app/routers/api_new_review.py`)
- Check-in route → Check-in insights: delegates to (evidence: `app/routers/first_check_in.py`)
- Goal route → Goal recommendations: delegates to (evidence: `app/routers/goal_achiever.py`)
- Pairing route → Product pairing: delegates to (evidence: `app/routers/product_pair.py`)
- Products route → Product listing: delegates to (evidence: `app/routers/products.py`)
- Retail data → Application database: queries (evidence: `app/services/api_retail_services.py`)
- Review creation → Application database: writes review (evidence: `app/services/api_new_review_service.py`)
- Check-in insights → Application database: reads orders (evidence: `app/services/check_in_service.py`)
- Goal recommendations → Application database: reads customer data (evidence: `app/services/goal_achiever_service.py`)
- Product pairing → Application database: reads product data (evidence: `app/services/product_pair_service.py`)
- Check-in insights → LLM client: requests text (evidence: `app/services/check_in_service.py`)
- Goal recommendations → LLM client: requests text (evidence: `app/services/goal_achiever_service.py`)
- Product pairing → LLM client: requests pairings (evidence: `app/services/product_pair_service.py`)
- LLM client → LLM provider: sends prompt (evidence: `app/services/llm.py`)
