# hasanawas/scent-drip architecture

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

- Interactive diagram: https://gitdiagram.com/hasanawas/scent-drip
- Repository: https://github.com/hasanawas/scent-drip

## Overview

Scent Drip is a perfume storefront with an admin dashboard. Customers browse and filter stock, get note-based recommendations, build a bag, then place a cash-on-delivery order or start Stripe checkout; Stripe’s webhook updates payment state. Admins sign in to manage perfumes, inventory, and order statuses, with live order alerts. The browser uses Supabase for data, auth, and image storage; Cloudflare serves the site and payment endpoints. The README documents Resend order emails and optional Telegram alerts, but their implementation is not sampled, so those links are documented rather than source-verified.

Main entry points: [`js/shop.js`](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/shop.js) (Shop and cart), [`js/admin.js`](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/admin.js) (Admin dashboard), [`functions/api/checkout.js`](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/functions/api/checkout.js) (Checkout endpoint), [`js/chatbot.js`](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/chatbot.js) (Scent recommender)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Customer storefront"]
  node_shop["Shop and cart<br/>[shop.js]"]
  node_recommendations["Scent recommender<br/>[chatbot.js]"]
  node_fragrance_catalog["Fragrance catalog<br/>[notes-data.js]"]
  node_storefront_page["Storefront page<br/>[index.html]"]
end

subgraph group_admin["Admin operations"]
  node_admin_dashboard["Admin dashboard<br/>[admin.js]"]
  node_admin_page["Admin page<br/>[admin.html]"]
  node_order_alerts["Order alerts<br/>[admin.js]"]
end

subgraph group_payments["Payment services"]
  node_checkout_api["Checkout endpoint<br/>[checkout.js]"]
  node_stripe["Stripe checkout"]
  node_webhook_route["Webhook route<br/>[worker.js]"]
  node_stripe_webhook["Stripe webhook handler<br/>[stripe-webhook.js]"]
  node_resend["Resend email"]
  node_telegram["Telegram alerts"]
end

subgraph group_platform["Data and hosting"]
  node_common["Shared browser setup<br/>[common.js]"]
  node_config["App configuration<br/>[config.js]"]
  node_worker["Cloudflare Worker<br/>[worker.js]"]
  node_supabase[("Supabase")]
  node_database_schema["Database rules<br/>[schema.sql]"]
  node_image_storage[("Product photo storage")]
end

node_customer(("Customer"))
node_admin_user(("Admin"))
node_email_inbox(("Order inbox"))

node_customer -->|"visits"| node_storefront_page
node_storefront_page -->|"loads"| node_shop
node_shop -->|"reads stock"| node_supabase
node_shop -->|"starts card checkout"| node_checkout_api
node_shop -->|"places COD orders"| node_supabase
node_storefront_page -->|"offers guidance"| node_recommendations
node_recommendations -->|"matches notes"| node_fragrance_catalog
node_recommendations -->|"adds or views"| node_shop
node_admin_user -->|"opens"| node_admin_page
node_admin_page -->|"loads"| node_admin_dashboard
node_admin_dashboard -->|"auth and manages"| node_supabase
node_admin_dashboard -->|"uploads photos"| node_image_storage
node_admin_dashboard -->|"subscribes"| node_order_alerts
node_order_alerts -->|"notifies"| node_admin_user
node_common -->|"reads settings"| node_config
node_common -->|"creates client"| node_supabase
node_database_schema -->|"defines rules"| node_supabase
node_checkout_api -->|"creates order"| node_supabase
node_checkout_api -->|"creates session"| node_stripe
node_stripe -->|"sends events"| node_stripe_webhook
node_worker -->|"routes checkout"| node_checkout_api
node_worker -->|"routes webhook"| node_webhook_route
node_webhook_route -->|"dispatches"| node_stripe_webhook
node_stripe_webhook -->|"updates payment"| node_supabase
node_supabase -.->|"triggers order email"| node_resend
node_resend -->|"delivers email"| node_email_inbox
node_supabase -.->|"optional alert"| node_telegram

