# martincarreno/uptask architecture

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

- Interactive diagram: https://gitdiagram.com/martincarreno/uptask
- Repository: https://github.com/martincarreno/uptask

## Overview

#### Purpose and Runtime
This is a PHP task/project management application with authentication, user dashboards, projects, and tasks. It uses Composer-managed PHP dependencies, a relational database initialized from `docs/script.sql`, and browser assets compiled with Gulp from SCSS/JavaScript into `public/build/`.

#### HTTP Entry and Routing
`public/index.php` is the public front controller. It loads application bootstrap code and dispatches requests through the custom router in `Router.php`. Application initialization and database wiring are centralized in `includes/app.php` and `includes/database.php`.

#### Controller Layer
Controllers own request handling, session/auth decisions, validation orchestration, and view/API responses:
- `controllers/LoginController.php` handles registration, login, account confirmation, password recovery, and reset flows.
- `controllers/DashboardController.php` serves authenticated dashboard, profile, password, and project creation/navigation views.
- `controllers/TareaController.php` exposes task-oriented operations, likely consumed asynchronously by the dashboard task UI.

#### Domain and Persistence Model
Models follow a shared Active Record persistence pattern:
- `models/ActiveRecord.php` provides database connection, CRUD conventions, validation, and model mapping.
- `models/Usuario.php` represents accounts and authentication-related state.
- `models/Proyecto.php` and `models/Tarea.php` represent the project/task hierarchy.
Database schema and relational constraints are defined in `docs/script.sql`; controllers should enforce ownership boundaries when resolving projects and tasks for the active user.

#### Authentication and Email Boundary
Authentication-related screens are rendered from `views/auth/`, while account confirmation and recovery messages are sent through `classes/Email.php`. The login controller is the boundary between HTTP/session state, `Usuario` persistence, and outbound email. Shared request/session utilities reside in `includes/funciones.php`.

#### Dashboard and Rendering Composition
Server-rendered pages use `views/layout.php` as the main layout and compose dashboard shell elements from `views/dashboard/header-dashboard.php`, `views/templates/sidebar.php`, and `views/templates/barra.php`. Project detail rendering occurs in `views/dashboard/proyecto.php`; its client behavior is paired with the task JavaScript bundle.

#### Client Assets and Task Interaction
Source assets are maintained under `src/` and emitted under `public/build/`:
- `src/js/tareas.js` drives interactive task behavior, likely calling task controller routes.
- `src/js/app.js` contains shared browser behavior.
- `src/scss/dashboard/_tareas.scss` and related dashboard styles define the task/project UI.
Compiled files such as `public/build/js/tareas.js` and `public/build/css/app.css` are the runtime assets served to browsers.

#### Primary Flow
A request enters `public/index.php`, routes via `Router.php`, and reaches an auth, dashboard, or task controller. Controllers load Active Record models through the shared database connection, then either render PHP views or return task-operation results to browser JavaScript. Auth flows may also invoke `classes/Email.php`; authenticated dashboard flows render projects/tasks and delegate interactive task updates to `src/js/tareas.js`’s compiled output.

