# dakshchaudhary2668/galaxy-tools-hub architecture

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

- Interactive diagram: https://gitdiagram.com/dakshchaudhary2668/galaxy-tools-hub
- Repository: https://github.com/dakshchaudhary2668/galaxy-tools-hub

## Overview

Galaxy Tools Hub is an industrial e-commerce platform. Shoppers browse products, build a cart, and check out; the API validates pricing and stock, creates an order, reserves inventory, and coordinates payment. Administrators manage the catalog and product images, while the README also documents authentication, RBAC, and a broader set of operational domains. The graph combines documented architecture with relationships visible in sampled source and the SOURCE INDEX; unsampled feature internals and some frontend-to-API calls are not expanded.

Main entry points: [`apps/server/src/controllers/payment.controller.ts`](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/payment.controller.ts) (Checkout and payment), [`apps/server/src/routes/product.routes.ts`](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/routes/product.routes.ts) (Product routes), [`apps/server/src/routes/index.ts`](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/routes/index.ts) (API routes), [`apps/server/src/services/order.service.ts`](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/order.service.ts) (Order lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web storefront"]
  node_storefront["Storefront pages<br/>[page.tsx]"]
  node_catalog_ui["Catalog browsing<br/>[page.tsx]"]
  node_cart["Cart state<br/>[useCartStore.ts]"]
  node_checkout_ui["Checkout UI<br/>[page.tsx]"]
  node_web_services["Web API services<br/>[api.ts]"]
  node_auth_ui["Customer and admin access<br/>[AuthContext.tsx]"]
end

subgraph group_api["API request layer"]
  node_api_server["Express API<br/>[server.ts]"]
  node_api_routes["API routes<br/>[index.ts]"]
  node_auth["Authentication and RBAC<br/>[auth.middleware.ts]"]
  node_product_routes["Product routes<br/>[product.routes.ts]"]
  node_other_domains["Other API domains"]
end

subgraph group_commerce["Commerce services"]
  node_checkout_controller["Checkout and payment"]
  node_pricing["Checkout pricing<br/>[payment.service.ts]"]
  node_orders["Order lifecycle<br/>[order.service.ts]"]
  node_inventory["Inventory reservations"]
  node_payment_finalize["Payment finalization"]
end

subgraph group_catalog["Catalog management"]
  node_product_controller["Product handling"]
  node_product_repo["Product persistence"]
  node_storage_controller["Image upload handling"]
  node_storage_repo["Object storage access"]
end

subgraph group_platform["Platform services"]
end

node_shopper(("Shopper"))
node_admin(("Administrator"))
node_razorpay["Razorpay"]
node_supabase[("Supabase database and storage")]

node_shopper -->|"browses"| node_storefront
node_storefront -.->|"opens catalog"| node_catalog_ui
node_shopper -->|"browses"| node_catalog_ui
node_shopper -.->|"adds items"| node_cart
node_cart -->|"provides cart"| node_checkout_ui
node_shopper -->|"checks out"| node_checkout_ui
node_checkout_ui -->|"requests payment"| node_web_services
node_web_services -->|"HTTP requests"| node_api_server
node_api_server -->|"mounts routes"| node_api_routes
node_api_routes -.->|"dispatches"| node_product_routes
node_product_routes -->|"routes requests"| node_product_controller
node_product_routes -->|"guards admin routes"| node_auth
node_admin -->|"manages catalog"| node_product_routes
node_product_controller -->|"queries catalog"| node_product_repo
node_product_repo -->|"reads and writes"| node_supabase
node_storage_controller -->|"checks product"| node_product_repo
node_storage_controller -->|"requests upload URL"| node_storage_repo
node_storage_repo -->|"uses storage"| node_supabase
node_checkout_controller -->|"calculates checkout"| node_pricing
node_checkout_controller -->|"creates order"| node_orders
node_checkout_controller -->|"reserves stock"| node_inventory
node_checkout_controller -->|"creates payment order"| node_razorpay
node_checkout_controller -->|"finalizes payment"| node_payment_finalize
node_orders -->|"reserves or releases"| node_inventory
node_orders -.->|"persists orders"| node_supabase
node_payment_finalize -->|"updates payment state"| node_supabase
node_payment_finalize -.->|"verifies payment"| node_razorpay
node_api_routes -.->|"routes requests"| node_other_domains
node_shopper -->|"signs in"| node_auth_ui
node_admin -->|"signs in"| node_auth_ui

click node_storefront "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/app/page.tsx"
click node_catalog_ui "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/app/products/page.tsx"
click node_cart "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/store/useCartStore.ts"
click node_checkout_ui "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/app/checkout/page.tsx"
click node_web_services "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/services/api.ts"
click node_api_server "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/server.ts"
click node_api_routes "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/routes/index.ts"
click node_auth "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/middlewares/auth.middleware.ts"
click node_product_routes "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/routes/product.routes.ts"
click node_product_controller "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/product.controller.ts"
click node_product_repo "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/repositories/product.repository.ts"
click node_storage_controller "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/storage.controller.ts"
click node_storage_repo "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/repositories/storage.repository.ts"
click node_checkout_controller "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/payment.controller.ts"
click node_pricing "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/payment.service.ts"
click node_orders "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/order.service.ts"
click node_inventory "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/inventory.service.ts"
click node_payment_finalize "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/payment-finalization.service.ts"
click node_other_domains "https://github.com/dakshchaudhary2668/galaxy-tools-hub/tree/main/apps/server/src/routes"
click node_auth_ui "https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/contexts/AuthContext.tsx"

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_storefront,node_catalog_ui,node_cart,node_checkout_ui,node_web_services,node_auth_ui toneBlue
class node_api_server,node_api_routes,node_auth,node_product_routes,node_other_domains,node_supabase toneAmber
class node_checkout_controller,node_pricing,node_orders,node_inventory,node_payment_finalize toneMint
class node_product_controller,node_product_repo,node_storage_controller,node_storage_repo toneRose
class node_shopper,node_admin,node_razorpay toneIndigo
```

## Components

### Web storefront

- [Storefront pages](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/app/page.tsx): `apps/web/src/app/page.tsx`
- [Catalog browsing](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/app/products/page.tsx): `apps/web/src/app/products/page.tsx`
- [Cart state](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/store/useCartStore.ts): `apps/web/src/store/useCartStore.ts`
- [Checkout UI](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/app/checkout/page.tsx): `apps/web/src/app/checkout/page.tsx`
- [Web API services](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/services/api.ts): `apps/web/src/services/api.ts`
- [Customer and admin access](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/web/src/contexts/AuthContext.tsx): `apps/web/src/contexts/AuthContext.tsx`

### API request layer

- [Express API](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/server.ts): `apps/server/src/server.ts`
- [API routes](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/routes/index.ts): `apps/server/src/routes/index.ts`
- [Authentication and RBAC](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/middlewares/auth.middleware.ts): `apps/server/src/middlewares/auth.middleware.ts`
- [Product routes](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/routes/product.routes.ts): `apps/server/src/routes/product.routes.ts`
- [Other API domains](https://github.com/dakshchaudhary2668/galaxy-tools-hub/tree/main/apps/server/src/routes): `apps/server/src/routes`

### Commerce services

- [Checkout and payment](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/payment.controller.ts): `apps/server/src/controllers/payment.controller.ts`
- [Checkout pricing](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/payment.service.ts): `apps/server/src/services/payment.service.ts`
- [Order lifecycle](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/order.service.ts): `apps/server/src/services/order.service.ts`
- [Inventory reservations](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/inventory.service.ts): `apps/server/src/services/inventory.service.ts`
- [Payment finalization](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/services/payment-finalization.service.ts): `apps/server/src/services/payment-finalization.service.ts`

### Catalog management

- [Product handling](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/product.controller.ts): `apps/server/src/controllers/product.controller.ts`
- [Product persistence](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/repositories/product.repository.ts): `apps/server/src/repositories/product.repository.ts`
- [Image upload handling](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/controllers/storage.controller.ts): `apps/server/src/controllers/storage.controller.ts`
- [Object storage access](https://github.com/dakshchaudhary2668/galaxy-tools-hub/blob/main/apps/server/src/repositories/storage.repository.ts): `apps/server/src/repositories/storage.repository.ts`

### Other components

- **Shopper**
- **Administrator**
- **Razorpay**
- **Supabase database and storage**

## Connections

- Shopper → Storefront pages: browses
- Storefront pages → Catalog browsing: opens catalog
- Shopper → Catalog browsing: browses
- Shopper → Cart state: adds items
- Cart state → Checkout UI: provides cart (evidence: `apps/web/src/app/checkout/page.tsx`)
- Shopper → Checkout UI: checks out
- Checkout UI → Web API services: requests payment (evidence: `apps/web/src/app/checkout/page.tsx`)
- Web API services → Express API: HTTP requests
- Express API → API routes: mounts routes (evidence: `apps/server/src/server.ts`)
- API routes → Product routes: dispatches
- Product routes → Product handling: routes requests (evidence: `apps/server/src/routes/product.routes.ts`)
- Product routes → Authentication and RBAC: guards admin routes (evidence: `apps/server/src/routes/product.routes.ts`)
- Administrator → Product routes: manages catalog
- Product handling → Product persistence: queries catalog (evidence: `apps/server/src/controllers/product.controller.ts`)
- Product persistence → Supabase database and storage: reads and writes (evidence: `apps/server/src/repositories/product.repository.ts`)
- Image upload handling → Product persistence: checks product (evidence: `apps/server/src/controllers/storage.controller.ts`)
- Image upload handling → Object storage access: requests upload URL (evidence: `apps/server/src/controllers/storage.controller.ts`)
- Object storage access → Supabase database and storage: uses storage (evidence: `apps/server/src/repositories/storage.repository.ts`)
- Checkout and payment → Checkout pricing: calculates checkout (evidence: `apps/server/src/controllers/payment.controller.ts`)
- Checkout and payment → Order lifecycle: creates order (evidence: `apps/server/src/controllers/payment.controller.ts`)
- Checkout and payment → Inventory reservations: reserves stock (evidence: `apps/server/src/controllers/payment.controller.ts`)
- Checkout and payment → Razorpay: creates payment order (evidence: `apps/server/src/controllers/payment.controller.ts`)
- Checkout and payment → Payment finalization: finalizes payment (evidence: `apps/server/src/controllers/payment.controller.ts`)
- Order lifecycle → Inventory reservations: reserves or releases (evidence: `apps/server/src/services/order.service.ts`)
- Order lifecycle → Supabase database and storage: persists orders
- Payment finalization → Supabase database and storage: updates payment state (evidence: `apps/server/src/services/payment-finalization.service.ts`)
- Payment finalization → Razorpay: verifies payment
- API routes → Other API domains: routes requests
- Shopper → Customer and admin access: signs in
- Administrator → Customer and admin access: signs in
