# liangonzzz/proyecto_talentis_uni architecture

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

- Interactive diagram: https://gitdiagram.com/liangonzzz/proyecto_talentis_uni
- Repository: https://github.com/liangonzzz/proyecto_talentis_uni

## Overview

1. **Repository shape**
   - This is a **full-stack TypeScript project** for a HR management platform (“Plataforma web de gestión de RR.HH.”).
   - The repository is split into two major runtimes:
     - `backend/`: implemented and wired.
     - `frontend/`: mostly scaffolded, with architecture folders in place but no concrete feature code yet.

2. **Backend entrypoint and runtime boundary**
   - `backend/src/index.ts` is the application entrypoint and is the top-level composition root.
   - The backend is organized as a layered architecture with clear separation between:
     - **application**: use cases
     - **domain**: core entities and repository contracts
     - **infrastructure**: HTTP and database adapters

3. **Domain layer: core business model**
   - `backend/src/domain/models/Usuario.ts` holds the central business entity currently visible in the repo: the user/employee account model.
   - `backend/src/domain/ports/IUsuarioRepository.ts.ts` defines the persistence contract for users. This keeps the domain independent from the database implementation.
   - The domain layer is where the project’s business rules are intended to remain stable.

4. **Application layer: use-case orchestration**
   - `backend/src/application/usecases/LoginUseCase.ts` is the main business workflow currently implemented.
   - It coordinates login logic without knowing HTTP details or database details directly.
   - Its dependency on the repository port shows the intended direction of dependencies: application depends on domain abstractions, not infrastructure.

5. **HTTP adapter: request handling and routing**
   - `backend/src/infrastructure/http/controllers/AuthController.ts` receives HTTP requests and translates them into use-case calls.
   - `backend/src/infrastructure/http/routes/auth.routes.ts` binds URLs/endpoints to controller methods.
   - This layer is the boundary between external clients and the application layer.

6. **Persistence adapter: database access**
   - `backend/src/infrastructure/db/UsuarioRepository.ts` is the concrete implementation of the user repository contract.
   - `backend/src/infrastructure/db/connection.ts` centralizes database connectivity.
   - The flow is: controller → use case → repository contract → repository implementation → DB connection.

7. **Database structure and schema evolution**
   - `database/migrations/` indicates schema/version management is part of the architecture.
   - Even though only a placeholder is present, this folder implies the database is expected to evolve independently of the application code through migrations.

8. **Backend data flow**
   - The only visible end-to-end feature is authentication:
     - a client hits an auth route
     - the controller handles the request
     - `LoginUseCase` performs the login workflow
     - `UsuarioRepository` reads/writes user data through the DB connection
     - the result is returned back through the controller
   - This is a classic clean-architecture style flow with domain and application logic isolated from transport and persistence.

9. **Frontend architecture intent**
   - `frontend/src/` mirrors the same layered naming scheme:
     - `application`
     - `domain`
     - `infrastructure`
   - Under `frontend/src/infrastructure/ui/modules/`, the project is pre-split into functional areas:
     - `admin`
     - `auth`
     - `candidato`
     - `empleado`
     - `jefe`
     - `shared`
   - This strongly suggests the UI is intended to be role/module-based, with shared UI components and separate screens per persona.

10. **Frontend as a consumer boundary**
   - The `frontend/src/infrastructure/api/` and `frontend/src/infrastructure/storage/` folders indicate planned separation between:
     - remote API access
     - local persistence/session storage
   - At present, these are scaffolds only, so the frontend is architecturally prepared to consume the backend but not yet populated with concrete behavior.

11. **Cross-cutting architectural boundary**
   - The repo follows a **dependency inversion** pattern:
     - business rules live in domain/application
     - HTTP and database are replaceable infrastructure adapters
   - That makes it easier to diagram the system as a set of concentric or layered boundaries rather than a single monolithic app.

