# schery19/gravity-framework architecture

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

- Interactive diagram: https://gitdiagram.com/schery19/gravity-framework
- Repository: https://github.com/schery19/gravity-framework

## Overview

GRAVITY is a small PHP web-app scaffold built on the external Gravity Core framework. Its visible request path starts at the public front controller, dispatches a route, and renders a page or handled error through the app controller and templates. Configuration supplies view and asset paths; database settings exist, but no shown code uses them. The repository also provides thin repository, resource, and entity-layer scaffolding. The README describes project creation and a CLI, but the CLI implementation is not shown; unsampled route wiring is therefore not inferred.

Main entry points: [`public/index.php`](https://github.com/schery19/gravity-framework/blob/main/public/index.php) (Front controller), [`src/app/Controllers/BaseController.php`](https://github.com/schery19/gravity-framework/blob/main/src/app/Controllers/BaseController.php) (Base controller), [`src/app/Entity/Entity.php`](https://github.com/schery19/gravity-framework/blob/main/src/app/Entity/Entity.php) (Entity base), [`src/app/Repository/Repository.php`](https://github.com/schery19/gravity-framework/blob/main/src/app/Repository/Repository.php) (Repository base)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request handling"]
  node_front["Front controller<br/>[index.php]"]
  node_router["Gravity Core router"]
  node_user_routes["User routes<br/>[UsersRoutes.php]"]
  node_base_controller["Base controller<br/>[BaseController.php]"]
end

subgraph group_views["Presentation"]
  node_welcome["Welcome view<br/>[welcome.php]"]
  node_layout["Shared layout<br/>[layout.php]"]
  node_error_views["Error views"]
end

subgraph group_scaffold["App scaffolding"]
  node_app_config["App configuration<br/>[configs.php]"]
  node_database_config["Database settings<br/>[database.php]"]
  node_entity["Entity base<br/>[Entity.php]"]
  node_repository["Repository base<br/>[Repository.php]"]
  node_resource["Resource base<br/>[Resource.php]"]
end

node_visitor(("Browser visitor"))

node_visitor -->|"requests page"| node_front
node_front -->|"loads config"| node_app_config
node_front -->|"dispatches route"| node_router
node_front -->|"invokes controller"| node_base_controller
node_base_controller -->|"renders view"| node_welcome
node_base_controller -->|"renders layout"| node_layout
node_base_controller -->|"renders errors"| node_error_views
node_entity -.->|"extends core entity"| node_router
node_repository -.->|"extends core repository"| node_router
node_resource -.->|"extends core resource"| node_router

click node_front "https://github.com/schery19/gravity-framework/blob/main/public/index.php"
click node_user_routes "https://github.com/schery19/gravity-framework/blob/main/src/routes/UsersRoutes.php"
click node_base_controller "https://github.com/schery19/gravity-framework/blob/main/src/app/Controllers/BaseController.php"
click node_app_config "https://github.com/schery19/gravity-framework/blob/main/configs/configs.php"
click node_database_config "https://github.com/schery19/gravity-framework/blob/main/configs/database.php"
click node_entity "https://github.com/schery19/gravity-framework/blob/main/src/app/Entity/Entity.php"
click node_repository "https://github.com/schery19/gravity-framework/blob/main/src/app/Repository/Repository.php"
click node_resource "https://github.com/schery19/gravity-framework/blob/main/src/app/Resources/Resource.php"
click node_welcome "https://github.com/schery19/gravity-framework/blob/main/templates/GRAVITY/welcome.php"
click node_layout "https://github.com/schery19/gravity-framework/blob/main/templates/GRAVITY/layout.php"
click node_error_views "https://github.com/schery19/gravity-framework/tree/main/templates/GRAVITY/ERRORS"

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_router,node_user_routes,node_base_controller,node_visitor toneBlue
class node_welcome,node_layout,node_error_views toneAmber
class node_app_config,node_database_config,node_entity,node_repository,node_resource toneMint
```

## Components

### Request handling

- [Front controller](https://github.com/schery19/gravity-framework/blob/main/public/index.php): `public/index.php`
- **Gravity Core router**
- [User routes](https://github.com/schery19/gravity-framework/blob/main/src/routes/UsersRoutes.php): `src/routes/UsersRoutes.php`
- [Base controller](https://github.com/schery19/gravity-framework/blob/main/src/app/Controllers/BaseController.php): `src/app/Controllers/BaseController.php`

### Presentation

- [Welcome view](https://github.com/schery19/gravity-framework/blob/main/templates/GRAVITY/welcome.php): `templates/GRAVITY/welcome.php`
- [Shared layout](https://github.com/schery19/gravity-framework/blob/main/templates/GRAVITY/layout.php): `templates/GRAVITY/layout.php`
- [Error views](https://github.com/schery19/gravity-framework/tree/main/templates/GRAVITY/ERRORS): `templates/GRAVITY/ERRORS`

### App scaffolding

- [App configuration](https://github.com/schery19/gravity-framework/blob/main/configs/configs.php): `configs/configs.php`
- [Database settings](https://github.com/schery19/gravity-framework/blob/main/configs/database.php): `configs/database.php`
- [Entity base](https://github.com/schery19/gravity-framework/blob/main/src/app/Entity/Entity.php): `src/app/Entity/Entity.php`
- [Repository base](https://github.com/schery19/gravity-framework/blob/main/src/app/Repository/Repository.php): `src/app/Repository/Repository.php`
- [Resource base](https://github.com/schery19/gravity-framework/blob/main/src/app/Resources/Resource.php): `src/app/Resources/Resource.php`

### Other components

- **Browser visitor**

## Connections

- Browser visitor → Front controller: requests page (evidence: `public/index.php`)
- Front controller → App configuration: loads config (evidence: `public/index.php`)
- Front controller → Gravity Core router: dispatches route (evidence: `public/index.php`)
- Front controller → Base controller: invokes controller (evidence: `public/index.php`)
- Base controller → Welcome view: renders view (evidence: `src/app/Controllers/BaseController.php`)
- Base controller → Shared layout: renders layout (evidence: `src/app/Controllers/BaseController.php`)
- Base controller → Error views: renders errors (evidence: `src/app/Controllers/BaseController.php`)
- Entity base → Gravity Core router: extends core entity
- Repository base → Gravity Core router: extends core repository
- Resource base → Gravity Core router: extends core resource
