# baocao155/fresha-clone architecture

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

- Interactive diagram: https://gitdiagram.com/baocao155/fresha-clone
- Repository: https://github.com/baocao155/fresha-clone

## Overview

Fresha is a small Nx workspace with a NestJS API and an Angular web shell. The API’s evidenced product workflow is user CRUD: an HTTP client reaches the API, user routes delegate to service logic, storage accesses MySQL, and results are wrapped for responses. The README describes Nx rather than product capabilities; the web source shown only establishes Angular startup. Some module wiring and web behavior are not sampled, so those links are omitted.

Main entry points: [`libs/api/user/src/lib/user.controller.ts`](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.controller.ts) (User routes), [`apps/api/src/main.ts`](https://github.com/baocao155/fresha-clone/blob/main/apps/api/src/main.ts) (API bootstrap), [`libs/api/user/src/lib/user.service.ts`](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.service.ts) (User service), [`libs/api/shared/abstract/src/lib/storage/base.storage.ts`](https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/abstract/src/lib/storage/base.storage.ts) (Base storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Application runtime"]
  node_api["API bootstrap<br/>[main.ts]"]
  node_appmod["API module<br/>[app.module.ts]"]
  node_webboot["Angular bootstrap<br/>[main.ts]"]
  node_webmod["Web module<br/>[app.module.ts]"]
end

subgraph group_users["User management"]
  node_usermod["User module<br/>[api-user.module.ts]"]
  node_controller["User routes<br/>[user.controller.ts]"]
  node_service["User service<br/>[user.service.ts]"]
  node_storage["User storage<br/>[user.storage.ts]"]
  node_userentity["User entity<br/>[user.entity.ts]"]
  node_createdto["Create DTO<br/>[userCreate.dto.ts]"]
  node_updatedto["Update DTO<br/>[userUpdate.dto.ts]"]
  node_model["User model<br/>[user.model.ts]"]
end

subgraph group_shared["Shared API foundation"]
  node_base["Base storage<br/>[base.storage.ts]"]
  node_responses["Success responses"]
  node_filters["Exception filters"]
  node_dbexception["Database exception"]
end

node_client(("HTTP client"))
node_webuser(("Web visitor"))
node_mysql[("MySQL database")]

node_client -->|"sends requests"| node_api
node_api -->|"starts"| node_appmod
node_appmod -->|"imports"| node_usermod
node_webuser -->|"opens app"| node_webboot
node_webboot -->|"bootstraps"| node_webmod
node_controller -->|"calls"| node_service
node_service -->|"calls"| node_storage
node_storage -->|"inherits operations"| node_base
node_base -->|"reads and writes"| node_mysql
node_base -->|"wraps failures"| node_dbexception
node_service -->|"operates on"| node_userentity
node_controller -->|"accepts"| node_createdto
node_controller -->|"accepts"| node_updatedto
node_controller -->|"maps responses"| node_model
node_controller -->|"wraps results"| node_responses
node_api -->|"registers"| node_filters

click node_api "https://github.com/baocao155/fresha-clone/blob/main/apps/api/src/main.ts"
click node_appmod "https://github.com/baocao155/fresha-clone/blob/main/apps/api/src/app/app.module.ts"
click node_webboot "https://github.com/baocao155/fresha-clone/blob/main/apps/web/src/main.ts"
click node_webmod "https://github.com/baocao155/fresha-clone/blob/main/apps/web/src/app/app.module.ts"
click node_usermod "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/api-user.module.ts"
click node_controller "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.controller.ts"
click node_service "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.service.ts"
click node_storage "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.storage.ts"
click node_base "https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/abstract/src/lib/storage/base.storage.ts"
click node_userentity "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/entity/user.entity.ts"
click node_createdto "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/dto/userCreate.dto.ts"
click node_updatedto "https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/dto/userUpdate.dto.ts"
click node_model "https://github.com/baocao155/fresha-clone/blob/main/libs/shared/data-access/model/src/lib/user.model.ts"
click node_responses "https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/common/src/lib/util/getSuccessResponse.ts"
click node_filters "https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/filter/src/lib/all-exception.filter.ts"
click node_dbexception "https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/exception/src/lib/system/database.exception.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_api,node_appmod,node_webboot,node_webmod,node_client toneBlue
class node_usermod,node_controller,node_service,node_storage,node_userentity,node_createdto,node_updatedto,node_model,node_mysql toneAmber
class node_base,node_responses,node_filters,node_dbexception toneMint
class node_webuser toneIndigo
```

## Components

### Application runtime

- [API bootstrap](https://github.com/baocao155/fresha-clone/blob/main/apps/api/src/main.ts): `apps/api/src/main.ts`
- [API module](https://github.com/baocao155/fresha-clone/blob/main/apps/api/src/app/app.module.ts): `apps/api/src/app/app.module.ts`
- [Angular bootstrap](https://github.com/baocao155/fresha-clone/blob/main/apps/web/src/main.ts): `apps/web/src/main.ts`
- [Web module](https://github.com/baocao155/fresha-clone/blob/main/apps/web/src/app/app.module.ts): `apps/web/src/app/app.module.ts`

### User management

- [User module](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/api-user.module.ts): `libs/api/user/src/lib/api-user.module.ts`
- [User routes](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.controller.ts): `libs/api/user/src/lib/user.controller.ts`
- [User service](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.service.ts): `libs/api/user/src/lib/user.service.ts`
- [User storage](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/user.storage.ts): `libs/api/user/src/lib/user.storage.ts`
- [User entity](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/entity/user.entity.ts): `libs/api/user/src/lib/entity/user.entity.ts`
- [Create DTO](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/dto/userCreate.dto.ts): `libs/api/user/src/lib/dto/userCreate.dto.ts`
- [Update DTO](https://github.com/baocao155/fresha-clone/blob/main/libs/api/user/src/lib/dto/userUpdate.dto.ts): `libs/api/user/src/lib/dto/userUpdate.dto.ts`
- [User model](https://github.com/baocao155/fresha-clone/blob/main/libs/shared/data-access/model/src/lib/user.model.ts): `libs/shared/data-access/model/src/lib/user.model.ts`

### Shared API foundation

- [Base storage](https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/abstract/src/lib/storage/base.storage.ts): `libs/api/shared/abstract/src/lib/storage/base.storage.ts`
- [Success responses](https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/common/src/lib/util/getSuccessResponse.ts): `libs/api/shared/common/src/lib/util/getSuccessResponse.ts`
- [Exception filters](https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/filter/src/lib/all-exception.filter.ts): `libs/api/shared/filter/src/lib/all-exception.filter.ts`
- [Database exception](https://github.com/baocao155/fresha-clone/blob/main/libs/api/shared/exception/src/lib/system/database.exception.ts): `libs/api/shared/exception/src/lib/system/database.exception.ts`

### Other components

- **HTTP client**
- **Web visitor**
- **MySQL database**

## Connections

- HTTP client → API bootstrap: sends requests
- API bootstrap → API module: starts
- API module → User module: imports
- Web visitor → Angular bootstrap: opens app
- Angular bootstrap → Web module: bootstraps
- User routes → User service: calls
- User service → User storage: calls
- User storage → Base storage: inherits operations
- Base storage → MySQL database: reads and writes
- Base storage → Database exception: wraps failures
- User service → User entity: operates on
- User routes → Create DTO: accepts
- User routes → Update DTO: accepts
- User routes → User model: maps responses
- User routes → Success responses: wraps results
- API bootstrap → Exception filters: registers
