# simplon-alt-dist-p7/teamly-api architecture

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

- Interactive diagram: https://gitdiagram.com/simplon-alt-dist-p7/teamly-api
- Repository: https://github.com/simplon-alt-dist-p7/teamly-api

## Overview

Teamly is a NestJS API for account access and restaurant-team operations. The principal workflow is an owner authenticating, creating a restaurant, then managing its employees; employee creation also provisions an employee account. The tree shows additional shift scheduling and task-list capabilities, including CQRS-style handlers. Source excerpts establish the auth, restaurant, employee and task request paths; several shift/task handler internals and provider bindings were not sampled, so those links are shown only where evidenced or marked unverified.

Main entry points: [`src/app.module.ts`](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/app.module.ts) (Nest app), [`src/employee/employee.service.ts`](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/employee.service.ts) (Employee service), [`src/auth/auth.service.ts`](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.service.ts) (Auth service), [`src/auth/auth.controller.ts`](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.controller.ts) (Auth endpoints)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_app["Nest app<br/>[app.module.ts]"]
end

subgraph group_identity["Identity"]
  node_auth_api["Auth endpoints<br/>[auth.controller.ts]"]
  node_auth_logic["Auth service<br/>[auth.service.ts]"]
  node_auth_guard["JWT guard<br/>[auth.guard.ts]"]
  node_prisma["Prisma service<br/>[prisma.service.ts]"]
  node_email["Email sender<br/>[email-sender.ts]"]
end

subgraph group_restaurant["Restaurant operations"]
  node_restaurant_api["Restaurant endpoints"]
  node_restaurant_logic["Restaurant service"]
  node_restaurant_repo["Restaurant repository"]
  node_restaurant_store["Restaurant adapters"]
  node_employee_api["Employee endpoints"]
  node_employee_logic["Employee service"]
  node_employee_repo["Employee repository"]
  node_employee_store["Employee adapters"]
end

subgraph group_scheduling["Shift scheduling"]
  node_shift_api["Shift endpoints"]
  node_shift_usecases["Shift use cases"]
  node_shift_domain["Shift rules<br/>[shift.entity.ts]"]
  node_shift_repo["Shift persistence"]
end

subgraph group_tasks["Task management"]
  node_task_api["Task endpoints"]
  node_task_usecases["Task use cases"]
  node_task_domain["Task models"]
  node_task_repo["Task-list persistence"]
end

node_client(("API caller"))

node_client -->|"requests"| node_auth_api
node_client -.->|"requests"| node_restaurant_api
node_client -.->|"requests"| node_employee_api
node_client -.->|"requests"| node_shift_api
node_client -.->|"requests"| node_task_api
node_app -->|"registers"| node_auth_api
node_app -->|"registers"| node_restaurant_api
node_app -->|"registers"| node_employee_api
node_app -->|"registers"| node_shift_api
node_app -->|"registers"| node_task_api
node_auth_api -->|"calls"| node_auth_logic
node_auth_logic -->|"queries"| node_prisma
node_auth_logic -->|"sends email"| node_email
node_restaurant_api -->|"calls"| node_restaurant_logic
node_restaurant_logic -->|"uses"| node_restaurant_repo
node_restaurant_repo -.->|"implemented by"| node_restaurant_store
node_employee_api -->|"calls"| node_employee_logic
node_employee_logic -->|"checks owner"| node_restaurant_repo
node_employee_logic -->|"creates account"| node_auth_logic
node_employee_logic -->|"reads writes"| node_employee_repo
node_employee_repo -.->|"implemented by"| node_employee_store
node_shift_api -->|"dispatches"| node_shift_usecases
node_shift_usecases -.->|"persists"| node_shift_repo
node_shift_repo -->|"maps entities"| node_shift_domain
node_task_api -->|"dispatches"| node_task_usecases
node_task_usecases -.->|"persists"| node_task_repo
node_task_repo -->|"maps models"| node_task_domain