12. **What is actually implemented vs. scaffolded**
   - Implemented:
     - backend composition
     - authentication use case
     - HTTP auth routes/controller
     - user repository contract and DB adapter
   - Scaffolded:
     - broader frontend modules
     - additional backend domains beyond user/login
     - database migrations content

13. **Practical architecture diagram takeaway**
   - The most accurate diagram would show:
     - a **frontend client** area with role-based UI modules
     - a **backend API** area centered on auth/login
     - a **domain/application core** in the backend
     - a **database/persistence** area accessed through repository adapters
   - The key architectural boundary is that business logic is not embedded in controllers or DB code; it sits in the use-case and domain layers.

Main entry points: [`backend/src/application/usecases/LoginUseCase.ts`](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/application/usecases/LoginUseCase.ts) (Login use case), [`frontend/src/infrastructure`](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure) (Frontend infra), [`backend/src/index.ts`](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/index.ts) (App entry), [`backend/src/infrastructure/db/UsuarioRepository.ts`](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/db/UsuarioRepository.ts) (User repo)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_backend_index(("App entry<br/>composition root<br/>[index.ts]"))
  node_backend_routes["Auth routes<br/>http routes<br/>[auth.routes.ts]"]
  node_backend_controller["Auth controller<br/>http controller<br/>[AuthController.ts]"]
  node_backend_login_uc["Login use case<br/>application use case<br/>[LoginUseCase.ts]"]
  node_backend_usuario_model{{"Usuario<br/>domain entity<br/>[Usuario.ts]"}}
  node_backend_usuario_port["User port<br/>domain repository port"]
  node_backend_usuario_repo["User repo<br/>db repository"]
  node_backend_db_conn[("DB connection<br/>database adapter<br/>[connection.ts]")]
end

subgraph group_frontend["Frontend"]
  node_frontend_ui["UI modules"]
  node_frontend_api["API client<br/>frontend api"]
  node_frontend_storage["Local storage<br/>frontend storage"]
  node_frontend_app["Frontend app<br/>frontend core"]
  node_frontend_domain["Frontend domain<br/>frontend core"]
  node_frontend_infra["Frontend infra<br/>frontend core"]
end

subgraph group_data["Data"]
  node_migrations["Migrations<br/>schema versioning"]
end

node_backend_index -->|"wires"| node_backend_routes
node_backend_routes -->|"dispatches"| node_backend_controller
node_backend_controller -->|"calls"| node_backend_login_uc
node_backend_login_uc -->|"depends on"| node_backend_usuario_port
node_backend_login_uc -->|"uses"| node_backend_usuario_model
node_backend_usuario_repo -->|"implements"| node_backend_usuario_port
node_backend_usuario_repo -->|"uses"| node_backend_db_conn
node_backend_login_uc -.->|"persists via"| node_backend_usuario_repo
node_backend_index -.->|"exposes"| node_backend_controller
node_frontend_app -->|"layers"| node_frontend_domain
node_frontend_app -->|"layers"| node_frontend_infra
node_frontend_infra -->|"contains"| node_frontend_ui
node_frontend_infra -->|"contains"| node_frontend_api
node_frontend_infra -->|"contains"| node_frontend_storage
node_backend_index -.->|"serves"| node_frontend_api
node_migrations -.->|"supports"| node_backend_db_conn

