# shaundelcastillo/-midterm-crud-api architecture

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

- Interactive diagram: https://gitdiagram.com/shaundelcastillo/-midterm-crud-api
- Repository: https://github.com/shaundelcastillo/-midterm-crud-api

## Overview

Midterm CRUD API is a versioned Express REST service for users, tasks, categories, and tags, backed by MySQL through TypeORM. Requests enter through the server’s v1 route mounts, reach route-specific controllers, and read or update relational entities; task endpoints also provide filtering, pagination, statistics, and soft deletion. Separate branches handle login and category management. The README documents migrations and relational constraints. Evidence is limited to the supplied excerpts, README, and SOURCE INDEX; connections to unsampled internals are omitted where behavior is unclear.

Main entry points: [`src/config/data-source.ts`](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/config/data-source.ts) (TypeORM data source), [`src/index.ts`](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/index.ts) (Server and v1 routing), [`src/entities/Task.ts`](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Task.ts) (Task entity), [`src/controllers/UserController.ts`](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/UserController.ts) (User operations)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP entry"]
  node_server["Server and v1 routing<br/>[index.ts]"]
  node_logger["Request logger<br/>[requestLogger.ts]"]
  node_user_routes["User routes<br/>[userRoutes.ts]"]
  node_task_routes["Task routes<br/>[taskRoutes.ts]"]
  node_category_routes["Category routes<br/>[categoryRoutes.ts]"]
  node_auth_routes["Auth routes<br/>[authRoutes.ts]"]
end

subgraph group_operations["API operations"]
  node_user_controller["User operations<br/>[UserController.ts]"]
  node_task_controller["Task operations<br/>[taskController.ts]"]
  node_category_controller["Category operations"]
  node_auth_controller["Login<br/>[authController.ts]"]
  node_user_dto["User DTOs<br/>[userDto.ts]"]
  node_task_repository["Task repository helper<br/>[TaskRepository.ts]"]
end

subgraph group_domain["Domain and persistence"]
  node_datasource["TypeORM data source<br/>[data-source.ts]"]
  node_user["User entity<br/>[User.ts]"]
  node_task["Task entity<br/>[Task.ts]"]
  node_category["Category entity<br/>[Category.ts]"]
  node_tag["Tag entity<br/>[Tag.ts]"]
  node_mysql[("MySQL database")]
end

subgraph group_schema["Schema management"]
  node_migrations["Schema migrations"]
end

node_client(("API client"))

node_client -->|"sends requests"| node_server
node_server -->|"registers middleware"| node_logger
node_server -->|"mounts v1 routes"| node_user_routes
node_server -->|"mounts v1 routes"| node_task_routes
node_server -->|"mounts v1 routes"| node_category_routes
node_server -->|"mounts v1 routes"| node_auth_routes
node_user_routes -->|"dispatches"| node_user_controller
node_task_routes -->|"dispatches"| node_task_controller
node_category_routes -->|"dispatches"| node_category_controller
node_auth_routes -->|"dispatches"| node_auth_controller
node_user_controller -->|"uses types"| node_user_dto
node_user_controller -->|"gets repositories"| node_datasource
node_task_controller -->|"gets repositories"| node_datasource
node_category_controller -->|"gets repository"| node_datasource
node_auth_controller -->|"gets repository"| node_datasource
node_user_controller -->|"reads and writes"| node_user
node_user_controller -->|"uses in transaction"| node_task
node_task_controller -->|"reads and writes"| node_task
node_task_controller -->|"checks user"| node_user
node_task_controller -->|"checks category"| node_category
node_category_controller -->|"reads and writes"| node_category
node_auth_controller -->|"looks up account"| node_user
node_task -->|"relates to"| node_user
node_task -->|"relates to"| node_category
node_task -->|"relates to"| node_tag
node_datasource -->|"registers entity"| node_user
node_datasource -->|"registers entity"| node_task
node_datasource -->|"registers entity"| node_category
node_datasource -->|"registers entity"| node_tag
node_datasource -->|"configures connection"| node_mysql
node_datasource -->|"configures migrations"| node_migrations

