# sebo05/tda25-diesel-for-life architecture

> Architecture diagram of the GitHub repository sebo05/tda25-diesel-for-life, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sebo05/tda25-diesel-for-life
- Repository: https://github.com/sebo05/tda25-diesel-for-life

## Overview

This is a small Nette PHP web application: HTTP requests enter through the front controller, which boots the framework and runs the application. The documented routes expose an organization JSON endpoint and a default homepage route; the API reads a JSON file and returns a JSON response. Error presenters handle bad requests and server errors. A contact presenter accepts a database dependency, and the README notes a bundled database, but no database operations are shown. Routing/configuration beyond the sampled route factory is not verified.

Main entry points: [`www/index.php`](https://github.com/sebo05/tda25-diesel-for-life/blob/main/www/index.php) (Front controller), [`app/Router/RouterFactory.php`](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Router/RouterFactory.php) (Route factory), [`app/Presenters/ErrorPresenter.php`](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ErrorPresenter.php) (Error presenter), [`app/Bootstrap.php`](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Bootstrap.php) (Bootstrap)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Application startup"]
  node_front["Front controller<br/>[index.php]"]
  node_bootstrap["Bootstrap<br/>[Bootstrap.php]"]
  node_router["Route factory<br/>[RouterFactory.php]"]
end

subgraph group_features["Request features"]
  node_api["Organization API<br/>[ApiPresenter.php]"]
  node_api_data["Organization data<br/>[Api.json]"]
  node_homepage["Homepage presenter"]
  node_contact["Contact presenter"]
end

subgraph group_errors["Error handling"]
  node_error["Error presenter<br/>[ErrorPresenter.php]"]
  node_error4xx["4xx presenter"]
  node_error_templates["4xx templates"]
  node_error500["500 template<br/>[500.phtml]"]
end

node_user(("HTTP client"))
node_framework["Nette application"]
node_database[("Database service")]

node_user -->|"sends request"| node_front
node_front -->|"boots"| node_bootstrap
node_front -->|"runs"| node_framework
node_bootstrap -->|"configures"| node_framework
node_router -->|"routes API"| node_api
node_router -->|"routes default"| node_homepage
node_api -->|"reads"| node_api_data
node_contact -->|"receives dependency"| node_database
node_error -->|"forwards bad requests"| node_error4xx
node_error4xx -->|"selects template"| node_error_templates
node_error -->|"renders on failure"| node_error500

click node_front "https://github.com/sebo05/tda25-diesel-for-life/blob/main/www/index.php"
click node_bootstrap "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Bootstrap.php"
click node_router "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Router/RouterFactory.php"
click node_api "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ApiPresenter.php"
click node_api_data "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/data/Api.json"
click node_homepage "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/HomepagePresenter.php"
click node_contact "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ContactPresenter.php"
click node_error "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ErrorPresenter.php"
click node_error4xx "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/Error4xxPresenter.php"
click node_error_templates "https://github.com/sebo05/tda25-diesel-for-life/tree/main/app/Presenters/templates/Error"
click node_error500 "https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/templates/Error/500.phtml"

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,node_bootstrap,node_router,node_user toneBlue
class node_api,node_api_data,node_homepage,node_contact,node_database toneAmber
class node_error,node_error4xx,node_error_templates,node_error500 toneMint
class node_framework toneIndigo
```

## Components

### Application startup

- [Front controller](https://github.com/sebo05/tda25-diesel-for-life/blob/main/www/index.php): `www/index.php`
- [Bootstrap](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Bootstrap.php): `app/Bootstrap.php`
- [Route factory](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Router/RouterFactory.php): `app/Router/RouterFactory.php`

### Request features

- [Organization API](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ApiPresenter.php): `app/Presenters/ApiPresenter.php`
- [Organization data](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/data/Api.json): `app/data/Api.json`
- [Homepage presenter](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/HomepagePresenter.php): `app/Presenters/HomepagePresenter.php`
- [Contact presenter](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ContactPresenter.php): `app/Presenters/ContactPresenter.php`

### Error handling

- [Error presenter](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/ErrorPresenter.php): `app/Presenters/ErrorPresenter.php`
- [4xx presenter](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/Error4xxPresenter.php): `app/Presenters/Error4xxPresenter.php`
- [4xx templates](https://github.com/sebo05/tda25-diesel-for-life/tree/main/app/Presenters/templates/Error): `app/Presenters/templates/Error`
- [500 template](https://github.com/sebo05/tda25-diesel-for-life/blob/main/app/Presenters/templates/Error/500.phtml): `app/Presenters/templates/Error/500.phtml`

### Other components

- **HTTP client**
- **Nette application**
- **Database service**

## Connections

- HTTP client → Front controller: sends request
- Front controller → Bootstrap: boots (evidence: `www/index.php`)
- Front controller → Nette application: runs (evidence: `www/index.php`)
- Bootstrap → Nette application: configures (evidence: `app/Bootstrap.php`)
- Route factory → Organization API: routes API (evidence: `app/Router/RouterFactory.php`)
- Route factory → Homepage presenter: routes default (evidence: `app/Router/RouterFactory.php`)
- Organization API → Organization data: reads (evidence: `app/Presenters/ApiPresenter.php`)
- Contact presenter → Database service: receives dependency (evidence: `app/Presenters/ContactPresenter.php`)
- Error presenter → 4xx presenter: forwards bad requests (evidence: `app/Presenters/ErrorPresenter.php`)
- 4xx presenter → 4xx templates: selects template (evidence: `app/Presenters/Error4xxPresenter.php`)
- Error presenter → 500 template: renders on failure (evidence: `app/Presenters/ErrorPresenter.php`)