click node_shop "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/shop.js"
click node_recommendations "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/chatbot.js"
click node_fragrance_catalog "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/notes-data.js"
click node_storefront_page "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/index.html"
click node_admin_dashboard "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/admin.js"
click node_admin_page "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/admin.html"
click node_order_alerts "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/admin.js"
click node_checkout_api "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/functions/api/checkout.js"
click node_webhook_route "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/worker.js"
click node_stripe_webhook "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/functions/api/stripe-webhook.js"
click node_common "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/common.js"
click node_config "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/config.js"
click node_worker "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/worker.js"
click node_database_schema "https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/supabase/schema.sql"

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_shop,node_recommendations,node_fragrance_catalog,node_storefront_page toneBlue
class node_admin_dashboard,node_admin_page,node_order_alerts toneAmber
class node_checkout_api,node_stripe,node_webhook_route,node_stripe_webhook,node_resend,node_telegram toneMint
class node_common,node_config,node_worker,node_supabase,node_database_schema,node_image_storage toneRose
class node_customer,node_admin_user,node_email_inbox toneIndigo
```

## Components

### Customer storefront

- [Shop and cart](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/shop.js): `js/shop.js`
- [Scent recommender](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/chatbot.js): `js/chatbot.js`
- [Fragrance catalog](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/notes-data.js): `js/notes-data.js`
- [Storefront page](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/index.html): `index.html`

### Admin operations

- [Admin dashboard](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/admin.js): `js/admin.js`
- [Admin page](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/admin.html): `admin.html`
- [Order alerts](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/admin.js): `js/admin.js`

### Payment services

- [Checkout endpoint](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/functions/api/checkout.js): `functions/api/checkout.js`
- **Stripe checkout**
- [Webhook route](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/worker.js): `worker.js`
- [Stripe webhook handler](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/functions/api/stripe-webhook.js): `functions/api/stripe-webhook.js`
- **Resend email**
- **Telegram alerts**

### Data and hosting

- [Shared browser setup](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/common.js): `js/common.js`
- [App configuration](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/js/config.js): `js/config.js`
- [Cloudflare Worker](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/worker.js): `worker.js`
- **Supabase**
- [Database rules](https://github.com/hasanawas/scent-drip/blob/fistwebapp/scentdrip/supabase/schema.sql): `supabase/schema.sql`
- **Product photo storage**

### Other components

- **Customer**
- **Admin**
- **Order inbox**

## Connections

- Customer → Storefront page: visits (evidence: `README.md`)
- Storefront page → Shop and cart: loads (evidence: `README.md`)
- Shop and cart → Supabase: reads stock (evidence: `README.md`)
- Shop and cart → Checkout endpoint: starts card checkout (evidence: `js/shop.js`)
- Shop and cart → Supabase: places COD orders (evidence: `README.md`)
- Storefront page → Scent recommender: offers guidance (evidence: `README.md`)
- Scent recommender → Fragrance catalog: matches notes (evidence: `js/chatbot.js`)
- Scent recommender → Shop and cart: adds or views (evidence: `js/chatbot.js`)
- Admin → Admin page: opens (evidence: `README.md`)
- Admin page → Admin dashboard: loads (evidence: `README.md`)
- Admin dashboard → Supabase: auth and manages (evidence: `js/admin.js`)
- Admin dashboard → Product photo storage: uploads photos (evidence: `README.md`)
- Admin dashboard → Order alerts: subscribes (evidence: `js/admin.js`)
- Order alerts → Admin: notifies (evidence: `README.md`)
- Shared browser setup → App configuration: reads settings (evidence: `js/common.js`)
- Shared browser setup → Supabase: creates client (evidence: `js/common.js`)
- Database rules → Supabase: defines rules (evidence: `README.md`)
- Checkout endpoint → Supabase: creates order (evidence: `functions/api/checkout.js`)
- Checkout endpoint → Stripe checkout: creates session (evidence: `functions/api/checkout.js`)
- Stripe checkout → Stripe webhook handler: sends events (evidence: `README.md`)
- Cloudflare Worker → Checkout endpoint: routes checkout (evidence: `worker.js`)
- Cloudflare Worker → Webhook route: routes webhook (evidence: `worker.js`)
- Webhook route → Stripe webhook handler: dispatches (evidence: `worker.js`)
- Stripe webhook handler → Supabase: updates payment (evidence: `functions/api/stripe-webhook.js`)
- Supabase → Resend email: triggers order email (evidence: `README.md`)
- Resend email → Order inbox: delivers email (evidence: `README.md`)
- Supabase → Telegram alerts: optional alert (evidence: `README.md`)
