# lucianosants/atomnyy-api architecture

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

- Interactive diagram: https://gitdiagram.com/lucianosants/atomnyy-api
- Repository: https://github.com/lucianosants/atomnyy-api

## Overview

Atomnyy API is a NestJS backend for a supermarket shopping-list app. Its main workflow accepts authenticated list operations over HTTP, dispatches them to use cases, and persists user-owned lists; public registration and login issue the authentication workflow. The graph reflects documented PostgreSQL/TypeORM support and the sampled controller/use-case/repository wiring. Several use cases and modules are indexed but not excerpted, so their internal calls are not asserted.

Main entry points: [`src/shopping-list/shopping-list.controller.ts`](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/shopping-list.controller.ts) (List endpoints), [`src/app.module.ts`](https://github.com/lucianosants/atomnyy-api/blob/main/src/app.module.ts) (Application modules), [`src/users/repositories/typeorm-user.repository.ts`](https://github.com/lucianosants/atomnyy-api/blob/main/src/users/repositories/typeorm-user.repository.ts) (User repository), [`src/shopping-list/repositories/type-orm-shopping-list.repository.ts`](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/repositories/type-orm-shopping-list.repository.ts) (List repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["HTTP API"]
  node_bootstrap["Nest bootstrap<br/>[main.ts]"]
  node_root["Application modules<br/>[app.module.ts]"]
  node_health["Health endpoint<br/>[app.controller.ts]"]
  node_greeting["Greeting service<br/>[app.service.ts]"]
end

subgraph group_auth["Identity and Access"]
  node_auth_controller["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_guard["JWT guard<br/>[auth.guard.ts]"]
  node_register["User registration"]
  node_login["User login"]
end

subgraph group_lists["Shopping Lists"]
  node_list_controller["List endpoints"]
  node_create_list["Create list"]
  node_list_queries["List queries"]
  node_list_by_id["Find list"]
  node_remove_list["Remove list"]
  node_rename_list["Rename list"]
  node_expiry["Expiry date helper"]
end

subgraph group_persistence["Persistence"]
  node_users_module["User module<br/>[users.module.ts]"]
  node_user_repository["User repository"]
  node_user_entity[("User records<br/>[user.entity.ts]")]
  node_database[("PostgreSQL / TypeORM<br/>[database.module.ts]")]
  node_list_repository["List repository"]
  node_list_entity[("Shopping lists")]
end

node_client(("API client"))

node_client -.->|"sends requests"| node_bootstrap
node_bootstrap -->|"starts app"| node_root
node_root -->|"registers"| node_health
node_root -->|"registers"| node_auth_controller
node_root -->|"configures"| node_auth_guard
node_root -->|"registers"| node_list_controller
node_root -->|"imports"| node_database
node_health -->|"calls"| node_greeting
node_auth_controller -->|"executes"| node_register
node_auth_controller -->|"executes"| node_login
node_register -->|"uses"| node_user_repository
node_login -->|"uses"| node_user_repository
node_users_module -->|"provides"| node_user_repository
node_user_repository -->|"reads/writes"| node_user_entity
node_database -->|"maps"| node_user_entity
node_database -->|"maps"| node_list_entity
node_client -.->|"registers or logs in"| node_auth_controller
node_client -.->|"manages lists"| node_list_controller
node_list_controller -->|"executes"| node_create_list
node_list_controller -->|"executes"| node_list_queries
node_list_controller -->|"executes"| node_list_by_id
node_list_controller -->|"executes"| node_remove_list
node_list_controller -->|"executes"| node_rename_list
node_create_list -->|"uses"| node_list_repository
node_create_list -->|"uses"| node_user_repository
node_create_list -->|"calculates expiry"| node_expiry
node_list_queries -->|"uses"| node_list_repository
node_list_queries -->|"uses"| node_user_repository
node_rename_list -->|"uses"| node_list_repository
node_list_repository -->|"reads/writes"| node_list_entity
node_list_repository -.->|"persists via"| node_database

click node_bootstrap "https://github.com/lucianosants/atomnyy-api/blob/main/src/main.ts"
click node_root "https://github.com/lucianosants/atomnyy-api/blob/main/src/app.module.ts"
click node_health "https://github.com/lucianosants/atomnyy-api/blob/main/src/app.controller.ts"
click node_greeting "https://github.com/lucianosants/atomnyy-api/blob/main/src/app.service.ts"
click node_auth_controller "https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/auth.controller.ts"
click node_auth_guard "https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/auth.guard.ts"
click node_register "https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/use-cases/register-user.use-case.ts"
click node_login "https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/use-cases/login-user.use-case.ts"
click node_users_module "https://github.com/lucianosants/atomnyy-api/blob/main/src/users/users.module.ts"
click node_user_repository "https://github.com/lucianosants/atomnyy-api/blob/main/src/users/repositories/typeorm-user.repository.ts"
click node_user_entity "https://github.com/lucianosants/atomnyy-api/blob/main/src/users/entities/user.entity.ts"
click node_database "https://github.com/lucianosants/atomnyy-api/blob/main/src/database/database.module.ts"
click node_list_controller "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/shopping-list.controller.ts"
click node_create_list "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/create-shopping-list.use-case.ts"
click node_list_queries "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/find-all-shopping-lists.use-case.ts"
click node_list_by_id "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/find-shopping-list-by-id.use-case.ts"
click node_remove_list "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/remove-shopping-list.use-case.ts"
click node_rename_list "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/rename-shopping-list.use-case.ts"
click node_list_repository "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/repositories/type-orm-shopping-list.repository.ts"
click node_list_entity "https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/entities/shopping-list.entity.ts"
click node_expiry "https://github.com/lucianosants/atomnyy-api/blob/main/src/utils/set-expiration-date-shopping-list.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_bootstrap,node_root,node_health,node_greeting,node_client toneBlue
class node_auth_controller,node_auth_guard,node_register,node_login toneAmber
class node_list_controller,node_create_list,node_list_queries,node_list_by_id,node_remove_list,node_rename_list,node_expiry toneMint
class node_users_module,node_user_repository,node_user_entity,node_database,node_list_repository,node_list_entity toneRose
```

## Components

### HTTP API

- [Nest bootstrap](https://github.com/lucianosants/atomnyy-api/blob/main/src/main.ts): `src/main.ts`
- [Application modules](https://github.com/lucianosants/atomnyy-api/blob/main/src/app.module.ts): `src/app.module.ts`
- [Health endpoint](https://github.com/lucianosants/atomnyy-api/blob/main/src/app.controller.ts): `src/app.controller.ts`
- [Greeting service](https://github.com/lucianosants/atomnyy-api/blob/main/src/app.service.ts): `src/app.service.ts`

### Identity and Access

- [Auth endpoints](https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [JWT guard](https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/auth.guard.ts): `src/auth/auth.guard.ts`
- [User registration](https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/use-cases/register-user.use-case.ts): `src/auth/use-cases/register-user.use-case.ts`
- [User login](https://github.com/lucianosants/atomnyy-api/blob/main/src/auth/use-cases/login-user.use-case.ts): `src/auth/use-cases/login-user.use-case.ts`

### Shopping Lists

- [List endpoints](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/shopping-list.controller.ts): `src/shopping-list/shopping-list.controller.ts`
- [Create list](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/create-shopping-list.use-case.ts): `src/shopping-list/use-cases/create-shopping-list.use-case.ts`
- [List queries](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/find-all-shopping-lists.use-case.ts): `src/shopping-list/use-cases/find-all-shopping-lists.use-case.ts`
- [Find list](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/find-shopping-list-by-id.use-case.ts): `src/shopping-list/use-cases/find-shopping-list-by-id.use-case.ts`
- [Remove list](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/remove-shopping-list.use-case.ts): `src/shopping-list/use-cases/remove-shopping-list.use-case.ts`
- [Rename list](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/use-cases/rename-shopping-list.use-case.ts): `src/shopping-list/use-cases/rename-shopping-list.use-case.ts`
- [Expiry date helper](https://github.com/lucianosants/atomnyy-api/blob/main/src/utils/set-expiration-date-shopping-list.ts): `src/utils/set-expiration-date-shopping-list.ts`

### Persistence

- [User module](https://github.com/lucianosants/atomnyy-api/blob/main/src/users/users.module.ts): `src/users/users.module.ts`
- [User repository](https://github.com/lucianosants/atomnyy-api/blob/main/src/users/repositories/typeorm-user.repository.ts): `src/users/repositories/typeorm-user.repository.ts`
- [User records](https://github.com/lucianosants/atomnyy-api/blob/main/src/users/entities/user.entity.ts): `src/users/entities/user.entity.ts`
- [PostgreSQL / TypeORM](https://github.com/lucianosants/atomnyy-api/blob/main/src/database/database.module.ts): `src/database/database.module.ts`
- [List repository](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/repositories/type-orm-shopping-list.repository.ts): `src/shopping-list/repositories/type-orm-shopping-list.repository.ts`
- [Shopping lists](https://github.com/lucianosants/atomnyy-api/blob/main/src/shopping-list/entities/shopping-list.entity.ts): `src/shopping-list/entities/shopping-list.entity.ts`

### Other components

- **API client**

## Connections

- API client → Nest bootstrap: sends requests
- Nest bootstrap → Application modules: starts app (evidence: `src/main.ts`)
- Application modules → Health endpoint: registers (evidence: `src/app.module.ts`)
- Application modules → Auth endpoints: registers
- Application modules → JWT guard: configures (evidence: `src/app.module.ts`)
- Application modules → List endpoints: registers (evidence: `src/app.module.ts`)
- Application modules → PostgreSQL / TypeORM: imports (evidence: `src/app.module.ts`)
- Health endpoint → Greeting service: calls (evidence: `src/app.controller.ts`)
- Auth endpoints → User registration: executes (evidence: `src/auth/auth.controller.ts`)
- Auth endpoints → User login: executes (evidence: `src/auth/auth.controller.ts`)
- User registration → User repository: uses (evidence: `src/auth/use-cases/register-user.use-case.ts`)
- User login → User repository: uses (evidence: `src/auth/use-cases/login-user.use-case.ts`)
- User module → User repository: provides (evidence: `src/users/users.module.ts`)
- User repository → User records: reads/writes (evidence: `src/users/repositories/typeorm-user.repository.ts`)
- PostgreSQL / TypeORM → User records: maps (evidence: `src/database/database.module.ts`)
- PostgreSQL / TypeORM → Shopping lists: maps (evidence: `src/database/database.module.ts`)
- API client → Auth endpoints: registers or logs in
- API client → List endpoints: manages lists
- List endpoints → Create list: executes (evidence: `src/shopping-list/shopping-list.controller.ts`)
- List endpoints → List queries: executes (evidence: `src/shopping-list/shopping-list.controller.ts`)
- List endpoints → Find list: executes (evidence: `src/shopping-list/shopping-list.controller.ts`)
- List endpoints → Remove list: executes (evidence: `src/shopping-list/shopping-list.controller.ts`)
- List endpoints → Rename list: executes (evidence: `src/shopping-list/shopping-list.controller.ts`)
- Create list → List repository: uses (evidence: `src/shopping-list/use-cases/create-shopping-list.use-case.ts`)
- Create list → User repository: uses (evidence: `src/shopping-list/use-cases/create-shopping-list.use-case.ts`)
- Create list → Expiry date helper: calculates expiry (evidence: `src/shopping-list/use-cases/create-shopping-list.use-case.ts`)
- List queries → List repository: uses (evidence: `src/shopping-list/use-cases/find-all-shopping-lists.use-case.ts`)
- List queries → User repository: uses (evidence: `src/shopping-list/use-cases/find-all-shopping-lists.use-case.ts`)
- Rename list → List repository: uses (evidence: `src/shopping-list/use-cases/rename-shopping-list.use-case.ts`)
- List repository → Shopping lists: reads/writes (evidence: `src/shopping-list/repositories/type-orm-shopping-list.repository.ts`)
- List repository → PostgreSQL / TypeORM: persists via
