# kallelbrg/fashionboost architecture

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

- Interactive diagram: https://gitdiagram.com/kallelbrg/fashionboost
- Repository: https://github.com/kallelbrg/fashionboost

## Overview

FashionBoost is a multi-tenant SaaS CRM and loyalty platform for fashion retailers. Store staff use the Next.js dashboard to manage customers, catalog, sales, loyalty, and coupons; the NestJS API scopes operations to the authenticated tenant and store. Recording sales drives loyalty points and refreshes dashboard insights, while audit events capture key changes. The README documents email verification and AI-generated insights; the sampled excerpts do not show their full implementation, so those links are limited to documented integrations.

Main entry points: [`frontend/src/lib/api.ts`](https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/lib/api.ts) (API client), [`backend/src/sale/sale.controller.ts`](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/sale/sale.controller.ts) (Sales endpoints), [`backend/src/dashboard/dashboard.service.ts`](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/dashboard/dashboard.service.ts) (Metrics and AI), [`frontend/src/app/layout.tsx`](https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/layout.tsx) (Next.js app)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Store dashboard"]
  node_webapp["Next.js app<br/>[layout.tsx]"]
  node_dashboardui["Dashboard pages<br/>[page.tsx]"]
  node_authui["Auth pages<br/>[page.tsx]"]
  node_apiclient["API client<br/>[api.ts]"]
end

subgraph group_identity["Identity and tenancy"]
  node_authapi["Auth endpoints<br/>[auth.controller.ts]"]
  node_authservice["Auth service<br/>[auth.service.ts]"]
  node_tenantapi["Tenant endpoints"]
  node_storeapi["Store endpoints"]
  node_usersapi["User endpoints<br/>[user.controller.ts]"]
  node_entities["Domain entities<br/>[tenant.entity.ts]"]
end

subgraph group_retail["Retail operations"]
  node_catalogapi["Catalog endpoints"]
  node_categoryapi["Category endpoints"]
  node_customerapi["Customer endpoints"]
  node_salesapi["Sales endpoints<br/>[sale.controller.ts]"]
end

subgraph group_loyalty["Customer loyalty"]
  node_loyaltyapi["Loyalty endpoints"]
  node_couponapi["Coupon endpoints"]
end

subgraph group_insights["Insights and records"]
  node_auditapi["Audit endpoints"]
  node_dashboardapi["Insights endpoint"]
  node_dashboardservice["Metrics and AI"]
  node_auditservice["Audit service"]
end

node_staff(("Store staff"))
node_database[("PostgreSQL")]
node_resend["Resend email"]
node_groq["Groq Llama"]

node_staff -->|"uses"| node_webapp
node_webapp -->|"renders"| node_dashboardui
node_webapp -->|"renders"| node_authui
node_dashboardui -->|"requests"| node_apiclient
node_authui -->|"requests"| node_apiclient
node_apiclient -->|"calls"| node_authapi
node_apiclient -->|"calls"| node_tenantapi
node_apiclient -->|"calls"| node_storeapi
node_apiclient -->|"calls"| node_usersapi
node_apiclient -->|"calls"| node_catalogapi
node_apiclient -->|"calls"| node_categoryapi
node_apiclient -->|"calls"| node_customerapi
node_apiclient -->|"calls"| node_salesapi
node_apiclient -->|"calls"| node_loyaltyapi
node_apiclient -->|"calls"| node_couponapi
node_apiclient -->|"calls"| node_auditapi
node_apiclient -->|"calls"| node_dashboardapi
node_authapi -->|"delegates"| node_authservice
node_authservice -->|"reads/writes"| node_database
node_authservice -.->|"sends verification"| node_resend
node_tenantapi -->|"reads/writes"| node_database
node_storeapi -->|"reads/writes"| node_database
node_usersapi -->|"reads/writes"| node_database
node_catalogapi -->|"reads/writes"| node_database
node_categoryapi -->|"reads/writes"| node_database
node_customerapi -->|"reads/writes"| node_database
node_salesapi -->|"via service"| node_database
node_salesapi -->|"clears cache"| node_dashboardservice
node_salesapi -->|"logs sale"| node_auditservice
node_catalogapi -->|"logs changes"| node_auditservice
node_customerapi -->|"logs changes"| node_auditservice
node_auditapi -->|"reads"| node_database
node_loyaltyapi -->|"reads/writes"| node_database
node_couponapi -->|"reads/writes"| node_database
node_dashboardapi -->|"delegates"| node_dashboardservice
node_dashboardservice -->|"queries metrics"| node_database
node_dashboardservice -.->|"requests suggestions"| node_groq
node_entities -->|"maps entities"| node_database