click node_app "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/app.module.ts"
click node_auth_api "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.controller.ts"
click node_auth_logic "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.service.ts"
click node_auth_guard "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.guard.ts"
click node_prisma "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/prisma/prisma.service.ts"
click node_email "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/email/email-sender.ts"
click node_restaurant_api "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/restaurant/restaurant.controller.ts"
click node_restaurant_logic "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/restaurant/restaurant.service.ts"
click node_restaurant_repo "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/restaurant/data-access/restaurants.repository.ts"
click node_restaurant_store "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/restaurant/data-access/adapters"
click node_employee_api "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/employee.controller.ts"
click node_employee_logic "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/employee.service.ts"
click node_employee_repo "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/data-access/employees.repository.ts"
click node_employee_store "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/employee/data-access/adapters"
click node_shift_api "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/shift/presentation/controller"
click node_shift_usecases "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/shift/applications/use-cases"
click node_shift_domain "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/shift/domain/models/shift.entity.ts"
click node_shift_repo "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/shift/data-access"
click node_task_api "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/task/presentation/controller"
click node_task_usecases "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/task/applications/use-cases"
click node_task_domain "https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/task/domain/models/task-list.entity.ts"
click node_task_repo "https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/task/data-access"

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_app toneBlue
class node_auth_api,node_auth_logic,node_auth_guard,node_prisma,node_email toneAmber
class node_restaurant_api,node_restaurant_logic,node_restaurant_repo,node_restaurant_store,node_employee_api,node_employee_logic,node_employee_repo,node_employee_store,node_client toneMint
class node_shift_api,node_shift_usecases,node_shift_domain,node_shift_repo toneRose
class node_task_api,node_task_usecases,node_task_domain,node_task_repo toneIndigo
```

## Components

### API entry

- [Nest app](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/app.module.ts): `src/app.module.ts`

### Identity

- [Auth endpoints](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.controller.ts): `src/auth/auth.controller.ts`
- [Auth service](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.service.ts): `src/auth/auth.service.ts`
- [JWT guard](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/auth/auth.guard.ts): `src/auth/auth.guard.ts`
- [Prisma service](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/prisma/prisma.service.ts): `prisma/prisma.service.ts`
- [Email sender](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/email/email-sender.ts): `src/email/email-sender.ts`

### Restaurant operations

- [Restaurant endpoints](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/restaurant/restaurant.controller.ts): `src/restaurant/restaurant.controller.ts`
- [Restaurant service](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/restaurant/restaurant.service.ts): `src/restaurant/restaurant.service.ts`
- [Restaurant repository](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/restaurant/data-access/restaurants.repository.ts): `src/restaurant/data-access/restaurants.repository.ts`
- [Restaurant adapters](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/restaurant/data-access/adapters): `src/restaurant/data-access/adapters`
- [Employee endpoints](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/employee.controller.ts): `src/employee/employee.controller.ts`
- [Employee service](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/employee.service.ts): `src/employee/employee.service.ts`
- [Employee repository](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/employee/data-access/employees.repository.ts): `src/employee/data-access/employees.repository.ts`
- [Employee adapters](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/employee/data-access/adapters): `src/employee/data-access/adapters`

### Shift scheduling

- [Shift endpoints](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/shift/presentation/controller): `src/shift/presentation/controller`
- [Shift use cases](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/shift/applications/use-cases): `src/shift/applications/use-cases`
- [Shift rules](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/shift/domain/models/shift.entity.ts): `src/shift/domain/models/shift.entity.ts`
- [Shift persistence](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/shift/data-access): `src/shift/data-access`

### Task management

- [Task endpoints](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/task/presentation/controller): `src/task/presentation/controller`
- [Task use cases](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/task/applications/use-cases): `src/task/applications/use-cases`
- [Task models](https://github.com/simplon-alt-dist-p7/teamly-api/blob/main/src/task/domain/models/task-list.entity.ts): `src/task/domain/models/task-list.entity.ts`
- [Task-list persistence](https://github.com/simplon-alt-dist-p7/teamly-api/tree/main/src/task/data-access): `src/task/data-access`

### Other components

- **API caller**

## Connections

- API caller → Auth endpoints: requests (evidence: `src/auth/auth.controller.ts`)
- API caller → Restaurant endpoints: requests
- API caller → Employee endpoints: requests
- API caller → Shift endpoints: requests
- API caller → Task endpoints: requests
- Nest app → Auth endpoints: registers (evidence: `src/app.module.ts`)
- Nest app → Restaurant endpoints: registers (evidence: `src/app.module.ts`)
- Nest app → Employee endpoints: registers (evidence: `src/app.module.ts`)
- Nest app → Shift endpoints: registers (evidence: `src/app.module.ts`)
- Nest app → Task endpoints: registers (evidence: `src/app.module.ts`)
- Auth endpoints → Auth service: calls (evidence: `src/auth/auth.controller.ts`)
- Auth service → Prisma service: queries (evidence: `src/auth/auth.service.ts`)
- Auth service → Email sender: sends email (evidence: `src/auth/auth.service.ts`)
- Restaurant endpoints → Restaurant service: calls (evidence: `src/restaurant/restaurant.controller.ts`)
- Restaurant service → Restaurant repository: uses (evidence: `src/restaurant/restaurant.service.ts`)
- Restaurant repository → Restaurant adapters: implemented by (evidence: `src/restaurant/data-access/adapters/restaurants-in-memory.repository.ts`)
- Employee endpoints → Employee service: calls (evidence: `src/employee/employee.controller.ts`)
- Employee service → Restaurant repository: checks owner (evidence: `src/employee/employee.service.ts`)
- Employee service → Auth service: creates account (evidence: `src/employee/employee.service.ts`)
- Employee service → Employee repository: reads writes (evidence: `src/employee/employee.service.ts`)
- Employee repository → Employee adapters: implemented by (evidence: `src/employee/data-access/adapters/employees-prisma.repository.ts`)
- Shift endpoints → Shift use cases: dispatches (evidence: `src/shift/presentation/controller/shift.controller.ts`)
- Shift use cases → Shift persistence: persists
- Shift persistence → Shift rules: maps entities (evidence: `src/shift/data-access/adapters/shifts-prisma.repository.ts`)
- Task endpoints → Task use cases: dispatches (evidence: `src/task/presentation/controller/task-list.controller.ts`)
- Task use cases → Task-list persistence: persists
- Task-list persistence → Task models: maps models (evidence: `src/task/data-access/adapters/task-lists-prisma.repository.ts`)
