# lutfiangg20/ecommerce-nest architecture

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

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

## Overview

This is a NestJS e-commerce API, despite its generic starter README: sampled routes support authentication, user management, product listing and maintenance, and category management. The main request path is HTTP client → controller → service → persistence; authentication also validates users and manages access/refresh tokens. The tree includes order, payment, and address schemas, but no corresponding runtime handlers or services are evidenced, so they are not drawn as workflows. Some category, guard, repository, and bootstrap wiring is unsampled; uncertain links are omitted.

Main entry points: [`src/auth/auth.service.ts`](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.service.ts) (Auth service), [`src/user/user.service.ts`](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/user/user.service.ts) (User service), [`src/auth/auth.controller.ts`](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.controller.ts) (Auth routes), [`src/user/user.controller.ts`](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/user/user.controller.ts) (User routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_entry["Nest bootstrap<br/>[main.ts]"]
  node_app["App module<br/>[app.module.ts]"]
end

subgraph group_identity["Identity and users"]
  node_auth_controller["Auth routes<br/>[auth.controller.ts]"]
  node_auth_service["Auth service<br/>[auth.service.ts]"]
  node_auth_repo["Refresh-token repository<br/>[auth.repostory.ts]"]
  node_user_controller["User routes<br/>[user.controller.ts]"]
  node_user_service["User service<br/>[user.service.ts]"]
  node_user_guard["Auth guard<br/>[auth.guard.ts]"]
end

subgraph group_catalog["Product catalog"]
  node_category_controller["Category routes"]
  node_category_service["Category service"]
  node_product_controller["Product routes"]
  node_product_service["Product service<br/>[product.service.ts]"]
end

subgraph group_persistence["Persistence"]
  node_db_service["Database service"]
  node_db_schemas["Drizzle schemas"]
end

node_client(("HTTP client"))
node_postgres[("PostgreSQL")]
node_jwt["JWT service"]

node_client -->|"HTTP requests"| node_auth_controller
node_client -->|"HTTP requests"| node_user_controller
node_client -->|"HTTP requests"| node_category_controller
node_client -->|"HTTP requests"| node_product_controller
node_auth_controller -->|"calls"| node_auth_service
node_auth_controller -->|"registers users"| node_user_service
node_auth_service -->|"looks up users"| node_user_service
node_auth_service -->|"manages tokens"| node_auth_repo
node_auth_service -->|"signs and verifies"| node_jwt
node_user_controller -->|"guarded by"| node_user_guard
node_user_controller -->|"calls"| node_user_service
node_user_service -->|"queries users"| node_db_service
node_product_controller -->|"calls"| node_product_service
node_product_service -->|"queries products"| node_db_service
node_product_service -->|"uses tables"| node_db_schemas
node_category_controller -->|"calls"| node_category_service
node_db_service -->|"database connection"| node_postgres

click node_entry "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/main.ts"
click node_app "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/app.module.ts"
click node_auth_controller "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.controller.ts"
click node_auth_service "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.service.ts"
click node_auth_repo "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.repostory.ts"
click node_user_controller "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/user/user.controller.ts"
click node_user_service "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/user/user.service.ts"
click node_user_guard "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/common/middleware/auth/auth.guard.ts"
click node_category_controller "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/category/category.controller.ts"
click node_category_service "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/category/category.service.ts"
click node_product_controller "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/product/product.controller.ts"
click node_product_service "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/product/product.service.ts"
click node_db_service "https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/database/database.service.ts"
click node_db_schemas "https://github.com/lutfiangg20/ecommerce-nest/tree/main/src/database/schema"

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_entry,node_app,node_client toneBlue
class node_auth_controller,node_auth_service,node_auth_repo,node_user_controller,node_user_service,node_user_guard,node_postgres toneAmber
class node_category_controller,node_category_service,node_product_controller,node_product_service toneMint
class node_db_service,node_db_schemas toneRose
class node_jwt toneIndigo
```

## Components

### Application runtime

- [Nest bootstrap](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/main.ts): `src/main.ts`
- [App module](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/app.module.ts): `src/app.module.ts`

### Identity and users

- [Auth routes](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Auth service](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [Refresh-token repository](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/auth/auth.repostory.ts): `src/auth/auth.repostory.ts`
- [User routes](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/user/user.controller.ts): `src/user/user.controller.ts`
- [User service](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/user/user.service.ts): `src/user/user.service.ts`
- [Auth guard](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/common/middleware/auth/auth.guard.ts): `src/common/middleware/auth/auth.guard.ts`

### Product catalog

- [Category routes](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/category/category.controller.ts): `src/category/category.controller.ts`
- [Category service](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/category/category.service.ts): `src/category/category.service.ts`
- [Product routes](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/product/product.controller.ts): `src/product/product.controller.ts`
- [Product service](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/product/product.service.ts): `src/product/product.service.ts`

### Persistence

- [Database service](https://github.com/lutfiangg20/ecommerce-nest/blob/main/src/database/database.service.ts): `src/database/database.service.ts`
- [Drizzle schemas](https://github.com/lutfiangg20/ecommerce-nest/tree/main/src/database/schema): `src/database/schema`

### Other components

- **HTTP client**
- **PostgreSQL**
- **JWT service**

## Connections

- HTTP client → Auth routes: HTTP requests
- HTTP client → User routes: HTTP requests
- HTTP client → Category routes: HTTP requests
- HTTP client → Product routes: HTTP requests
- Auth routes → Auth service: calls
- Auth routes → User service: registers users
- Auth service → User service: looks up users
- Auth service → Refresh-token repository: manages tokens
- Auth service → JWT service: signs and verifies
- User routes → Auth guard: guarded by
- User routes → User service: calls
- User service → Database service: queries users
- Product routes → Product service: calls
- Product service → Database service: queries products
- Product service → Drizzle schemas: uses tables
- Category routes → Category service: calls
- Database service → PostgreSQL: database connection