click node_server "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/index.ts"
click node_logger "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/middleware/requestLogger.ts"
click node_user_routes "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/userRoutes.ts"
click node_task_routes "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/taskRoutes.ts"
click node_category_routes "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/categoryRoutes.ts"
click node_auth_routes "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/authRoutes.ts"
click node_user_controller "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/UserController.ts"
click node_task_controller "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/taskController.ts"
click node_category_controller "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/categoryController.ts"
click node_auth_controller "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/authController.ts"
click node_user_dto "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/dto/userDto.ts"
click node_task_repository "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/repositories/TaskRepository.ts"
click node_datasource "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/config/data-source.ts"
click node_user "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/User.ts"
click node_task "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Task.ts"
click node_category "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Category.ts"
click node_tag "https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Tag.ts"
click node_migrations "https://github.com/shaundelcastillo/-midterm-crud-api/tree/main/src/migrations"

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_logger,node_user_routes,node_task_routes,node_category_routes,node_auth_routes,node_client toneBlue
class node_user_controller,node_task_controller,node_category_controller,node_auth_controller,node_user_dto,node_task_repository toneAmber
class node_datasource,node_user,node_task,node_category,node_tag,node_mysql toneMint
class node_migrations toneRose
```

## Components

### HTTP entry

- [Server and v1 routing](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/index.ts): `src/index.ts`
- [Request logger](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/middleware/requestLogger.ts): `src/middleware/requestLogger.ts`
- [User routes](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/userRoutes.ts): `src/routes/userRoutes.ts`
- [Task routes](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/taskRoutes.ts): `src/routes/taskRoutes.ts`
- [Category routes](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/categoryRoutes.ts): `src/routes/categoryRoutes.ts`
- [Auth routes](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/routes/authRoutes.ts): `src/routes/authRoutes.ts`

### API operations

- [User operations](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/UserController.ts): `src/controllers/UserController.ts`
- [Task operations](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/taskController.ts): `src/controllers/taskController.ts`
- [Category operations](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/categoryController.ts): `src/controllers/categoryController.ts`
- [Login](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/controllers/authController.ts): `src/controllers/authController.ts`
- [User DTOs](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/dto/userDto.ts): `src/dto/userDto.ts`
- [Task repository helper](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/repositories/TaskRepository.ts): `src/repositories/TaskRepository.ts`

### Domain and persistence

- [TypeORM data source](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/config/data-source.ts): `src/config/data-source.ts`
- [User entity](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/User.ts): `src/entities/User.ts`
- [Task entity](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Task.ts): `src/entities/Task.ts`
- [Category entity](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Category.ts): `src/entities/Category.ts`
- [Tag entity](https://github.com/shaundelcastillo/-midterm-crud-api/blob/main/src/entities/Tag.ts): `src/entities/Tag.ts`
- **MySQL database**

### Schema management

- [Schema migrations](https://github.com/shaundelcastillo/-midterm-crud-api/tree/main/src/migrations): `src/migrations`

### Other components

- **API client**

## Connections

- API client → Server and v1 routing: sends requests (evidence: `src/index.ts`)
- Server and v1 routing → Request logger: registers middleware (evidence: `src/index.ts`)
- Server and v1 routing → User routes: mounts v1 routes (evidence: `src/index.ts`)
- Server and v1 routing → Task routes: mounts v1 routes (evidence: `src/index.ts`)
- Server and v1 routing → Category routes: mounts v1 routes (evidence: `src/index.ts`)
- Server and v1 routing → Auth routes: mounts v1 routes (evidence: `src/index.ts`)
- User routes → User operations: dispatches (evidence: `src/routes/userRoutes.ts`)
- Task routes → Task operations: dispatches (evidence: `src/routes/taskRoutes.ts`)
- Category routes → Category operations: dispatches (evidence: `src/routes/categoryRoutes.ts`)
- Auth routes → Login: dispatches (evidence: `src/routes/authRoutes.ts`)
- User operations → User DTOs: uses types (evidence: `src/controllers/UserController.ts`)
- User operations → TypeORM data source: gets repositories (evidence: `src/controllers/UserController.ts`)
- Task operations → TypeORM data source: gets repositories (evidence: `src/controllers/taskController.ts`)
- Category operations → TypeORM data source: gets repository (evidence: `src/controllers/categoryController.ts`)
- Login → TypeORM data source: gets repository (evidence: `src/controllers/authController.ts`)
- User operations → User entity: reads and writes (evidence: `src/controllers/UserController.ts`)
- User operations → Task entity: uses in transaction (evidence: `src/controllers/UserController.ts`)
- Task operations → Task entity: reads and writes (evidence: `src/controllers/taskController.ts`)
- Task operations → User entity: checks user (evidence: `src/controllers/taskController.ts`)
- Task operations → Category entity: checks category (evidence: `src/controllers/taskController.ts`)
- Category operations → Category entity: reads and writes (evidence: `src/controllers/categoryController.ts`)
- Login → User entity: looks up account (evidence: `src/controllers/authController.ts`)
- Task entity → User entity: relates to (evidence: `src/entities/Task.ts`)
- Task entity → Category entity: relates to (evidence: `src/entities/Task.ts`)
- Task entity → Tag entity: relates to (evidence: `src/entities/Task.ts`)
- TypeORM data source → User entity: registers entity (evidence: `src/config/data-source.ts`)
- TypeORM data source → Task entity: registers entity (evidence: `src/config/data-source.ts`)
- TypeORM data source → Category entity: registers entity (evidence: `src/config/data-source.ts`)
- TypeORM data source → Tag entity: registers entity (evidence: `src/config/data-source.ts`)
- TypeORM data source → MySQL database: configures connection (evidence: `src/config/data-source.ts`)
- TypeORM data source → Schema migrations: configures migrations (evidence: `src/config/data-source.ts`)
