# mystic0l/bloomin-fe architecture

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

- Interactive diagram: https://gitdiagram.com/mystic0l/bloomin-fe
- Repository: https://github.com/mystic0l/bloomin-fe

## Overview

Business Digitalizer is a two-sided platform for small shops: shopkeepers establish a storefront, maintain products and handle incoming orders, while customers discover shops, build a cart, place pickup or delivery orders and track them. The frontend’s pages use shared Zustand state; an Express API exposes shop, product and order operations backed by PostgreSQL. The README documents capabilities such as variants, QR access, payment preferences and bilingual support. Some frontend-to-API wiring is not visible in the excerpts, so those links are marked unverified.

Main entry points: [`backend/routes/orderRoutes.js`](https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/orderRoutes.js) (Order endpoints), [`src/pages/Auth.tsx`](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/Auth.tsx) (Authentication), [`src/pages/shopkeeper/Dashboard.tsx`](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/Dashboard.tsx) (Order dashboard), [`backend/config/db.js`](https://github.com/mystic0l/bloomin-fe/blob/main/backend/config/db.js) (PostgreSQL pool)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer["Customer shopping"]
  node_shops["Shop discovery<br/>[ShopList.tsx]"]
  node_storefront["Shop storefront<br/>[ShopView.tsx]"]
  node_cart["Shopping cart<br/>[Cart.tsx]"]
  node_checkout["Order checkout<br/>[Checkout.tsx]"]
  node_orders["Order history<br/>[Orders.tsx]"]
end

subgraph group_merchant["Shopkeeper operations"]
  node_setup["Shop setup<br/>[ShopSetup.tsx]"]
  node_products["Product management"]
  node_dashboard["Order dashboard<br/>[Dashboard.tsx]"]
  node_qr["QR generation<br/>[qrcode.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
end

subgraph group_frontend["Frontend foundation"]
  node_auth["Authentication<br/>[Auth.tsx]"]
  node_firebase["Firebase Auth<br/>[firebase.ts]"]
  node_home["Home page<br/>[Home.tsx]"]
  node_layout["App layout<br/>[Layout.tsx]"]
  node_guard["Role guard<br/>[ProtectedRoute.tsx]"]
  node_state["App state<br/>[index.ts]"]
  node_i18n["Translations<br/>[translations.ts]"]
  node_translation["Language hook<br/>[useTranslation.ts]"]
  node_profile["User profiles<br/>[userStorage.ts]"]
end

subgraph group_backend["API and persistence"]
  node_server["Express API<br/>[server.js]"]
  node_shopapi["Shop endpoints<br/>[shopRoutes.js]"]
  node_productapi["Product endpoints<br/>[productRoutes.js]"]
  node_orderapi["Order endpoints<br/>[orderRoutes.js]"]
  node_dbpool["PostgreSQL pool<br/>[db.js]"]
  node_database[("PostgreSQL")]
end

node_buyer(("Customer"))
node_seller(("Shopkeeper"))

node_buyer -->|"signs in"| node_auth
node_seller -->|"signs in"| node_auth
node_auth -->|"authenticates"| node_firebase
node_auth -->|"loads and saves"| node_profile
node_auth -->|"sets role"| node_state
node_buyer -->|"browses"| node_shops
node_shops -->|"opens shop"| node_storefront
node_storefront -->|"adds products"| node_cart
node_cart -->|"starts checkout"| node_checkout
node_checkout -.->|"places order"| node_orderapi
node_orderapi -->|"writes order items"| node_database
node_buyer -->|"tracks orders"| node_orders
node_orders -.->|"reads orders"| node_orderapi
node_seller -->|"sets up shop"| node_setup
node_setup -.->|"creates shop"| node_shopapi
node_seller -->|"manages products"| node_products
node_products -.->|"manages products"| node_productapi
node_seller -->|"manages orders"| node_dashboard
node_dashboard -.->|"updates status"| node_orderapi
node_dashboard -->|"generates QR"| node_qr
node_dashboard -->|"uses notifications"| node_notifications
node_home -->|"translates text"| node_translation
node_translation -->|"reads language"| node_state
node_translation -->|"looks up strings"| node_i18n
node_layout -->|"reads and updates"| node_state
node_guard -->|"checks role"| node_state
node_server -->|"routes requests"| node_shopapi
node_server -->|"routes requests"| node_productapi
node_server -->|"routes requests"| node_orderapi
node_shopapi -->|"queries"| node_dbpool
node_productapi -->|"queries"| node_dbpool
node_orderapi -->|"queries"| node_dbpool
node_dbpool -->|"connects"| node_database

click node_auth "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/Auth.tsx"
click node_firebase "https://github.com/mystic0l/bloomin-fe/blob/main/src/lib/firebase.ts"
click node_shops "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/ShopList.tsx"
click node_storefront "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/ShopView.tsx"
click node_cart "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/Cart.tsx"
click node_checkout "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/Checkout.tsx"
click node_orders "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/Orders.tsx"
click node_setup "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/ShopSetup.tsx"
click node_products "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/ProductManagement.tsx"
click node_dashboard "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/Dashboard.tsx"
click node_qr "https://github.com/mystic0l/bloomin-fe/blob/main/src/utils/qrcode.ts"
click node_notifications "https://github.com/mystic0l/bloomin-fe/blob/main/src/utils/notifications.ts"
click node_home "https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/Home.tsx"
click node_layout "https://github.com/mystic0l/bloomin-fe/blob/main/src/components/Layout.tsx"
click node_guard "https://github.com/mystic0l/bloomin-fe/blob/main/src/components/ProtectedRoute.tsx"
click node_state "https://github.com/mystic0l/bloomin-fe/blob/main/src/store/index.ts"
click node_i18n "https://github.com/mystic0l/bloomin-fe/blob/main/src/i18n/translations.ts"
click node_translation "https://github.com/mystic0l/bloomin-fe/blob/main/src/hooks/useTranslation.ts"
click node_profile "https://github.com/mystic0l/bloomin-fe/blob/main/src/utils/userStorage.ts"
click node_server "https://github.com/mystic0l/bloomin-fe/blob/main/backend/server.js"
click node_shopapi "https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/shopRoutes.js"
click node_productapi "https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/productRoutes.js"
click node_orderapi "https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/orderRoutes.js"
click node_dbpool "https://github.com/mystic0l/bloomin-fe/blob/main/backend/config/db.js"

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_shops,node_storefront,node_cart,node_checkout,node_orders toneBlue
class node_setup,node_products,node_dashboard,node_qr,node_notifications toneAmber
class node_auth,node_firebase,node_home,node_layout,node_guard,node_state,node_i18n,node_translation,node_profile toneMint
class node_server,node_shopapi,node_productapi,node_orderapi,node_dbpool,node_database toneRose
class node_buyer,node_seller toneIndigo
```

## Components

### Customer shopping

- [Shop discovery](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/ShopList.tsx): `src/pages/customer/ShopList.tsx`
- [Shop storefront](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/ShopView.tsx): `src/pages/customer/ShopView.tsx`
- [Shopping cart](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/Cart.tsx): `src/pages/customer/Cart.tsx`
- [Order checkout](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/Checkout.tsx): `src/pages/customer/Checkout.tsx`
- [Order history](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/customer/Orders.tsx): `src/pages/customer/Orders.tsx`

### Shopkeeper operations

- [Shop setup](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/ShopSetup.tsx): `src/pages/shopkeeper/ShopSetup.tsx`
- [Product management](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/ProductManagement.tsx): `src/pages/shopkeeper/ProductManagement.tsx`
- [Order dashboard](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/shopkeeper/Dashboard.tsx): `src/pages/shopkeeper/Dashboard.tsx`
- [QR generation](https://github.com/mystic0l/bloomin-fe/blob/main/src/utils/qrcode.ts): `src/utils/qrcode.ts`
- [Notifications](https://github.com/mystic0l/bloomin-fe/blob/main/src/utils/notifications.ts): `src/utils/notifications.ts`

### Frontend foundation

- [Authentication](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/Auth.tsx): `src/pages/Auth.tsx`
- [Firebase Auth](https://github.com/mystic0l/bloomin-fe/blob/main/src/lib/firebase.ts): `src/lib/firebase.ts`
- [Home page](https://github.com/mystic0l/bloomin-fe/blob/main/src/pages/Home.tsx): `src/pages/Home.tsx`
- [App layout](https://github.com/mystic0l/bloomin-fe/blob/main/src/components/Layout.tsx): `src/components/Layout.tsx`
- [Role guard](https://github.com/mystic0l/bloomin-fe/blob/main/src/components/ProtectedRoute.tsx): `src/components/ProtectedRoute.tsx`
- [App state](https://github.com/mystic0l/bloomin-fe/blob/main/src/store/index.ts): `src/store/index.ts`
- [Translations](https://github.com/mystic0l/bloomin-fe/blob/main/src/i18n/translations.ts): `src/i18n/translations.ts`
- [Language hook](https://github.com/mystic0l/bloomin-fe/blob/main/src/hooks/useTranslation.ts): `src/hooks/useTranslation.ts`
- [User profiles](https://github.com/mystic0l/bloomin-fe/blob/main/src/utils/userStorage.ts): `src/utils/userStorage.ts`

### API and persistence

- [Express API](https://github.com/mystic0l/bloomin-fe/blob/main/backend/server.js): `backend/server.js`
- [Shop endpoints](https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/shopRoutes.js): `backend/routes/shopRoutes.js`
- [Product endpoints](https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/productRoutes.js): `backend/routes/productRoutes.js`
- [Order endpoints](https://github.com/mystic0l/bloomin-fe/blob/main/backend/routes/orderRoutes.js): `backend/routes/orderRoutes.js`
- [PostgreSQL pool](https://github.com/mystic0l/bloomin-fe/blob/main/backend/config/db.js): `backend/config/db.js`
- **PostgreSQL**

### Other components

- **Customer**
- **Shopkeeper**

## Connections

- Customer → Authentication: signs in (evidence: `README.md`)
- Shopkeeper → Authentication: signs in (evidence: `README.md`)
- Authentication → Firebase Auth: authenticates (evidence: `src/pages/Auth.tsx`)
- Authentication → User profiles: loads and saves (evidence: `src/pages/Auth.tsx`)
- Authentication → App state: sets role (evidence: `src/pages/Auth.tsx`)
- Customer → Shop discovery: browses (evidence: `README.md`)
- Shop discovery → Shop storefront: opens shop (evidence: `README.md`)
- Shop storefront → Shopping cart: adds products (evidence: `README.md`)
- Shopping cart → Order checkout: starts checkout (evidence: `README.md`)
- Order checkout → Order endpoints: places order
- Order endpoints → PostgreSQL: writes order items (evidence: `backend/routes/orderRoutes.js`)
- Customer → Order history: tracks orders (evidence: `README.md`)
- Order history → Order endpoints: reads orders
- Shopkeeper → Shop setup: sets up shop (evidence: `README.md`)
- Shop setup → Shop endpoints: creates shop
- Shopkeeper → Product management: manages products (evidence: `README.md`)
- Product management → Product endpoints: manages products
- Shopkeeper → Order dashboard: manages orders (evidence: `README.md`)
- Order dashboard → Order endpoints: updates status
- Order dashboard → QR generation: generates QR (evidence: `src/pages/shopkeeper/Dashboard.tsx`)
- Order dashboard → Notifications: uses notifications (evidence: `src/pages/shopkeeper/Dashboard.tsx`)
- Home page → Language hook: translates text (evidence: `src/pages/Home.tsx`)
- Language hook → App state: reads language (evidence: `src/hooks/useTranslation.ts`)
- Language hook → Translations: looks up strings (evidence: `src/hooks/useTranslation.ts`)
- App layout → App state: reads and updates (evidence: `src/components/Layout.tsx`)
- Role guard → App state: checks role (evidence: `src/components/ProtectedRoute.tsx`)
- Express API → Shop endpoints: routes requests (evidence: `backend/server.js`)
- Express API → Product endpoints: routes requests (evidence: `backend/server.js`)
- Express API → Order endpoints: routes requests (evidence: `backend/server.js`)
- Shop endpoints → PostgreSQL pool: queries (evidence: `backend/routes/shopRoutes.js`)
- Product endpoints → PostgreSQL pool: queries (evidence: `backend/routes/productRoutes.js`)
- Order endpoints → PostgreSQL pool: queries (evidence: `backend/routes/orderRoutes.js`)
- PostgreSQL pool → PostgreSQL: connects (evidence: `backend/config/db.js`)
