# wevertonicaro/auto-parts architecture

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

- Interactive diagram: https://gitdiagram.com/wevertonicaro/auto-parts
- Repository: https://github.com/wevertonicaro/auto-parts

## Overview

Auto Parts is an Express REST API for managing an automotive-parts catalog, user accounts, and access tokens. The main workflow is a client request entering the HTTP app, passing through the composed router to a domain module, and receiving catalog or account results backed by TypeORM/MySQL. Catalog modules document create, find, update, delete, and—in automakers and cars—file import capabilities. Logging and log retrieval form a separate operational branch. Several module internals were not sampled, so their internal call paths are not asserted.

Main entry points: [`src/http/routes/index.ts`](https://github.com/wevertonicaro/auto-parts/blob/master/src/http/routes/index.ts) (API router), [`src/shared/container/index.ts`](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/container/index.ts) (DI container), [`src/http/main/app.ts`](https://github.com/wevertonicaro/auto-parts/blob/master/src/http/main/app.ts) (Express app), [`src/shared/infra/typeorm/database/dataSource.ts`](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/infra/typeorm/database/dataSource.ts) (TypeORM connection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP API"]
  node_app["Express app<br/>[app.ts]"]
  node_router["API router<br/>[index.ts]"]
end

subgraph group_catalog["Catalog Management"]
  node_automakers["Automakers"]
  node_automaker_import["Automaker import"]
  node_cars["Cars"]
  node_car_import["Car import"]
  node_car_models["Car models"]
  node_parts["Parts"]
end

subgraph group_identity["Identity &amp; Access"]
  node_users["Users"]
  node_groups["User groups"]
  node_auth["Authentication"]
end

subgraph group_operations["Persistence &amp; Operations"]
  node_health["Health check"]
  node_logs_api["Log query API<br/>[logs.controller.ts]"]
  node_typeorm[("TypeORM connection<br/>[dataSource.ts]")]
  node_mongo[("MongoDB logs<br/>[index.ts]")]
  node_logger["Winston logger<br/>[index.ts]"]
  node_container["DI container<br/>[index.ts]"]
  node_csv_reader["CSV reader<br/>[CsvReader.ts]"]
  node_excel_reader["Excel reader<br/>[ExcelReader.ts]"]
end

node_client(("API client"))

node_client -->|"sends request"| node_app
node_app -->|"mounts routes"| node_router
node_router -->|"dispatches to"| node_automakers
node_router -->|"dispatches to"| node_cars
node_router -->|"dispatches to"| node_car_models
node_router -->|"dispatches to"| node_groups
node_router -->|"dispatches to"| node_health
node_router -->|"dispatches to"| node_logs_api
node_router -->|"dispatches to"| node_parts
node_router -->|"dispatches to"| node_users
node_router -->|"dispatches to"| node_auth
node_automakers -.->|"offers import"| node_automaker_import
node_automaker_import -->|"reads CSV"| node_csv_reader
node_automaker_import -->|"reads Excel"| node_excel_reader
node_cars -.->|"offers import"| node_car_import
node_cars -.->|"persists catalog"| node_typeorm
node_car_models -.->|"persists catalog"| node_typeorm
node_parts -.->|"persists catalog"| node_typeorm
node_automakers -->|"persists catalog"| node_typeorm
node_users -->|"reads users"| node_typeorm
node_app -->|"initializes connection"| node_typeorm
node_app -->|"connects logs"| node_mongo
node_logs_api -->|"queries logs"| node_mongo
node_logger -->|"stores log entries"| node_mongo
node_app -->|"logs requests"| node_logger
node_app -->|"loads registrations"| node_container
node_container -->|"registers repository"| node_automakers
node_container -->|"registers repository"| node_cars
node_container -->|"registers repository"| node_car_models
node_container -->|"registers repository"| node_groups
node_container -->|"registers repositories"| node_parts
node_container -->|"registers repository"| node_users
node_container -->|"registers token store"| node_auth

click node_app "https://github.com/wevertonicaro/auto-parts/blob/master/src/http/main/app.ts"
click node_router "https://github.com/wevertonicaro/auto-parts/blob/master/src/http/routes/index.ts"
click node_automakers "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Automaker"
click node_automaker_import "https://github.com/wevertonicaro/auto-parts/blob/master/src/modules/Automaker/useCases/import/ImportAutomakerList.service.ts"
click node_cars "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Car"
click node_car_import "https://github.com/wevertonicaro/auto-parts/blob/master/src/modules/Car/useCases/import/ImportCarList.service.ts"
click node_car_models "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/CarModels"
click node_parts "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Parts"
click node_users "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/User"
click node_groups "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/GroupUser"
click node_auth "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/auth"
click node_health "https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Health"
click node_logs_api "https://github.com/wevertonicaro/auto-parts/blob/master/src/modules/Logs/useCase/logs.controller.ts"
click node_typeorm "https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/infra/typeorm/database/dataSource.ts"
click node_mongo "https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/infra/mongodb/index.ts"
click node_logger "https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/utils/logger/index.ts"
click node_container "https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/container/index.ts"
click node_csv_reader "https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/utils/CsvReader/CsvReader.ts"
click node_excel_reader "https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/utils/ExcelReader/ExcelReader.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_app,node_router,node_client toneBlue
class node_automakers,node_automaker_import,node_cars,node_car_import,node_car_models,node_parts toneAmber
class node_users,node_groups,node_auth toneMint
class node_health,node_logs_api,node_typeorm,node_mongo,node_logger,node_container,node_csv_reader,node_excel_reader toneRose
```

## Components

### HTTP API

- [Express app](https://github.com/wevertonicaro/auto-parts/blob/master/src/http/main/app.ts): `src/http/main/app.ts`
- [API router](https://github.com/wevertonicaro/auto-parts/blob/master/src/http/routes/index.ts): `src/http/routes/index.ts`

### Catalog Management

- [Automakers](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Automaker): `src/modules/Automaker`
- [Automaker import](https://github.com/wevertonicaro/auto-parts/blob/master/src/modules/Automaker/useCases/import/ImportAutomakerList.service.ts): `src/modules/Automaker/useCases/import/ImportAutomakerList.service.ts`
- [Cars](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Car): `src/modules/Car`
- [Car import](https://github.com/wevertonicaro/auto-parts/blob/master/src/modules/Car/useCases/import/ImportCarList.service.ts): `src/modules/Car/useCases/import/ImportCarList.service.ts`
- [Car models](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/CarModels): `src/modules/CarModels`
- [Parts](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Parts): `src/modules/Parts`

### Identity & Access

- [Users](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/User): `src/modules/User`
- [User groups](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/GroupUser): `src/modules/GroupUser`
- [Authentication](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/auth): `src/modules/auth`

### Persistence & Operations

- [Health check](https://github.com/wevertonicaro/auto-parts/tree/master/src/modules/Health): `src/modules/Health`
- [Log query API](https://github.com/wevertonicaro/auto-parts/blob/master/src/modules/Logs/useCase/logs.controller.ts): `src/modules/Logs/useCase/logs.controller.ts`
- [TypeORM connection](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/infra/typeorm/database/dataSource.ts): `src/shared/infra/typeorm/database/dataSource.ts`
- [MongoDB logs](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/infra/mongodb/index.ts): `src/shared/infra/mongodb/index.ts`
- [Winston logger](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/utils/logger/index.ts): `src/shared/utils/logger/index.ts`
- [DI container](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/container/index.ts): `src/shared/container/index.ts`
- [CSV reader](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/utils/CsvReader/CsvReader.ts): `src/shared/utils/CsvReader/CsvReader.ts`
- [Excel reader](https://github.com/wevertonicaro/auto-parts/blob/master/src/shared/utils/ExcelReader/ExcelReader.ts): `src/shared/utils/ExcelReader/ExcelReader.ts`

### Other components

- **API client**

## Connections

- API client → Express app: sends request
- Express app → API router: mounts routes (evidence: `src/http/main/app.ts`)
- API router → Automakers: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Cars: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Car models: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → User groups: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Health check: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Log query API: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Parts: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Users: dispatches to (evidence: `src/http/routes/index.ts`)
- API router → Authentication: dispatches to (evidence: `src/http/routes/index.ts`)
- Automakers → Automaker import: offers import (evidence: `src/modules/Automaker/useCases/import/ImportAutomakerList.controller.ts`)
- Automaker import → CSV reader: reads CSV (evidence: `src/modules/Automaker/useCases/import/ImportAutomakerList.service.ts`)
- Automaker import → Excel reader: reads Excel (evidence: `src/modules/Automaker/useCases/import/ImportAutomakerList.service.ts`)
- Cars → Car import: offers import (evidence: `src/modules/Car/useCases/import/ImportCarList.controller.ts`)
- Cars → TypeORM connection: persists catalog (evidence: `src/modules/Car/repositories/implementations/CarRepository.ts`)
- Car models → TypeORM connection: persists catalog
- Parts → TypeORM connection: persists catalog
- Automakers → TypeORM connection: persists catalog (evidence: `src/modules/Automaker/repositories/implementations/AutomakerRepository.ts`)
- Users → TypeORM connection: reads users (evidence: `src/modules/User/repositories/implementations/UserRepository.ts`)
- Express app → TypeORM connection: initializes connection (evidence: `src/http/main/app.ts`)
- Express app → MongoDB logs: connects logs (evidence: `src/http/main/app.ts`)
- Log query API → MongoDB logs: queries logs (evidence: `src/modules/Logs/useCase/logs.controller.ts`)
- Winston logger → MongoDB logs: stores log entries (evidence: `src/shared/utils/logger/index.ts`)
- Express app → Winston logger: logs requests (evidence: `src/http/main/app.ts`)
- Express app → DI container: loads registrations (evidence: `src/http/main/app.ts`)
- DI container → Automakers: registers repository (evidence: `src/shared/container/index.ts`)
- DI container → Cars: registers repository (evidence: `src/shared/container/index.ts`)
- DI container → Car models: registers repository (evidence: `src/shared/container/index.ts`)
- DI container → User groups: registers repository (evidence: `src/shared/container/index.ts`)
- DI container → Parts: registers repositories (evidence: `src/shared/container/index.ts`)
- DI container → Users: registers repository (evidence: `src/shared/container/index.ts`)
- DI container → Authentication: registers token store (evidence: `src/shared/container/index.ts`)