click node_webapp "https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/layout.tsx"
click node_dashboardui "https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/(dashboard)/dashboard/page.tsx"
click node_authui "https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/(auth)/login/page.tsx"
click node_apiclient "https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/lib/api.ts"
click node_authapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/auth/auth.controller.ts"
click node_authservice "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/auth/auth.service.ts"
click node_tenantapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/tenant/tenant.controller.ts"
click node_storeapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/store/store.controller.ts"
click node_usersapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/user/user.controller.ts"
click node_catalogapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/product/product.controller.ts"
click node_categoryapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/category/category.controller.ts"
click node_customerapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/customer/customer.controller.ts"
click node_salesapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/sale/sale.controller.ts"
click node_loyaltyapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/loyalty/loyalty.controller.ts"
click node_couponapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/coupon/coupon.controller.ts"
click node_auditapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/audit-log/audit-log.controller.ts"
click node_dashboardapi "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/dashboard/dashboard.controller.ts"
click node_dashboardservice "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/dashboard/dashboard.service.ts"
click node_auditservice "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/audit-log/audit-log.service.ts"
click node_entities "https://github.com/kallelbrg/fashionboost/blob/master/backend/src/entities/tenant.entity.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_webapp,node_dashboardui,node_authui,node_apiclient toneBlue
class node_authapi,node_authservice,node_tenantapi,node_storeapi,node_usersapi,node_entities,node_database toneAmber
class node_catalogapi,node_categoryapi,node_customerapi,node_salesapi toneMint
class node_loyaltyapi,node_couponapi toneRose
class node_auditapi,node_dashboardapi,node_dashboardservice,node_auditservice,node_staff,node_resend,node_groq toneIndigo
```

## Components

### Store dashboard

- [Next.js app](https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/layout.tsx): `frontend/src/app/layout.tsx`
- [Dashboard pages](https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/(dashboard)/dashboard/page.tsx): `frontend/src/app/(dashboard)/dashboard/page.tsx`
- [Auth pages](https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/app/(auth)/login/page.tsx): `frontend/src/app/(auth)/login/page.tsx`
- [API client](https://github.com/kallelbrg/fashionboost/blob/master/frontend/src/lib/api.ts): `frontend/src/lib/api.ts`

### Identity and tenancy

- [Auth endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/auth/auth.controller.ts): `backend/src/auth/auth.controller.ts`
- [Auth service](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/auth/auth.service.ts): `backend/src/auth/auth.service.ts`
- [Tenant endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/tenant/tenant.controller.ts): `backend/src/tenant/tenant.controller.ts`
- [Store endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/store/store.controller.ts): `backend/src/store/store.controller.ts`
- [User endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/user/user.controller.ts): `backend/src/user/user.controller.ts`
- [Domain entities](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/entities/tenant.entity.ts): `backend/src/entities/tenant.entity.ts`

### Retail operations

- [Catalog endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/product/product.controller.ts): `backend/src/product/product.controller.ts`
- [Category endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/category/category.controller.ts): `backend/src/category/category.controller.ts`
- [Customer endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/customer/customer.controller.ts): `backend/src/customer/customer.controller.ts`
- [Sales endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/sale/sale.controller.ts): `backend/src/sale/sale.controller.ts`

### Customer loyalty

- [Loyalty endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/loyalty/loyalty.controller.ts): `backend/src/loyalty/loyalty.controller.ts`
- [Coupon endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/coupon/coupon.controller.ts): `backend/src/coupon/coupon.controller.ts`

### Insights and records

- [Audit endpoints](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/audit-log/audit-log.controller.ts): `backend/src/audit-log/audit-log.controller.ts`
- [Insights endpoint](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/dashboard/dashboard.controller.ts): `backend/src/dashboard/dashboard.controller.ts`
- [Metrics and AI](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/dashboard/dashboard.service.ts): `backend/src/dashboard/dashboard.service.ts`
- [Audit service](https://github.com/kallelbrg/fashionboost/blob/master/backend/src/audit-log/audit-log.service.ts): `backend/src/audit-log/audit-log.service.ts`

### Other components

- **Store staff**
- **PostgreSQL**
- **Resend email**
- **Groq Llama**

## Connections

- Store staff → Next.js app: uses
- Next.js app → Dashboard pages: renders
- Next.js app → Auth pages: renders
- Dashboard pages → API client: requests
- Auth pages → API client: requests
- API client → Auth endpoints: calls
- API client → Tenant endpoints: calls
- API client → Store endpoints: calls
- API client → User endpoints: calls
- API client → Catalog endpoints: calls
- API client → Category endpoints: calls
- API client → Customer endpoints: calls
- API client → Sales endpoints: calls
- API client → Loyalty endpoints: calls
- API client → Coupon endpoints: calls
- API client → Audit endpoints: calls
- API client → Insights endpoint: calls
- Auth endpoints → Auth service: delegates
- Auth service → PostgreSQL: reads/writes
- Auth service → Resend email: sends verification
- Tenant endpoints → PostgreSQL: reads/writes
- Store endpoints → PostgreSQL: reads/writes
- User endpoints → PostgreSQL: reads/writes
- Catalog endpoints → PostgreSQL: reads/writes
- Category endpoints → PostgreSQL: reads/writes
- Customer endpoints → PostgreSQL: reads/writes
- Sales endpoints → PostgreSQL: via service
- Sales endpoints → Metrics and AI: clears cache
- Sales endpoints → Audit service: logs sale
- Catalog endpoints → Audit service: logs changes
- Customer endpoints → Audit service: logs changes
- Audit endpoints → PostgreSQL: reads
- Loyalty endpoints → PostgreSQL: reads/writes
- Coupon endpoints → PostgreSQL: reads/writes
- Insights endpoint → Metrics and AI: delegates
- Metrics and AI → PostgreSQL: queries metrics
- Metrics and AI → Groq Llama: requests suggestions
- Domain entities → PostgreSQL: maps entities
