# erriswheel/botaniquehost architecture

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

- Interactive diagram: https://gitdiagram.com/erriswheel/botaniquehost
- Repository: https://github.com/erriswheel/botaniquehost

## Overview

Botanique is an online botanical-products storefront with an Angular/Ionic client and an Express API. Customers browse the catalog, authenticate, place orders, pay through Maya, and track order status; the backend also supports account, review, notification, and admin workflows. The graph follows documented routes and sampled calls, plus the SOURCE INDEX import references. Unsampled route internals and several client pages are represented as subsystem nodes, so uncertain internal calls are omitted.

Main entry points: [`backend/src/server.ts`](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/server.ts) (Express API), [`src/app/app.routes.ts`](https://github.com/erriswheel/botaniquehost/blob/main/src/app/app.routes.ts) (Client routes), [`src/app/shared/product-catalog.service.ts`](https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/product-catalog.service.ts) (Catalog service), [`backend/src/middleware/auth.ts`](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/middleware/auth.ts) (Token and role checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_routes["Client routes<br/>[app.routes.ts]"]
  node_catalogui["Catalog browsing<br/>[product.page.ts]"]
  node_productdetail["Product details"]
  node_catalogservice["Catalog service"]
  node_catalogdata["Product data<br/>[product-data.ts]"]
  node_productroutes["Product API<br/>[products.ts]"]
  node_reviews["Reviews<br/>[reviews.ts]"]
end

subgraph group_identity["Identity"]
  node_authclient["Client authentication<br/>[auth.service.ts]"]
  node_authpages["Sign-in and signup<br/>[login.page.ts]"]
  node_authroutes["Auth routes<br/>[auth.ts]"]
  node_authmiddleware["Token and role checks<br/>[auth.ts]"]
  node_firebase["Firebase verification<br/>[firebase.ts]"]
  node_users["User profiles<br/>[users.ts]"]
end

subgraph group_commerce["Commerce"]
  node_checkout["Checkout<br/>[checkout.page.ts]"]
  node_orderhistory["Profile and orders<br/>[profile.page.ts]"]
  node_tracking["Order tracking"]
  node_ordersclient["Orders client service<br/>[orders.service.ts]"]
  node_commerceapi["Cart and wishlist API<br/>[cart.ts]"]
  node_ordersapi["Order API<br/>[orders.ts]"]
  node_orderpayments["Payment orchestration<br/>[orderPayments.ts]"]
  node_maya["Maya gateway<br/>[maya.ts]"]
end

subgraph group_operations["Operations"]
  node_adminui["Admin console<br/>[admin.page.ts]"]
  node_otherfeatures["Support and content APIs<br/>[support.ts]"]
  node_adminapi["Admin API<br/>[admin.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

subgraph group_platform["API platform"]
  node_apiclient["Authenticated API client<br/>[api.service.ts]"]
  node_api["Express API<br/>[server.ts]"]
  node_database[("Application database<br/>[db.ts]")]
  node_config["Runtime configuration<br/>[config.ts]"]
end

node_customer(("Customer"))
node_paymentprovider["Maya payments"]

node_customer -->|"uses storefront"| node_routes
node_routes -->|"routes to"| node_catalogui
node_routes -->|"routes to"| node_productdetail
node_routes -->|"routes to"| node_checkout
node_routes -->|"routes to"| node_orderhistory
node_routes -->|"routes to"| node_tracking
node_routes -->|"routes to"| node_adminui
node_catalogui -->|"loads catalog"| node_catalogservice
node_productdetail -->|"loads product"| node_catalogservice
node_catalogservice -->|"maps products"| node_catalogdata
node_catalogservice -->|"fetches catalog"| node_productroutes
node_authpages -.->|"authenticates"| node_authclient
node_checkout -->|"uses session"| node_authclient
node_checkout -->|"loads catalog"| node_catalogservice
node_checkout -->|"loads orders"| node_ordersclient
node_orderhistory -->|"uses session"| node_authclient
node_orderhistory -->|"loads orders"| node_ordersclient
node_tracking -->|"loads order"| node_ordersclient
node_ordersclient -->|"requests orders"| node_apiclient
node_apiclient -->|"gets token"| node_authclient
node_apiclient -->|"sends API requests"| node_api
node_adminui -->|"calls API"| node_apiclient
node_api -->|"mounts routes"| node_authroutes
node_api -->|"mounts routes"| node_productroutes
node_api -->|"mounts routes"| node_commerceapi
node_api -->|"mounts routes"| node_ordersapi
node_api -->|"mounts routes"| node_reviews
node_api -->|"mounts routes"| node_otherfeatures
node_api -->|"mounts routes"| node_adminapi
node_authclient -.->|"syncs profile"| node_authroutes
node_authmiddleware -->|"verifies token"| node_firebase
node_authmiddleware -->|"resolves user"| node_users
node_authroutes -->|"uses auth checks"| node_authmiddleware
node_ordersapi -->|"guards requests"| node_authmiddleware
node_reviews -->|"guards requests"| node_authmiddleware
node_ordersapi -.->|"delegates payments"| node_orderpayments
node_orderpayments -->|"creates checkout"| node_maya
node_maya -.->|"calls gateway"| node_paymentprovider
node_orderpayments -->|"notifies status"| node_notifications
node_productroutes -.->|"reads products"| node_database
node_ordersapi -->|"reads and writes"| node_database
node_reviews -->|"reads and writes"| node_database
node_users -->|"reads profiles"| node_database
node_api -->|"configures server"| node_config
node_maya -->|"uses credentials"| node_config
node_orderpayments -->|"updates payments"| node_database

click node_routes "https://github.com/erriswheel/botaniquehost/blob/main/src/app/app.routes.ts"
click node_catalogui "https://github.com/erriswheel/botaniquehost/blob/main/src/app/product/product.page.ts"
click node_productdetail "https://github.com/erriswheel/botaniquehost/blob/main/src/app/product-detail/product-detail.page.ts"
click node_catalogservice "https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/product-catalog.service.ts"
click node_catalogdata "https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/product-data.ts"
click node_checkout "https://github.com/erriswheel/botaniquehost/blob/main/src/app/checkout/checkout.page.ts"
click node_orderhistory "https://github.com/erriswheel/botaniquehost/blob/main/src/app/profile/profile.page.ts"
click node_tracking "https://github.com/erriswheel/botaniquehost/blob/main/src/app/track-order/track-order.page.ts"
click node_ordersclient "https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/orders.service.ts"
click node_authclient "https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/auth.service.ts"
click node_authpages "https://github.com/erriswheel/botaniquehost/blob/main/src/app/login/login.page.ts"
click node_adminui "https://github.com/erriswheel/botaniquehost/blob/main/src/app/admin/admin.page.ts"
click node_apiclient "https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/api.service.ts"
click node_api "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/server.ts"
click node_authroutes "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/auth.ts"
click node_authmiddleware "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/middleware/auth.ts"
click node_firebase "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/firebase.ts"
click node_users "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/users.ts"
click node_productroutes "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/products.ts"
click node_commerceapi "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/cart.ts"
click node_ordersapi "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/orders.ts"
click node_orderpayments "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/orderPayments.ts"
click node_maya "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/maya.ts"
click node_reviews "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/reviews.ts"
click node_otherfeatures "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/support.ts"
click node_adminapi "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/admin.ts"
click node_notifications "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/notifications.ts"
click node_database "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/db.ts"
click node_config "https://github.com/erriswheel/botaniquehost/blob/main/backend/src/config.ts"

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_routes,node_catalogui,node_productdetail,node_catalogservice,node_catalogdata,node_productroutes,node_reviews toneBlue
class node_authclient,node_authpages,node_authroutes,node_authmiddleware,node_firebase,node_users toneAmber
class node_checkout,node_orderhistory,node_tracking,node_ordersclient,node_commerceapi,node_ordersapi,node_orderpayments,node_maya toneMint
class node_adminui,node_otherfeatures,node_adminapi,node_notifications toneRose
class node_apiclient,node_api,node_database,node_config,node_customer,node_paymentprovider toneIndigo
```

## Components

### Storefront

- [Client routes](https://github.com/erriswheel/botaniquehost/blob/main/src/app/app.routes.ts): `src/app/app.routes.ts`
- [Catalog browsing](https://github.com/erriswheel/botaniquehost/blob/main/src/app/product/product.page.ts): `src/app/product/product.page.ts`
- [Product details](https://github.com/erriswheel/botaniquehost/blob/main/src/app/product-detail/product-detail.page.ts): `src/app/product-detail/product-detail.page.ts`
- [Catalog service](https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/product-catalog.service.ts): `src/app/shared/product-catalog.service.ts`
- [Product data](https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/product-data.ts): `src/app/shared/product-data.ts`
- [Product API](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/products.ts): `backend/src/routes/products.ts`
- [Reviews](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/reviews.ts): `backend/src/routes/reviews.ts`

### Identity

- [Client authentication](https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/auth.service.ts): `src/app/shared/auth.service.ts`
- [Sign-in and signup](https://github.com/erriswheel/botaniquehost/blob/main/src/app/login/login.page.ts): `src/app/login/login.page.ts`
- [Auth routes](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/auth.ts): `backend/src/routes/auth.ts`
- [Token and role checks](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/middleware/auth.ts): `backend/src/middleware/auth.ts`
- [Firebase verification](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/firebase.ts): `backend/src/services/firebase.ts`
- [User profiles](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/users.ts): `backend/src/services/users.ts`

### Commerce

- [Checkout](https://github.com/erriswheel/botaniquehost/blob/main/src/app/checkout/checkout.page.ts): `src/app/checkout/checkout.page.ts`
- [Profile and orders](https://github.com/erriswheel/botaniquehost/blob/main/src/app/profile/profile.page.ts): `src/app/profile/profile.page.ts`
- [Order tracking](https://github.com/erriswheel/botaniquehost/blob/main/src/app/track-order/track-order.page.ts): `src/app/track-order/track-order.page.ts`
- [Orders client service](https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/orders.service.ts): `src/app/shared/orders.service.ts`
- [Cart and wishlist API](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/cart.ts): `backend/src/routes/cart.ts`
- [Order API](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/orders.ts): `backend/src/routes/orders.ts`
- [Payment orchestration](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/orderPayments.ts): `backend/src/services/orderPayments.ts`
- [Maya gateway](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/maya.ts): `backend/src/services/maya.ts`

### Operations

- [Admin console](https://github.com/erriswheel/botaniquehost/blob/main/src/app/admin/admin.page.ts): `src/app/admin/admin.page.ts`
- [Support and content APIs](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/support.ts): `backend/src/routes/support.ts`
- [Admin API](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/routes/admin.ts): `backend/src/routes/admin.ts`
- [Notifications](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/services/notifications.ts): `backend/src/services/notifications.ts`

### API platform

- [Authenticated API client](https://github.com/erriswheel/botaniquehost/blob/main/src/app/shared/api.service.ts): `src/app/shared/api.service.ts`
- [Express API](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Application database](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/db.ts): `backend/src/db.ts`
- [Runtime configuration](https://github.com/erriswheel/botaniquehost/blob/main/backend/src/config.ts): `backend/src/config.ts`

### Other components

- **Customer**
- **Maya payments**

## Connections

- Customer → Client routes: uses storefront (evidence: `src/app/app.routes.ts`)
- Client routes → Catalog browsing: routes to (evidence: `src/app/app.routes.ts`)
- Client routes → Product details: routes to (evidence: `src/app/app.routes.ts`)
- Client routes → Checkout: routes to (evidence: `src/app/app.routes.ts`)
- Client routes → Profile and orders: routes to (evidence: `src/app/app.routes.ts`)
- Client routes → Order tracking: routes to (evidence: `src/app/app.routes.ts`)
- Client routes → Admin console: routes to (evidence: `src/app/app.routes.ts`)
- Catalog browsing → Catalog service: loads catalog (evidence: `src/app/product/product.page.ts`)
- Product details → Catalog service: loads product (evidence: `src/app/product-detail/product-detail.page.ts`)
- Catalog service → Product data: maps products (evidence: `src/app/shared/product-catalog.service.ts`)
- Catalog service → Product API: fetches catalog (evidence: `src/app/shared/product-catalog.service.ts`)
- Sign-in and signup → Client authentication: authenticates
- Checkout → Client authentication: uses session (evidence: `src/app/checkout/checkout.page.ts`)
- Checkout → Catalog service: loads catalog (evidence: `src/app/checkout/checkout.page.ts`)
- Checkout → Orders client service: loads orders (evidence: `src/app/checkout/checkout.page.ts`)
- Profile and orders → Client authentication: uses session (evidence: `src/app/profile/profile.page.ts`)
- Profile and orders → Orders client service: loads orders (evidence: `src/app/profile/profile.page.ts`)
- Order tracking → Orders client service: loads order (evidence: `src/app/track-order/track-order.page.ts`)
- Orders client service → Authenticated API client: requests orders (evidence: `src/app/shared/orders.service.ts`)
- Authenticated API client → Client authentication: gets token (evidence: `src/app/shared/api.service.ts`)
- Authenticated API client → Express API: sends API requests (evidence: `src/app/shared/api.service.ts`)
- Admin console → Authenticated API client: calls API (evidence: `src/app/admin/admin.page.ts`)
- Express API → Auth routes: mounts routes (evidence: `backend/src/server.ts`)
- Express API → Product API: mounts routes (evidence: `backend/src/server.ts`)
- Express API → Cart and wishlist API: mounts routes (evidence: `backend/src/server.ts`)
- Express API → Order API: mounts routes (evidence: `backend/src/server.ts`)
- Express API → Reviews: mounts routes (evidence: `backend/src/server.ts`)
- Express API → Support and content APIs: mounts routes (evidence: `backend/src/server.ts`)
- Express API → Admin API: mounts routes (evidence: `backend/src/server.ts`)
- Client authentication → Auth routes: syncs profile
- Token and role checks → Firebase verification: verifies token (evidence: `backend/src/middleware/auth.ts`)
- Token and role checks → User profiles: resolves user (evidence: `backend/src/middleware/auth.ts`)
- Auth routes → Token and role checks: uses auth checks (evidence: `backend/src/routes/auth.ts`)
- Order API → Token and role checks: guards requests (evidence: `backend/src/routes/orders.ts`)
- Reviews → Token and role checks: guards requests (evidence: `backend/src/routes/reviews.ts`)
- Order API → Payment orchestration: delegates payments
- Payment orchestration → Maya gateway: creates checkout (evidence: `backend/src/services/orderPayments.ts`)
- Maya gateway → Maya payments: calls gateway
- Payment orchestration → Notifications: notifies status (evidence: `backend/src/services/orderPayments.ts`)
- Product API → Application database: reads products
- Order API → Application database: reads and writes (evidence: `backend/src/routes/orders.ts`)
- Reviews → Application database: reads and writes (evidence: `backend/src/routes/reviews.ts`)
- User profiles → Application database: reads profiles (evidence: `backend/src/services/users.ts`)
- Express API → Runtime configuration: configures server (evidence: `backend/src/server.ts`)
- Maya gateway → Runtime configuration: uses credentials (evidence: `backend/src/services/maya.ts`)
- Payment orchestration → Application database: updates payments (evidence: `backend/src/services/orderPayments.ts`)