click node_backend_index "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/index.ts"
click node_backend_routes "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/http/routes/auth.routes.ts"
click node_backend_controller "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/http/controllers/AuthController.ts"
click node_backend_login_uc "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/application/usecases/LoginUseCase.ts"
click node_backend_usuario_model "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/domain/models/Usuario.ts"
click node_backend_usuario_port "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/domain/ports/IUsuarioRepository.ts.ts"
click node_backend_usuario_repo "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/db/UsuarioRepository.ts"
click node_backend_db_conn "https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/db/connection.ts"
click node_frontend_ui "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure/ui/modules"
click node_frontend_api "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure/api"
click node_frontend_storage "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure/storage"
click node_frontend_app "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/application"
click node_frontend_domain "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/domain"
click node_frontend_infra "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure"
click node_migrations "https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/database/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_backend_index,node_backend_routes,node_backend_controller,node_backend_login_uc,node_backend_usuario_model,node_backend_usuario_port,node_backend_usuario_repo,node_backend_db_conn toneBlue
class node_frontend_ui,node_frontend_api,node_frontend_storage,node_frontend_app,node_frontend_domain,node_frontend_infra toneAmber
class node_migrations toneMint
```

## Components

### Backend

Implemented clean-architecture backend for auth and user persistence

- [App entry](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/index.ts): composition root · Backend startup and wiring · `backend/src/index.ts`
- [Auth routes](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/http/routes/auth.routes.ts): http routes · Maps auth endpoints to controller actions · `backend/src/infrastructure/http/routes/auth.routes.ts`
- [Auth controller](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/http/controllers/AuthController.ts): http controller · Translates HTTP requests into use-case calls · `backend/src/infrastructure/http/controllers/AuthController.ts`
- [Login use case](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/application/usecases/LoginUseCase.ts): application use case · Orchestrates authentication workflow · `backend/src/application/usecases/LoginUseCase.ts`
- [Usuario](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/domain/models/Usuario.ts): domain entity · Core user/employee account model · `backend/src/domain/models/Usuario.ts`
- [User port](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/domain/ports/IUsuarioRepository.ts.ts): domain repository port · Persistence contract for user access · `backend/src/domain/ports/IUsuarioRepository.ts.ts`
- [User repo](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/db/UsuarioRepository.ts): db repository · Concrete user repository implementation · `backend/src/infrastructure/db/UsuarioRepository.ts`
- [DB connection](https://github.com/liangonzzz/proyecto_talentis_uni/blob/main/backend/src/infrastructure/db/connection.ts): database adapter · Centralized database connectivity · `backend/src/infrastructure/db/connection.ts`

### Frontend

Scaffolded layered frontend prepared for role-based UI and API consumption

- [UI modules](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure/ui/modules): ui modules · Role-based screen areas and shared UI · `frontend/src/infrastructure/ui/modules`
- [API client](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure/api): frontend api · Planned remote API access layer · `frontend/src/infrastructure/api`
- [Local storage](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure/storage): frontend storage · Planned session and local persistence layer · `frontend/src/infrastructure/storage`
- [Frontend app](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/application): frontend core · Layered frontend application scaffold · `frontend/src/application`
- [Frontend domain](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/domain): frontend core · Frontend domain scaffold · `frontend/src/domain`
- [Frontend infra](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/frontend/src/infrastructure): frontend core · Frontend infrastructure scaffold · `frontend/src/infrastructure`

### Data

Database schema evolution and persistence boundary

- [Migrations](https://github.com/liangonzzz/proyecto_talentis_uni/tree/main/database/migrations): schema versioning · Database migration area · `database/migrations`

## Connections

- App entry → Auth routes: wires · Composition root registers HTTP routes
- Auth routes → Auth controller: dispatches · Routes map requests to controller methods
- Auth controller → Login use case: calls · Controller invokes login workflow
- Login use case → User port: depends on · Use case targets the domain contract
- Login use case → Usuario: uses · Login logic centers on the user model
- User repo → User port: implements · Infrastructure satisfies the domain port
- User repo → DB connection: uses · Repository executes through shared DB connection
- Login use case → User repo: persists via · Authentication data flows through repository implementation
- App entry → Auth controller: exposes · Backend exposes HTTP auth handling
- Frontend app → Frontend domain: layers · Frontend mirrors layered architecture
- Frontend app → Frontend infra: layers · Frontend mirrors layered architecture
- Frontend infra → UI modules: contains · UI modules live in infrastructure layer
- Frontend infra → API client: contains · Remote API access boundary
- Frontend infra → Local storage: contains · Local storage boundary
- App entry → API client: serves · Frontend is intended to consume backend services
- Migrations → DB connection: supports · Schema evolution supports persistence layer
