# ivanpavlovic-web/piaiws_taskmanager architecture

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

- Interactive diagram: https://gitdiagram.com/ivanpavlovic-web/piaiws_taskmanager
- Repository: https://github.com/ivanpavlovic-web/piaiws_taskmanager

## Overview

PIAiWS Task Manager is a browser-based task-management SPA backed by a PHP JSON API and SQLite. The principal workflow is: a user registers or logs in, manages categories and tasks, and views tasks filtered by category, status, or title; the API enforces session authentication and user ownership before returning results. The frontend responsibilities share app.js, while PHP routing dispatches to separate user, category, and task controllers. The excerpts show those controller and database interactions; frontend details beyond the sampled handlers are based on the README and file tree.

Main entry points: [`api/routes.php`](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/routes.php) (Route dispatcher), [`api/db.php`](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/db.php) (Database access), [`api/index.php`](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/index.php) (API entry), [`api/controllers/UserController.php`](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/UserController.php) (User accounts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Browser app"]
  node_shell["SPA shell<br/>[index.html]"]
  node_ui["App interactions<br/>[app.js]"]
end

subgraph group_api["API routing"]
  node_api_entry["API entry<br/>[index.php]"]
  node_dispatcher["Route dispatcher<br/>[routes.php]"]
end

subgraph group_domain["Domain services"]
  node_users["User accounts<br/>[UserController.php]"]
  node_categories["Category CRUD"]
  node_tasks["Task CRUD and filters<br/>[TaskController.php]"]
end

subgraph group_persistence["Session and storage"]
  node_auth["Session auth<br/>[auth.php]"]
  node_db_access["Database access<br/>[db.php]"]
  node_sqlite[("SQLite data<br/>[database.sqlite]")]
end

node_user(("User"))

node_user -->|"uses"| node_shell
node_shell -->|"loads"| node_ui
node_ui -->|"Fetch requests"| node_api_entry
node_api_entry -->|"starts session"| node_auth
node_api_entry -->|"dispatches"| node_dispatcher
node_dispatcher -->|"requires auth"| node_auth
node_dispatcher -->|"dispatches account"| node_users
node_dispatcher -->|"dispatches category"| node_categories
node_dispatcher -->|"dispatches task"| node_tasks
node_users -->|"queries"| node_db_access
node_categories -->|"queries"| node_db_access
node_tasks -->|"queries"| node_db_access
node_db_access -->|"reads and writes"| node_sqlite
node_users -->|"sets or clears session"| node_auth

click node_shell "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/index.html"
click node_ui "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/app.js"
click node_api_entry "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/index.php"
click node_dispatcher "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/routes.php"
click node_auth "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/auth.php"
click node_users "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/UserController.php"
click node_categories "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/CategoryController.php"
click node_tasks "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/TaskController.php"
click node_db_access "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/db.php"
click node_sqlite "https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/database.sqlite"

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_shell,node_ui,node_user toneBlue
class node_api_entry,node_dispatcher toneAmber
class node_users,node_categories,node_tasks toneMint
class node_auth,node_db_access,node_sqlite toneRose
```

## Components

### Browser app

- [SPA shell](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/index.html): `index.html`
- [App interactions](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/app.js): `app.js`

### API routing

- [API entry](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/index.php): `api/index.php`
- [Route dispatcher](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/routes.php): `api/routes.php`

### Domain services

- [User accounts](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/UserController.php): `api/controllers/UserController.php`
- [Category CRUD](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/CategoryController.php): `api/controllers/CategoryController.php`
- [Task CRUD and filters](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/controllers/TaskController.php): `api/controllers/TaskController.php`

### Session and storage

- [Session auth](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/auth.php): `api/auth.php`
- [Database access](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/api/db.php): `api/db.php`
- [SQLite data](https://github.com/ivanpavlovic-web/piaiws_taskmanager/blob/main/database.sqlite): `database.sqlite`

### Other components

- **User**

## Connections

- User → SPA shell: uses
- SPA shell → App interactions: loads
- App interactions → API entry: Fetch requests
- API entry → Session auth: starts session
- API entry → Route dispatcher: dispatches
- Route dispatcher → Session auth: requires auth
- Route dispatcher → User accounts: dispatches account
- Route dispatcher → Category CRUD: dispatches category
- Route dispatcher → Task CRUD and filters: dispatches task
- User accounts → Database access: queries
- Category CRUD → Database access: queries
- Task CRUD and filters → Database access: queries
- Database access → SQLite data: reads and writes
- User accounts → Session auth: sets or clears session
