# remetulla17771/tinymvc architecture

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

- Interactive diagram: https://gitdiagram.com/remetulla17771/tinymvc
- Repository: https://github.com/remetulla17771/tinymvc

## Overview

TinyMVC is a PHP MVC framework with a sample site, an admin module, database-backed models, and console tools. Its main user workflow is an HTTP request entering the front controller, being routed to a controller, and producing a rendered view or response; the sample site also loads paginated user data. Separate branches cover authentication, errors and localization, admin modules, and console generation/migrations. The runtime and sample-site links are supported by excerpts or README statements; some documented subsystems were not sampled, so their internal calls are not expanded.

Main entry points: [`app/App.php`](https://github.com/remetulla17771/tinymvc/blob/main/app/App.php) (Application), [`app/controllers/SiteController.php`](https://github.com/remetulla17771/tinymvc/blob/main/app/controllers/SiteController.php) (Site controller), [`app/ActiveRecord.php`](https://github.com/remetulla17771/tinymvc/blob/main/app/ActiveRecord.php) (Active Record), [`app/Router.php`](https://github.com/remetulla17771/tinymvc/blob/main/app/Router.php) (Router)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_http["HTTP runtime"]
  node_front["Front controller<br/>[index.php]"]
  node_app["Application<br/>[App.php]"]
  node_request["Request<br/>[Request.php]"]
  node_router["Router<br/>[Router.php]"]
  node_response["Response<br/>[Response.php]"]
end

subgraph group_mvc["MVC and UI"]
  node_site["Site controller<br/>[SiteController.php]"]
  node_errorcontroller["Error controller"]
  node_views["Site views<br/>[index.php]"]
  node_layouts["Page layouts<br/>[main.php]"]
  node_widgets["UI helpers<br/>[GridView.php]"]
  node_admin["Admin module<br/>[Module.php]"]
end

subgraph group_data["Data and identity"]
  node_user["User model<br/>[User.php]"]
  node_news["News model<br/>[News.php]"]
  node_activerecord["Active Record<br/>[ActiveRecord.php]"]
  node_query["Query builder<br/>[Query.php]"]
  node_db[("PDO database<br/>[Db.php]")]
end

subgraph group_services["Framework services"]
  node_auth["Authentication<br/>[AuthService.php]"]
  node_i18n["Translations<br/>[I18n.php]"]
  node_errors["Error handling<br/>[ErrorHandler.php]"]
end

subgraph group_console["Console tools"]
  node_consoleentry["Console entry<br/>[console.php]"]
  node_consoleapp["Console application"]
  node_generators["Code generators"]
  node_migrations["Migration commands<br/>[MigrateCommand.php]"]
end

node_browser(("Browser"))

node_browser -->|"sends request"| node_front
node_front -->|"starts"| node_app
node_app -->|"creates"| node_request
node_app -->|"creates"| node_router
node_app -->|"logs failures"| node_errors
node_router -->|"dispatches"| node_site
node_router -->|"routes modules"| node_admin
node_site -->|"queries"| node_user
node_site -->|"renders"| node_views
node_site -->|"redirects"| node_response
node_app -->|"renders errors"| node_errorcontroller
node_errorcontroller -->|"returns view"| node_response
node_response -->|"sends output"| node_browser
node_views -->|"renders widgets"| node_widgets
node_site -->|"renders layout"| node_layouts
node_user -->|"extends"| node_activerecord
node_news -->|"extends"| node_activerecord
node_activerecord -->|"provides queries"| node_query
node_activerecord -->|"uses database"| node_db
node_site -->|"checks identity"| node_auth
node_auth -->|"loads user"| node_user
node_app -->|"translates"| node_i18n
node_consoleentry -->|"starts"| node_consoleapp
node_consoleapp -->|"dispatches commands"| node_generators
node_consoleapp -->|"dispatches commands"| node_migrations
node_migrations -->|"applies migrations"| node_db

click node_front "https://github.com/remetulla17771/tinymvc/blob/main/web/index.php"
click node_app "https://github.com/remetulla17771/tinymvc/blob/main/app/App.php"
click node_request "https://github.com/remetulla17771/tinymvc/blob/main/app/Request.php"
click node_router "https://github.com/remetulla17771/tinymvc/blob/main/app/Router.php"
click node_response "https://github.com/remetulla17771/tinymvc/blob/main/app/Response.php"
click node_site "https://github.com/remetulla17771/tinymvc/blob/main/app/controllers/SiteController.php"
click node_errorcontroller "https://github.com/remetulla17771/tinymvc/blob/main/app/controllers/ErrorController.php"
click node_views "https://github.com/remetulla17771/tinymvc/blob/main/views/site/index.php"
click node_layouts "https://github.com/remetulla17771/tinymvc/blob/main/views/layouts/main.php"
click node_widgets "https://github.com/remetulla17771/tinymvc/blob/main/app/helpers/GridView.php"
click node_admin "https://github.com/remetulla17771/tinymvc/blob/main/modules/admin/Module.php"
click node_user "https://github.com/remetulla17771/tinymvc/blob/main/app/models/User.php"
click node_news "https://github.com/remetulla17771/tinymvc/blob/main/app/models/News.php"
click node_activerecord "https://github.com/remetulla17771/tinymvc/blob/main/app/ActiveRecord.php"
click node_query "https://github.com/remetulla17771/tinymvc/blob/main/app/Query.php"
click node_db "https://github.com/remetulla17771/tinymvc/blob/main/app/Db.php"
click node_auth "https://github.com/remetulla17771/tinymvc/blob/main/app/AuthService.php"
click node_i18n "https://github.com/remetulla17771/tinymvc/blob/main/app/helpers/I18n.php"
click node_errors "https://github.com/remetulla17771/tinymvc/blob/main/app/ErrorHandler.php"
click node_consoleentry "https://github.com/remetulla17771/tinymvc/blob/main/bin/console.php"
click node_consoleapp "https://github.com/remetulla17771/tinymvc/blob/main/app/console/ConsoleApplication.php"
click node_generators "https://github.com/remetulla17771/tinymvc/blob/main/app/console/MakeCrudCommand.php"
click node_migrations "https://github.com/remetulla17771/tinymvc/blob/main/app/console/MigrateCommand.php"

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_app,node_request,node_router,node_response,node_browser toneBlue
class node_site,node_errorcontroller,node_views,node_layouts,node_widgets,node_admin toneAmber
class node_user,node_news,node_activerecord,node_query,node_db toneMint
class node_auth,node_i18n,node_errors toneRose
class node_consoleentry,node_consoleapp,node_generators,node_migrations toneIndigo
```

## Components

### HTTP runtime

- [Front controller](https://github.com/remetulla17771/tinymvc/blob/main/web/index.php): `web/index.php`
- [Application](https://github.com/remetulla17771/tinymvc/blob/main/app/App.php): `app/App.php`
- [Request](https://github.com/remetulla17771/tinymvc/blob/main/app/Request.php): `app/Request.php`
- [Router](https://github.com/remetulla17771/tinymvc/blob/main/app/Router.php): `app/Router.php`
- [Response](https://github.com/remetulla17771/tinymvc/blob/main/app/Response.php): `app/Response.php`

### MVC and UI

- [Site controller](https://github.com/remetulla17771/tinymvc/blob/main/app/controllers/SiteController.php): `app/controllers/SiteController.php`
- [Error controller](https://github.com/remetulla17771/tinymvc/blob/main/app/controllers/ErrorController.php): `app/controllers/ErrorController.php`
- [Site views](https://github.com/remetulla17771/tinymvc/blob/main/views/site/index.php): `views/site/index.php`
- [Page layouts](https://github.com/remetulla17771/tinymvc/blob/main/views/layouts/main.php): `views/layouts/main.php`
- [UI helpers](https://github.com/remetulla17771/tinymvc/blob/main/app/helpers/GridView.php): `app/helpers/GridView.php`
- [Admin module](https://github.com/remetulla17771/tinymvc/blob/main/modules/admin/Module.php): `modules/admin/Module.php`

### Data and identity

- [User model](https://github.com/remetulla17771/tinymvc/blob/main/app/models/User.php): `app/models/User.php`
- [News model](https://github.com/remetulla17771/tinymvc/blob/main/app/models/News.php): `app/models/News.php`
- [Active Record](https://github.com/remetulla17771/tinymvc/blob/main/app/ActiveRecord.php): `app/ActiveRecord.php`
- [Query builder](https://github.com/remetulla17771/tinymvc/blob/main/app/Query.php): `app/Query.php`
- [PDO database](https://github.com/remetulla17771/tinymvc/blob/main/app/Db.php): `app/Db.php`

### Framework services

- [Authentication](https://github.com/remetulla17771/tinymvc/blob/main/app/AuthService.php): `app/AuthService.php`
- [Translations](https://github.com/remetulla17771/tinymvc/blob/main/app/helpers/I18n.php): `app/helpers/I18n.php`
- [Error handling](https://github.com/remetulla17771/tinymvc/blob/main/app/ErrorHandler.php): `app/ErrorHandler.php`

### Console tools

- [Console entry](https://github.com/remetulla17771/tinymvc/blob/main/bin/console.php): `bin/console.php`
- [Console application](https://github.com/remetulla17771/tinymvc/blob/main/app/console/ConsoleApplication.php): `app/console/ConsoleApplication.php`
- [Code generators](https://github.com/remetulla17771/tinymvc/blob/main/app/console/MakeCrudCommand.php): `app/console/MakeCrudCommand.php`
- [Migration commands](https://github.com/remetulla17771/tinymvc/blob/main/app/console/MigrateCommand.php): `app/console/MigrateCommand.php`

### Other components

- **Browser**

## Connections

- Browser → Front controller: sends request
- Front controller → Application: starts (evidence: `web/index.php`)
- Application → Request: creates (evidence: `app/App.php`)
- Application → Router: creates (evidence: `app/App.php`)
- Application → Error handling: logs failures (evidence: `app/App.php`)
- Router → Site controller: dispatches
- Router → Admin module: routes modules
- Site controller → User model: queries (evidence: `app/controllers/SiteController.php`)
- Site controller → Site views: renders
- Site controller → Response: redirects (evidence: `app/controllers/SiteController.php`)
- Application → Error controller: renders errors (evidence: `app/App.php`)
- Error controller → Response: returns view (evidence: `app/controllers/ErrorController.php`)
- Response → Browser: sends output
- Site views → UI helpers: renders widgets (evidence: `views/site/index.php`)
- Site controller → Page layouts: renders layout
- User model → Active Record: extends (evidence: `app/models/User.php`)
- News model → Active Record: extends (evidence: `app/models/News.php`)
- Active Record → Query builder: provides queries
- Active Record → PDO database: uses database
- Site controller → Authentication: checks identity (evidence: `app/controllers/SiteController.php`)
- Authentication → User model: loads user (evidence: `app/AuthService.php`)
- Application → Translations: translates (evidence: `app/App.php`)
- Console entry → Console application: starts (evidence: `bin/console.php`)
- Console application → Code generators: dispatches commands (evidence: `app/console/ConsoleApplication.php`)
- Console application → Migration commands: dispatches commands (evidence: `app/console/ConsoleApplication.php`)
- Migration commands → PDO database: applies migrations
