# senlovey/itivp-labs architecture

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

- Interactive diagram: https://gitdiagram.com/senlovey/itivp-labs
- Repository: https://github.com/senlovey/itivp-labs

## Overview

This repository implements a JWT-protected microblog API: clients register or log in, then access account, administration, and tweet endpoints. Authentication includes password controls, login-attempt logging and temporary lockouts; admin capabilities include user management and login-log review. Tweet endpoints support listing, retrieval, creation, editing and deletion, with ownership and ban checks on writes. The server and route excerpts show these runtime connections; database setup is visible in the model registry, but the README is empty and database configuration was not sampled.

Main entry points: [`server.js`](https://github.com/senlovey/itivp-labs/blob/main/server.js) (Tweet and admin routes), [`routes/auth.js`](https://github.com/senlovey/itivp-labs/blob/main/routes/auth.js) (Account routes), [`middleware/auth.js`](https://github.com/senlovey/itivp-labs/blob/main/middleware/auth.js) (JWT verification), [`models/user.js`](https://github.com/senlovey/itivp-labs/blob/main/models/user.js) (User model)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API endpoints"]
  node_server["Express API server<br/>[server.js]"]
  node_auth_routes["Account routes<br/>[auth.js]"]
  node_tweet_admin["Tweet and admin routes<br/>[server.js]"]
end

subgraph group_security["Authentication and access"]
  node_token_auth["JWT verification<br/>[auth.js]"]
  node_access_checks["Role and ban checks<br/>[auth.js]"]
end

subgraph group_domain["Domain models"]
  node_user_model["User model<br/>[user.js]"]
  node_tweet_model["Tweet model<br/>[tweet.js]"]
  node_login_model["Login log model<br/>[loginlog.js]"]
end

subgraph group_persistence["Persistence"]
  node_model_registry["Sequelize model registry<br/>[index.js]"]
end

node_client(("API client"))
node_database[("Configured database")]

node_client -->|"sends requests"| node_server
node_server -->|"mounts routes"| node_auth_routes
node_client -->|"registers or logs in"| node_auth_routes
node_auth_routes -->|"reads and updates"| node_user_model
node_auth_routes -->|"records attempts"| node_login_model
node_auth_routes -->|"protects account changes"| node_token_auth
node_server -->|"handles API routes"| node_tweet_admin
node_tweet_admin -->|"verifies protected requests"| node_token_auth
node_tweet_admin -->|"checks write access"| node_access_checks
node_tweet_admin -->|"manages users"| node_user_model
node_tweet_admin -->|"reads login logs"| node_login_model
node_tweet_admin -->|"reads and writes tweets"| node_tweet_model
node_token_auth -->|"passes verified identity"| node_access_checks
node_access_checks -->|"checks ban status"| node_user_model
node_model_registry -.->|"initializes connection"| node_database

click node_server "https://github.com/senlovey/itivp-labs/blob/main/server.js"
click node_auth_routes "https://github.com/senlovey/itivp-labs/blob/main/routes/auth.js"
click node_tweet_admin "https://github.com/senlovey/itivp-labs/blob/main/server.js"
click node_token_auth "https://github.com/senlovey/itivp-labs/blob/main/middleware/auth.js"
click node_access_checks "https://github.com/senlovey/itivp-labs/blob/main/middleware/auth.js"
click node_user_model "https://github.com/senlovey/itivp-labs/blob/main/models/user.js"
click node_tweet_model "https://github.com/senlovey/itivp-labs/blob/main/models/tweet.js"
click node_login_model "https://github.com/senlovey/itivp-labs/blob/main/models/loginlog.js"
click node_model_registry "https://github.com/senlovey/itivp-labs/blob/main/models/index.js"

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_server,node_auth_routes,node_tweet_admin,node_client toneBlue
class node_token_auth,node_access_checks,node_database toneAmber
class node_user_model,node_tweet_model,node_login_model toneMint
class node_model_registry toneRose
```

## Components

### API endpoints

- [Express API server](https://github.com/senlovey/itivp-labs/blob/main/server.js): `server.js`
- [Account routes](https://github.com/senlovey/itivp-labs/blob/main/routes/auth.js): `routes/auth.js`
- [Tweet and admin routes](https://github.com/senlovey/itivp-labs/blob/main/server.js): `server.js`

### Authentication and access

- [JWT verification](https://github.com/senlovey/itivp-labs/blob/main/middleware/auth.js): `middleware/auth.js`
- [Role and ban checks](https://github.com/senlovey/itivp-labs/blob/main/middleware/auth.js): `middleware/auth.js`

### Domain models

- [User model](https://github.com/senlovey/itivp-labs/blob/main/models/user.js): `models/user.js`
- [Tweet model](https://github.com/senlovey/itivp-labs/blob/main/models/tweet.js): `models/tweet.js`
- [Login log model](https://github.com/senlovey/itivp-labs/blob/main/models/loginlog.js): `models/loginlog.js`

### Persistence

- [Sequelize model registry](https://github.com/senlovey/itivp-labs/blob/main/models/index.js): `models/index.js`

### Other components

- **API client**
- **Configured database**

## Connections

- API client → Express API server: sends requests (evidence: `server.js`)
- Express API server → Account routes: mounts routes (evidence: `server.js`)
- API client → Account routes: registers or logs in (evidence: `routes/auth.js`)
- Account routes → User model: reads and updates (evidence: `routes/auth.js`)
- Account routes → Login log model: records attempts (evidence: `routes/auth.js`)
- Account routes → JWT verification: protects account changes (evidence: `routes/auth.js`)
- Express API server → Tweet and admin routes: handles API routes (evidence: `server.js`)
- Tweet and admin routes → JWT verification: verifies protected requests (evidence: `server.js`)
- Tweet and admin routes → Role and ban checks: checks write access (evidence: `server.js`)
- Tweet and admin routes → User model: manages users (evidence: `server.js`)
- Tweet and admin routes → Login log model: reads login logs (evidence: `server.js`)
- Tweet and admin routes → Tweet model: reads and writes tweets (evidence: `server.js`)
- JWT verification → Role and ban checks: passes verified identity (evidence: `middleware/auth.js`)
- Role and ban checks → User model: checks ban status (evidence: `middleware/auth.js`)
- Sequelize model registry → Configured database: initializes connection
