# eveny89/backend architecture

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

- Interactive diagram: https://gitdiagram.com/eveny89/backend
- Repository: https://github.com/eveny89/backend
- Video tour (about a minute): https://gitdiagram.com/eveny89/backend/video

## Overview

This is a Fastify backend for accounts, teams, availability, meeting links, and reservations. The principal public-booking path is a guest retrieving an invite, selecting a team member and available time, then creating or managing a reservation; the sampled public routes show repository-backed validation and writes. Authenticated users also manage their profiles, teams, links, availability, and reservations. The README provides no product detail, so unsampled feature behavior is represented only at the route-module level; edges are limited to relationships visible in excerpts or the source index.

Main entry points: [`src/app.ts`](https://github.com/eveny89/backend/blob/main/src/app.ts) (Fastify app), [`src/utils/repository.ts`](https://github.com/eveny89/backend/blob/main/src/utils/repository.ts) (SQL repository), [`src/features/auth/routes.ts`](https://github.com/eveny89/backend/blob/main/src/features/auth/routes.ts) (Authentication routes), [`src/schemas`](https://github.com/eveny89/backend/tree/main/src/schemas) (Request schemas)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["API runtime"]
  node_app["Fastify app<br/>[app.ts]"]
  node_plugins["Server plugins"]
  node_schemas["Request schemas"]
end

subgraph group_identity["Identity and profiles"]
  node_auth["Authentication routes<br/>[routes.ts]"]
  node_passwords["Password hashing<br/>[service.ts]"]
  node_user["User profiles<br/>[routes.ts]"]
  node_tokens["Token utilities<br/>[token.ts]"]
end

subgraph group_scheduling["Scheduling and booking"]
  node_availability["Availability routes<br/>[routes.ts]"]
  node_public["Public booking<br/>[routes.ts]"]
  node_reservations["Reservation management<br/>[routes.ts]"]
end

subgraph group_organization["Teams and links"]
  node_teams["Team management<br/>[routes.ts]"]
  node_links["Link management<br/>[routes.ts]"]
end

subgraph group_persistence["Persistence"]
  node_repository["SQL repository<br/>[repository.ts]"]
  node_dbconfig["Database connection<br/>[database.ts]"]
  node_postgres[("PostgreSQL")]
end

node_client(("API client"))

node_client -->|"sends requests"| node_app
node_app -->|"autoloads"| node_plugins
node_app -->|"autoloads features"| node_auth
node_app -->|"autoloads features"| node_availability
node_app -->|"autoloads features"| node_public
node_app -->|"autoloads features"| node_reservations
node_app -->|"autoloads features"| node_teams
node_app -->|"autoloads features"| node_links
node_app -->|"autoloads features"| node_user
node_auth -->|"hashes passwords"| node_passwords
node_user -->|"hashes passwords"| node_passwords
node_auth -->|"reads and writes"| node_repository
node_auth -->|"creates tokens"| node_tokens
node_user -->|"reads and writes"| node_repository
node_teams -->|"reads and writes"| node_repository
node_public -->|"reads and writes"| node_repository
node_reservations -->|"reads and writes"| node_repository
node_plugins -->|"uses connection config"| node_dbconfig
node_plugins -->|"installs repository"| node_repository
node_repository -->|"executes SQL"| node_postgres
node_tokens -->|"stores refresh tokens"| node_repository
node_auth -->|"validates input"| node_schemas
node_teams -->|"validates input"| node_schemas
node_public -->|"validates input"| node_schemas
node_availability -->|"validates input"| node_schemas

click node_app "https://github.com/eveny89/backend/blob/main/src/app.ts"
click node_plugins "https://github.com/eveny89/backend/tree/main/src/plugins"
click node_auth "https://github.com/eveny89/backend/blob/main/src/features/auth/routes.ts"
click node_passwords "https://github.com/eveny89/backend/blob/main/src/features/auth/service.ts"
click node_user "https://github.com/eveny89/backend/blob/main/src/features/user/routes.ts"
click node_availability "https://github.com/eveny89/backend/blob/main/src/features/availability/routes.ts"
click node_public "https://github.com/eveny89/backend/blob/main/src/features/public/routes.ts"
click node_reservations "https://github.com/eveny89/backend/blob/main/src/features/reservations/routes.ts"
click node_teams "https://github.com/eveny89/backend/blob/main/src/features/teams/routes.ts"
click node_links "https://github.com/eveny89/backend/blob/main/src/features/links/routes.ts"
click node_repository "https://github.com/eveny89/backend/blob/main/src/utils/repository.ts"
click node_dbconfig "https://github.com/eveny89/backend/blob/main/src/config/database.ts"
click node_tokens "https://github.com/eveny89/backend/blob/main/src/utils/token.ts"
click node_schemas "https://github.com/eveny89/backend/tree/main/src/schemas"

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,node_plugins,node_schemas,node_client toneBlue
class node_auth,node_passwords,node_user,node_tokens toneAmber
class node_availability,node_public,node_reservations toneMint
class node_teams,node_links toneRose
class node_repository,node_dbconfig,node_postgres toneIndigo
```

## Components

### API runtime

- [Fastify app](https://github.com/eveny89/backend/blob/main/src/app.ts): `src/app.ts`
- [Server plugins](https://github.com/eveny89/backend/tree/main/src/plugins): `src/plugins`
- [Request schemas](https://github.com/eveny89/backend/tree/main/src/schemas): `src/schemas`

### Identity and profiles

- [Authentication routes](https://github.com/eveny89/backend/blob/main/src/features/auth/routes.ts): `src/features/auth/routes.ts`
- [Password hashing](https://github.com/eveny89/backend/blob/main/src/features/auth/service.ts): `src/features/auth/service.ts`
- [User profiles](https://github.com/eveny89/backend/blob/main/src/features/user/routes.ts): `src/features/user/routes.ts`
- [Token utilities](https://github.com/eveny89/backend/blob/main/src/utils/token.ts): `src/utils/token.ts`

### Scheduling and booking

- [Availability routes](https://github.com/eveny89/backend/blob/main/src/features/availability/routes.ts): `src/features/availability/routes.ts`
- [Public booking](https://github.com/eveny89/backend/blob/main/src/features/public/routes.ts): `src/features/public/routes.ts`
- [Reservation management](https://github.com/eveny89/backend/blob/main/src/features/reservations/routes.ts): `src/features/reservations/routes.ts`

### Teams and links

- [Team management](https://github.com/eveny89/backend/blob/main/src/features/teams/routes.ts): `src/features/teams/routes.ts`
- [Link management](https://github.com/eveny89/backend/blob/main/src/features/links/routes.ts): `src/features/links/routes.ts`

### Persistence

- [SQL repository](https://github.com/eveny89/backend/blob/main/src/utils/repository.ts): `src/utils/repository.ts`
- [Database connection](https://github.com/eveny89/backend/blob/main/src/config/database.ts): `src/config/database.ts`
- **PostgreSQL**

### Other components

- **API client**

## Connections

- API client → Fastify app: sends requests (evidence: `src/app.ts`)
- Fastify app → Server plugins: autoloads (evidence: `src/app.ts`)
- Fastify app → Authentication routes: autoloads features (evidence: `src/app.ts`)
- Fastify app → Availability routes: autoloads features (evidence: `src/app.ts`)
- Fastify app → Public booking: autoloads features (evidence: `src/app.ts`)
- Fastify app → Reservation management: autoloads features (evidence: `src/app.ts`)
- Fastify app → Team management: autoloads features (evidence: `src/app.ts`)
- Fastify app → Link management: autoloads features (evidence: `src/app.ts`)
- Fastify app → User profiles: autoloads features (evidence: `src/app.ts`)
- Authentication routes → Password hashing: hashes passwords (evidence: `src/features/auth/routes.ts`)
- User profiles → Password hashing: hashes passwords (evidence: `src/features/user/routes.ts`)
- Authentication routes → SQL repository: reads and writes (evidence: `src/features/auth/routes.ts`)
- Authentication routes → Token utilities: creates tokens (evidence: `src/features/auth/routes.ts`)
- User profiles → SQL repository: reads and writes (evidence: `src/features/user/routes.ts`)
- Team management → SQL repository: reads and writes (evidence: `src/features/teams/routes.ts`)
- Public booking → SQL repository: reads and writes (evidence: `src/features/public/routes.ts`)
- Reservation management → SQL repository: reads and writes (evidence: `src/features/reservations/routes.ts`)
- Server plugins → Database connection: uses connection config (evidence: `src/plugins/database.ts`)
- Server plugins → SQL repository: installs repository (evidence: `src/plugins/database.ts`)
- SQL repository → PostgreSQL: executes SQL (evidence: `src/utils/repository.ts`)
- Token utilities → SQL repository: stores refresh tokens (evidence: `src/utils/token.ts`)
- Authentication routes → Request schemas: validates input (evidence: `src/features/auth/routes.ts`)
- Team management → Request schemas: validates input (evidence: `src/features/teams/routes.ts`)
- Public booking → Request schemas: validates input (evidence: `src/features/public/routes.ts`)
- Availability routes → Request schemas: validates input (evidence: `src/features/availability/routes.ts`)