Main entry points: [`controllers/LoginController.php`](https://github.com/martincarreno/uptask/blob/main/controllers/LoginController.php) (Login controller), [`controllers/DashboardController.php`](https://github.com/martincarreno/uptask/blob/main/controllers/DashboardController.php) (Dashboard controller), [`Router.php`](https://github.com/martincarreno/uptask/blob/main/Router.php) (Custom router), [`models/ActiveRecord.php`](https://github.com/martincarreno/uptask/blob/main/models/ActiveRecord.php) (Active Record)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP application"]
  node_front_controller["Public front controller<br/>PHP entry point<br/>[index.php]"]
  node_router{{"Custom router<br/>routing<br/>[Router.php]"}}
  node_app_bootstrap["Application bootstrap<br/>initialization<br/>[app.php]"]
  node_request_utilities["Session utilities<br/>request helpers<br/>[funciones.php]"]
  node_login_controller["Login controller<br/>auth controller"]
  node_dashboard_controller["Dashboard controller"]
  node_task_controller["Task controller<br/>task API controller"]
  node_email_service["Email service<br/>outbound email<br/>[Email.php]"]
end

subgraph group_domain["Domain &amp; persistence"]
  node_database_wiring["Database wiring<br/>connection setup<br/>[database.php]"]
  node_active_record["Active Record<br/>persistence base<br/>[ActiveRecord.php]"]
  node_user_model["User model<br/>account model<br/>[Usuario.php]"]
  node_project_model["Project model<br/>[Proyecto.php]"]
  node_task_model["Task model<br/>[Tarea.php]"]
  node_database_schema[("Relational database<br/>SQL schema<br/>[script.sql]")]
end

subgraph group_rendering["Rendering &amp; browser"]
  node_browser(("Browser<br/>client"))
  node_view_composition["Dashboard view composition<br/>PHP views<br/>[layout.php]"]
  node_task_source["Task interaction source<br/>browser JavaScript<br/>[tareas.js]"]
  node_task_bundle["Task JavaScript bundle<br/>served asset<br/>[tareas.js]"]
  node_dashboard_styles["Dashboard task styles<br/>SCSS source<br/>[_tareas.scss]"]
  node_app_styles["Application CSS bundle<br/>served asset<br/>[app.css]"]
end

node_browser -->|"HTTP requests"| node_front_controller
node_front_controller -->|"loads"| node_app_bootstrap
node_front_controller -->|"dispatches through"| node_router
node_app_bootstrap -->|"initializes"| node_database_wiring
node_router -->|"auth routes"| node_login_controller
node_router -->|"dashboard routes"| node_dashboard_controller
node_router -->|"task routes"| node_task_controller
node_login_controller -->|"sessions"| node_request_utilities
node_login_controller -->|"accounts"| node_user_model
node_login_controller -->|"confirmation and recovery"| node_email_service
node_dashboard_controller -->|"authenticated access"| node_request_utilities
node_dashboard_controller -->|"projects"| node_project_model
node_dashboard_controller -->|"tasks"| node_task_model
node_task_controller -->|"task operations"| node_task_model
node_active_record -->|"uses connection"| node_database_wiring
node_user_model -->|"extends"| node_active_record
node_project_model -->|"extends"| node_active_record
node_task_model -->|"extends"| node_active_record
node_database_wiring -->|"connects to"| node_database_schema
node_login_controller -->|"renders auth pages"| node_view_composition
node_dashboard_controller -->|"renders dashboard"| node_view_composition
node_view_composition -->|"serves task UI"| node_task_bundle
node_browser -->|"loads"| node_task_bundle
node_task_bundle -->|"asynchronous task requests"| node_task_controller
node_task_source -.->|"compiled into"| node_task_bundle
node_dashboard_styles -.->|"compiled into"| node_app_styles
node_browser -->|"loads"| node_app_styles

click node_front_controller "https://github.com/martincarreno/uptask/blob/main/public/index.php"
click node_router "https://github.com/martincarreno/uptask/blob/main/Router.php"
click node_app_bootstrap "https://github.com/martincarreno/uptask/blob/main/includes/app.php"
click node_database_wiring "https://github.com/martincarreno/uptask/blob/main/includes/database.php"
click node_request_utilities "https://github.com/martincarreno/uptask/blob/main/includes/funciones.php"
click node_login_controller "https://github.com/martincarreno/uptask/blob/main/controllers/LoginController.php"
click node_dashboard_controller "https://github.com/martincarreno/uptask/blob/main/controllers/DashboardController.php"
click node_task_controller "https://github.com/martincarreno/uptask/blob/main/controllers/TareaController.php"
click node_active_record "https://github.com/martincarreno/uptask/blob/main/models/ActiveRecord.php"
click node_user_model "https://github.com/martincarreno/uptask/blob/main/models/Usuario.php"
click node_project_model "https://github.com/martincarreno/uptask/blob/main/models/Proyecto.php"
click node_task_model "https://github.com/martincarreno/uptask/blob/main/models/Tarea.php"
click node_database_schema "https://github.com/martincarreno/uptask/blob/main/docs/script.sql"
click node_email_service "https://github.com/martincarreno/uptask/blob/main/classes/Email.php"
click node_view_composition "https://github.com/martincarreno/uptask/blob/main/views/layout.php"
click node_task_source "https://github.com/martincarreno/uptask/blob/main/src/js/tareas.js"
click node_task_bundle "https://github.com/martincarreno/uptask/blob/main/public/build/js/tareas.js"
click node_dashboard_styles "https://github.com/martincarreno/uptask/blob/main/src/scss/dashboard/_tareas.scss"
click node_app_styles "https://github.com/martincarreno/uptask/blob/main/public/build/css/app.css"

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_front_controller,node_router,node_app_bootstrap,node_request_utilities,node_login_controller,node_dashboard_controller,node_task_controller,node_email_service toneBlue
class node_database_wiring,node_active_record,node_user_model,node_project_model,node_task_model,node_database_schema toneAmber
class node_browser,node_view_composition,node_task_source,node_task_bundle,node_dashboard_styles,node_app_styles toneMint
```

## Components

### HTTP application

- [Public front controller](https://github.com/martincarreno/uptask/blob/main/public/index.php): PHP entry point · `public/index.php`
- [Custom router](https://github.com/martincarreno/uptask/blob/main/Router.php): routing · `Router.php`
- [Application bootstrap](https://github.com/martincarreno/uptask/blob/main/includes/app.php): initialization · `includes/app.php`
- [Session utilities](https://github.com/martincarreno/uptask/blob/main/includes/funciones.php): request helpers · `includes/funciones.php`
- [Login controller](https://github.com/martincarreno/uptask/blob/main/controllers/LoginController.php): auth controller · Handles registration, login, confirmation, and password recovery. · `controllers/LoginController.php`
- [Dashboard controller](https://github.com/martincarreno/uptask/blob/main/controllers/DashboardController.php): dashboard controller · `controllers/DashboardController.php`
- [Task controller](https://github.com/martincarreno/uptask/blob/main/controllers/TareaController.php): task API controller · `controllers/TareaController.php`
- [Email service](https://github.com/martincarreno/uptask/blob/main/classes/Email.php): outbound email · `classes/Email.php`

### Domain & persistence

- [Database wiring](https://github.com/martincarreno/uptask/blob/main/includes/database.php): connection setup · `includes/database.php`
- [Active Record](https://github.com/martincarreno/uptask/blob/main/models/ActiveRecord.php): persistence base · Provides CRUD, validation, mapping, and shared database access. · `models/ActiveRecord.php`
- [User model](https://github.com/martincarreno/uptask/blob/main/models/Usuario.php): account model · `models/Usuario.php`
- [Project model](https://github.com/martincarreno/uptask/blob/main/models/Proyecto.php): project model · `models/Proyecto.php`
- [Task model](https://github.com/martincarreno/uptask/blob/main/models/Tarea.php): task model · `models/Tarea.php`
- [Relational database](https://github.com/martincarreno/uptask/blob/main/docs/script.sql): SQL schema · Defines account, project, and task relations. · `docs/script.sql`

### Rendering & browser

- **Browser**: client
- [Dashboard view composition](https://github.com/martincarreno/uptask/blob/main/views/layout.php): PHP views · Layout, dashboard shell, and project detail rendering. · `views/layout.php`
- [Task interaction source](https://github.com/martincarreno/uptask/blob/main/src/js/tareas.js): browser JavaScript · `src/js/tareas.js`
- [Task JavaScript bundle](https://github.com/martincarreno/uptask/blob/main/public/build/js/tareas.js): served asset · `public/build/js/tareas.js`
- [Dashboard task styles](https://github.com/martincarreno/uptask/blob/main/src/scss/dashboard/_tareas.scss): SCSS source · `src/scss/dashboard/_tareas.scss`
- [Application CSS bundle](https://github.com/martincarreno/uptask/blob/main/public/build/css/app.css): served asset · `public/build/css/app.css`

## Connections

- Browser → Public front controller: HTTP requests
- Public front controller → Application bootstrap: loads
- Public front controller → Custom router: dispatches through
- Application bootstrap → Database wiring: initializes
- Custom router → Login controller: auth routes
- Custom router → Dashboard controller: dashboard routes
- Custom router → Task controller: task routes
- Login controller → Session utilities: sessions
- Login controller → User model: accounts
- Login controller → Email service: confirmation and recovery
- Dashboard controller → Session utilities: authenticated access
- Dashboard controller → Project model: projects
- Dashboard controller → Task model: tasks
- Task controller → Task model: task operations
- Active Record → Database wiring: uses connection
- User model → Active Record: extends
- Project model → Active Record: extends
- Task model → Active Record: extends
- Database wiring → Relational database: connects to
- Login controller → Dashboard view composition: renders auth pages
- Dashboard controller → Dashboard view composition: renders dashboard
- Dashboard view composition → Task JavaScript bundle: serves task UI
- Browser → Task JavaScript bundle: loads
- Task JavaScript bundle → Task controller: asynchronous task requests
- Task interaction source → Task JavaScript bundle: compiled into
- Dashboard task styles → Application CSS bundle: compiled into
- Browser → Application CSS bundle: loads
