# mmykesser/ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/mmykesser/ecommerce
- Repository: https://github.com/mmykesser/ecommerce

## Overview

This is an eCommerce platform with an Express/MongoDB API and an in-progress React frontend. The documented backend workflow is HTTP routing and middleware → controller → business service → Mongoose model; its domain capabilities include authentication, users, catalog, cart, orders, and InPost pickup-point support. The frontend excerpt shows authentication initialization and state management, but not the full shopping flow. Some domain modules are unsampled, so their components are included from the tree and README, while unsupported internal call details are omitted.

Main entry points: [`backend/src/routes`](https://github.com/mmykesser/ecommerce/tree/master/backend/src/routes) (API Routers), [`backend/src/controllers`](https://github.com/mmykesser/ecommerce/tree/master/backend/src/controllers) (HTTP Controllers), [`backend/src/models`](https://github.com/mmykesser/ecommerce/tree/master/backend/src/models) (Mongoose Models), [`backend/src/server.ts`](https://github.com/mmykesser/ecommerce/blob/master/backend/src/server.ts) (Express Server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API Runtime"]
  node_server["Express Server<br/>[server.ts]"]
  node_routes["API Routers"]
  node_middleware["Auth and Validation"]
  node_controllers["HTTP Controllers"]
end

subgraph group_commerce["Commerce Services"]
  node_auth["Authentication<br/>[auth.service.ts]"]
  node_users["User Management<br/>[user.service.ts]"]
  node_catalog["Product Catalog<br/>[product.service.ts]"]
  node_categories["Category Management"]
  node_cart["Shopping Cart<br/>[cart.service.ts]"]
  node_orders["Order Processing<br/>[order.service.ts]"]
  node_inpost["InPost Integration<br/>[inpost.service.ts]"]
end

subgraph group_data["Persistence"]
  node_models["Mongoose Models"]
end

subgraph group_web["Web Authentication"]
  node_app["React App<br/>[App.tsx]"]
  node_auth_init["Auth Initialization<br/>[useAuthInit.ts]"]
  node_auth_state["Auth State<br/>[authSlice.ts]"]
  node_auth_api["Auth API Client<br/>[authApi.ts]"]
  node_http_client["HTTP Client<br/>[axios.ts]"]
  node_store["Redux Store<br/>[store.ts]"]
end

node_client(("API Client"))
node_mongodb[("MongoDB")]
node_inpost_api["InPost API"]
node_browser(("Browser User"))

node_client -->|"sends requests"| node_server
node_server -->|"mounts routers"| node_routes
node_server -->|"connects"| node_mongodb
node_routes -->|"routes to"| node_controllers
node_routes -->|"applies guards"| node_middleware
node_routes -->|"constructs service"| node_auth
node_routes -->|"constructs service"| node_catalog
node_routes -->|"constructs service"| node_categories
node_routes -->|"constructs service"| node_cart
node_routes -->|"constructs service"| node_users
node_controllers -->|"calls service"| node_auth
node_controllers -->|"calls service"| node_cart
node_controllers -->|"calls service"| node_catalog
node_controllers -->|"calls service"| node_categories
node_controllers -->|"calls service"| node_orders
node_auth -->|"queries users"| node_models
node_cart -->|"reads and writes"| node_models
node_catalog -->|"queries catalog"| node_models
node_orders -->|"queries orders"| node_models
node_models -->|"persists documents"| node_mongodb
node_inpost -.->|"uses API"| node_inpost_api
node_browser -->|"uses storefront"| node_app
node_app -->|"initializes auth"| node_auth_init
node_auth_init -->|"dispatches profile"| node_auth_state
node_auth_state -->|"requests auth"| node_auth_api
node_auth_api -->|"sends requests"| node_http_client
node_store -->|"registers reducer"| node_auth_state

click node_server "https://github.com/mmykesser/ecommerce/blob/master/backend/src/server.ts"
click node_routes "https://github.com/mmykesser/ecommerce/tree/master/backend/src/routes"
click node_middleware "https://github.com/mmykesser/ecommerce/tree/master/backend/src/middleware"
click node_controllers "https://github.com/mmykesser/ecommerce/tree/master/backend/src/controllers"
click node_auth "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/auth.service.ts"
click node_users "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/user.service.ts"
click node_catalog "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/product.service.ts"
click node_categories "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/category.service.ts"
click node_cart "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/cart.service.ts"
click node_orders "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/order.service.ts"
click node_inpost "https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/inpost.service.ts"
click node_models "https://github.com/mmykesser/ecommerce/tree/master/backend/src/models"
click node_app "https://github.com/mmykesser/ecommerce/blob/master/frontend/src/App.tsx"
click node_auth_init "https://github.com/mmykesser/ecommerce/blob/master/frontend/src/features/auth/hooks/useAuthInit.ts"
click node_auth_state "https://github.com/mmykesser/ecommerce/blob/master/frontend/src/features/auth/authSlice.ts"
click node_auth_api "https://github.com/mmykesser/ecommerce/blob/master/frontend/src/features/auth/authApi.ts"
click node_http_client "https://github.com/mmykesser/ecommerce/blob/master/frontend/src/api/axios.ts"
click node_store "https://github.com/mmykesser/ecommerce/blob/master/frontend/src/store/store.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_server,node_routes,node_middleware,node_controllers,node_client,node_browser toneBlue
class node_auth,node_users,node_catalog,node_categories,node_cart,node_orders,node_inpost,node_mongodb toneAmber
class node_models,node_inpost_api toneMint
class node_app,node_auth_init,node_auth_state,node_auth_api,node_http_client,node_store toneRose
```

## Components

### API Runtime

- [Express Server](https://github.com/mmykesser/ecommerce/blob/master/backend/src/server.ts): `backend/src/server.ts`
- [API Routers](https://github.com/mmykesser/ecommerce/tree/master/backend/src/routes): `backend/src/routes`
- [Auth and Validation](https://github.com/mmykesser/ecommerce/tree/master/backend/src/middleware): `backend/src/middleware`
- [HTTP Controllers](https://github.com/mmykesser/ecommerce/tree/master/backend/src/controllers): `backend/src/controllers`

### Commerce Services

- [Authentication](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/auth.service.ts): `backend/src/services/auth.service.ts`
- [User Management](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/user.service.ts): `backend/src/services/user.service.ts`
- [Product Catalog](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/product.service.ts): `backend/src/services/product.service.ts`
- [Category Management](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/category.service.ts): `backend/src/services/category.service.ts`
- [Shopping Cart](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/cart.service.ts): `backend/src/services/cart.service.ts`
- [Order Processing](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/order.service.ts): `backend/src/services/order.service.ts`
- [InPost Integration](https://github.com/mmykesser/ecommerce/blob/master/backend/src/services/inpost.service.ts): `backend/src/services/inpost.service.ts`

### Persistence

- [Mongoose Models](https://github.com/mmykesser/ecommerce/tree/master/backend/src/models): `backend/src/models`

### Web Authentication

- [React App](https://github.com/mmykesser/ecommerce/blob/master/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Auth Initialization](https://github.com/mmykesser/ecommerce/blob/master/frontend/src/features/auth/hooks/useAuthInit.ts): `frontend/src/features/auth/hooks/useAuthInit.ts`
- [Auth State](https://github.com/mmykesser/ecommerce/blob/master/frontend/src/features/auth/authSlice.ts): `frontend/src/features/auth/authSlice.ts`
- [Auth API Client](https://github.com/mmykesser/ecommerce/blob/master/frontend/src/features/auth/authApi.ts): `frontend/src/features/auth/authApi.ts`
- [HTTP Client](https://github.com/mmykesser/ecommerce/blob/master/frontend/src/api/axios.ts): `frontend/src/api/axios.ts`
- [Redux Store](https://github.com/mmykesser/ecommerce/blob/master/frontend/src/store/store.ts): `frontend/src/store/store.ts`

### Other components

- **API Client**
- **MongoDB**
- **InPost API**
- **Browser User**

## Connections

- API Client → Express Server: sends requests
- Express Server → API Routers: mounts routers (evidence: `backend/src/server.ts`)
- Express Server → MongoDB: connects (evidence: `backend/src/server.ts`)
- API Routers → HTTP Controllers: routes to (evidence: `backend/src/routes/product.routes.ts`)
- API Routers → Auth and Validation: applies guards (evidence: `backend/src/routes/product.routes.ts`)
- API Routers → Authentication: constructs service (evidence: `backend/src/routes/auth.routes.ts`)
- API Routers → Product Catalog: constructs service (evidence: `backend/src/routes/product.routes.ts`)
- API Routers → Category Management: constructs service (evidence: `backend/src/routes/category.routes.ts`)
- API Routers → Shopping Cart: constructs service (evidence: `backend/src/routes/cart.routes.ts`)
- API Routers → User Management: constructs service (evidence: `backend/src/routes/user.routes.ts`)
- HTTP Controllers → Authentication: calls service (evidence: `backend/src/controllers/auth.controller.ts`)
- HTTP Controllers → Shopping Cart: calls service (evidence: `backend/src/controllers/cart.controller.ts`)
- HTTP Controllers → Product Catalog: calls service (evidence: `backend/src/controllers/product.controller.ts`)
- HTTP Controllers → Category Management: calls service (evidence: `backend/src/controllers/category.controller.ts`)
- HTTP Controllers → Order Processing: calls service (evidence: `backend/src/controllers/order.controller.ts`)
- Authentication → Mongoose Models: queries users (evidence: `backend/src/services/auth.service.ts`)
- Shopping Cart → Mongoose Models: reads and writes (evidence: `backend/src/services/cart.service.ts`)
- Product Catalog → Mongoose Models: queries catalog (evidence: `backend/src/services/product.service.ts`)
- Order Processing → Mongoose Models: queries orders (evidence: `backend/src/services/order.service.ts`)
- Mongoose Models → MongoDB: persists documents
- InPost Integration → InPost API: uses API
- Browser User → React App: uses storefront (evidence: `frontend/src/App.tsx`)
- React App → Auth Initialization: initializes auth (evidence: `frontend/src/App.tsx`)
- Auth Initialization → Auth State: dispatches profile (evidence: `frontend/src/features/auth/hooks/useAuthInit.ts`)
- Auth State → Auth API Client: requests auth (evidence: `frontend/src/features/auth/authSlice.ts`)
- Auth API Client → HTTP Client: sends requests (evidence: `frontend/src/features/auth/authApi.ts`)
- Redux Store → Auth State: registers reducer (evidence: `frontend/src/store/store.ts`)
