# estur-dev/estur-web-development architecture

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

- Interactive diagram: https://gitdiagram.com/estur-dev/estur-web-development
- Repository: https://github.com/estur-dev/estur-web-development

## Overview

1. **Overall shape**
   - ESTUR is a split application monorepo with two main runtimes:
     - a **Laravel 10 backend** in `backend/`
     - a **React Router 7 frontend** in `frontend/`
   - The backend is not just an API; it also contains the **admin interface** and serves built assets. The frontend is the **public/user-facing experience**.

2. **Backend as the system of record**
   - The Laravel app owns the core domain and persistence layer: users, jobs, scholarships, payments, CMS pages/sections, media assets, contacts, and page visits.
   - It is organized in the usual Laravel layers: `Controllers`, `Requests`, `Resources`, `Models`, `Services`, `Middleware`, `Mail`, `Console Commands`, and `Migrations/Seeders`.

3. **Domain boundaries in the backend**
   - The major backend domains are:
     - **content/CMS**: home, about, services, scholarship pages, contact pages, banners, page sections
     - **jobs and employers**: jobs, offers, companies, applications, favorites, banners
     - **scholarships**: scholarship content and scholarship applications
     - **payments/subscriptions**: plans, price plans, payments, recurring flows
     - **auth/onboarding**: login, registration, email verification, profile/onboarding
     - **media/assets**: uploaded files and storage-backed URLs
   - This looks like a content-heavy portal with transactional workflows layered on top.

4. **Public frontend**
   - The `frontend/` app is a React-based SPA/MPA-style client built with React Router 7 and Vite.
   - Its route set covers the public site and user flows: home, about, jobs, job detail, apply, login/register, onboarding, scholarships, payment/checkout, profile, and policy pages.
   - The frontend is structured by feature areas (`site/common`, `site/sections`, `site/layout`, `routes`, `hooks`, `context`, `util`), which makes it the presentation layer and flow orchestrator.

5. **Backend-admin UI boundary**
   - The backend contains a second React/Inertia-style frontend under `backend/resources/js` and `backend/resources/views`.
   - That UI powers the admin console for managing content, jobs, scholarships, payments, users, settings, and media.
   - This means the backend hosts both the API and the internal admin experience, while the separate `frontend/` app serves the external audience.

6. **Data flow between frontend and backend**
   - The public frontend consumes backend APIs through `frontend/app/config/apiConfig.ts` and `fetchWithAuth.ts`.
   - Backend endpoints are versioned under `backend/app/Http/Controllers/Api/V1`, with Laravel API Resources shaping responses.
   - Request flow is: frontend route/component → fetch hook → API controller → service layer → model/database → resource serialization back to the client.

7. **Business logic and validation**
   - Domain logic is concentrated in `backend/app/Services`, such as auth, contact handling, onboarding, Moodle integration, registration, and scholarship application processing.
   - Input validation is handled with dedicated `FormRequest` classes and custom rules, including multilingual validation.
   - This keeps controllers relatively thin and makes the service layer the main orchestration boundary.

8. **Authentication and security model**
   - The repo supports both **API auth** and **admin/session auth**.
   - Middleware covers JWT, roles, localization, HTTPS forcing, security headers, CSRF, auth sharing, and Inertia request handling.
   - The frontend also has route-level protection utilities such as `PrivateRoute`, so access control is enforced on both client and server sides.

9. **External integrations**
   - The system integrates with:
     - **email delivery** via Laravel mailables and Blade templates
     - **Moodle** via `MoodleService` and related controllers
     - **payments/subscriptions** via payment-related services, mail notifications, and recurring payment commands
   - These integrations are important because they create async or third-party boundaries outside the core database-backed workflows.

10. **Persistence and content management**
   - Data is stored in **MySQL 8** through Laravel migrations and seeders.
   - Seeders populate the CMS and catalog-like content so the site can render immediately after setup.
   - There is also a strong file/media boundary: uploaded assets are referenced through storage-aware URL rebuilding, implying object/storage-backed media rather than inline DB content.

11. **Background jobs and scheduled operations**
   - The backend includes console commands for operational workflows such as checking recurring links/subscriptions, deactivating expired jobs, prewarming image cache, and sending payment URLs.
   - These commands imply scheduled maintenance and lifecycle automation beyond request/response handling.
   - In an architecture diagram, these should sit alongside the backend as scheduled workers/cron-driven tasks.

12. **Build, deploy, and quality loop**
   - CI/CD is split by surface area, with GitHub Actions for backend deploy, frontend deploy, backend rollback, and PSI/performance checks.
   - The repo also stores PSI result snapshots and scripts for capture/summarization, indicating a performance regression loop.
   - Deployment-wise, the frontend and backend can be released independently, but they are coupled by shared API contracts and content models.

13. **What is shared conceptually**
   - Both apps depend on the same domain vocabulary: pages, sections, jobs, scholarships, users, payments, and media.
   - The backend is the authoritative source for that data; the frontend is a consumer and flow coordinator.
   - For diagramming, the cleanest boundary is: **browser/client apps on one side, Laravel backend + database + external services on the other**.

Main entry points: [`backend/app/Http/Controllers/Api/V1`](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Controllers/Api/V1) (API V1), [`backend/app/Services`](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Services) (Services), [`backend/resources/js`](https://github.com/estur-dev/estur-web-development/tree/main/backend/resources/js) (Admin UI), [`frontend/app/routes`](https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/routes) (Routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_backend["Backend"]
  node_laravel_entry["Laravel App<br/>web app<br/>[index.php]"]
  node_admin_ui["Admin UI<br/>inertia/react ui"]
  node_web_views["Blade Views<br/>server views"]
  node_api_v1["API V1<br/>http api"]
  node_admin_ctrl["Admin Controllers"]
  node_services["Services"]
  node_middleware["Middleware<br/>request pipeline"]
  node_models[("Domain Models<br/>eloquent models")]
  node_resources["API Resources<br/>response serializers"]
  node_requests["Form Requests<br/>validation"]
  node_mail["Mail Notifications<br/>email templates"]
  node_migrations["Migrations<br/>schema evolution"]
  node_seeders["Seeders<br/>bootstrap data"]
  node_database[("MySQL<br/>database<br/>[database.php]")]
end

subgraph group_frontend["Frontend"]
  node_fe_routes["Routes"]
  node_fe_ui["Site UI<br/>react components"]
  node_fe_api["API Client"]
  node_fe_state["State & Hooks<br/>frontend state"]
  node_fe_utils["Frontend Utils<br/>helpers"]
end

subgraph group_ops["Ops"]
  node_scheduler["Commands<br/>scheduled tasks"]
  node_deploy["CI/CD<br/>github actions<br/>[workflows]"]
end

node_browser(("Browser<br/>client"))
node_external(("External Services<br/>third-party"))

node_browser -->|"loads"| node_fe_routes
node_fe_routes -->|"renders"| node_fe_ui
node_fe_ui -->|"uses"| node_fe_state
node_fe_state -->|"calls"| node_fe_api
node_fe_api -->|"requests"| node_api_v1
node_api_v1 -->|"orchestrates"| node_services
node_services -->|"reads/writes"| node_models
node_models -->|"persists"| node_database
node_api_v1 -->|"serializes"| node_resources
node_api_v1 -->|"validates"| node_requests
node_api_v1 -->|"notifies"| node_mail
node_api_v1 -->|"integrates"| node_external
node_admin_ui -->|"uses"| node_admin_ctrl
node_admin_ctrl -->|"delegates"| node_services
node_web_views -->|"hosts"| node_admin_ui
node_middleware -->|"guards"| node_api_v1
node_middleware -->|"protects"| node_admin_ui
node_scheduler -->|"runs"| node_services
node_seeders -->|"primes"| node_database
node_deploy -->|"deploys"| node_laravel_entry
node_deploy -->|"deploys"| node_fe_routes

click node_fe_routes "https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/routes"
click node_fe_ui "https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/site"
click node_fe_api "https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/config"
click node_fe_state "https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/context"
click node_fe_utils "https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/util"
click node_laravel_entry "https://github.com/estur-dev/estur-web-development/blob/main/backend/public/index.php"
click node_admin_ui "https://github.com/estur-dev/estur-web-development/tree/main/backend/resources/js"
click node_web_views "https://github.com/estur-dev/estur-web-development/tree/main/backend/resources/views"
click node_api_v1 "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Controllers/Api/V1"
click node_admin_ctrl "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Controllers/Admin"
click node_services "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Services"
click node_middleware "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Middleware"
click node_models "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Models"
click node_resources "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Resources/Api/V1"
click node_requests "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Requests/Api"
click node_mail "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Mail"
click node_migrations "https://github.com/estur-dev/estur-web-development/tree/main/backend/database/migrations"
click node_seeders "https://github.com/estur-dev/estur-web-development/tree/main/backend/database/seeders"
click node_scheduler "https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Console/Commands"
click node_database "https://github.com/estur-dev/estur-web-development/blob/main/backend/config/database.php"
click node_deploy "https://github.com/estur-dev/estur-web-development/blob/main/.github/workflows"

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_laravel_entry,node_admin_ui,node_web_views,node_api_v1,node_admin_ctrl,node_services,node_middleware,node_models,node_resources,node_requests,node_mail,node_migrations,node_seeders,node_database toneBlue
class node_fe_routes,node_fe_ui,node_fe_api,node_fe_state,node_fe_utils toneAmber
class node_scheduler,node_deploy toneMint
class node_browser,node_external toneNeutral
```

## Components

### Backend

Laravel system of record, admin UI, APIs, jobs, and persistence.

- [Laravel App](https://github.com/estur-dev/estur-web-development/blob/main/backend/public/index.php): web app · Backend host for API, admin UI, and asset serving. · `backend/public/index.php`
- [Admin UI](https://github.com/estur-dev/estur-web-development/tree/main/backend/resources/js): inertia/react ui · Internal React/Inertia-style console for operations and content management. · `backend/resources/js`
- [Blade Views](https://github.com/estur-dev/estur-web-development/tree/main/backend/resources/views): server views · Backend-rendered layouts and email templates. · `backend/resources/views`
- [API V1](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Controllers/Api/V1): http api · Versioned public API endpoints consumed by the frontend. · `backend/app/Http/Controllers/Api/V1`
- [Admin Controllers](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Controllers/Admin): admin controllers · Console workflows for content, users, jobs, scholarships, and payments. · `backend/app/Http/Controllers/Admin`
- [Services](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Services): domain services · Orchestration for auth, onboarding, contact, Moodle, and scholarship flows. · `backend/app/Services`
- [Middleware](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Middleware): request pipeline · Auth, roles, localization, CSRF, HTTPS, and Inertia sharing. · `backend/app/Http/Middleware`
- [Domain Models](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Models): eloquent models · Core content, user, job, scholarship, payment, and media entities. · `backend/app/Models`
- [API Resources](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Resources/Api/V1): response serializers · Transforms backend models into API payloads. · `backend/app/Http/Resources/Api/V1`
- [Form Requests](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Http/Requests/Api): validation · Typed input validation for auth, onboarding, contact, and scholarships. · `backend/app/Http/Requests/Api`
- [Mail Notifications](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Mail): email templates · Transactional email delivery for verification, contact, jobs, and payments. · `backend/app/Mail`
- [Migrations](https://github.com/estur-dev/estur-web-development/tree/main/backend/database/migrations): schema evolution · MySQL schema and content structure over time. · `backend/database/migrations`
- [Seeders](https://github.com/estur-dev/estur-web-development/tree/main/backend/database/seeders): bootstrap data · Initial CMS, catalog, and demo content population. · `backend/database/seeders`
- [MySQL](https://github.com/estur-dev/estur-web-development/blob/main/backend/config/database.php): database · Primary relational store for the backend system of record. · `backend/config/database.php`

### Frontend

Public React Router app and presentation layer.

- [Routes](https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/routes): react-router routes · Public site and user-flow route definitions. · `frontend/app/routes`
- [Site UI](https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/site): react components · Feature components and layouts for the public experience. · `frontend/app/site`
- [API Client](https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/config): fetch/api client · Authenticated API access and endpoint configuration. · `frontend/app/config`
- [State & Hooks](https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/context): frontend state · Contexts and hooks coordinating user/session and remote data. · `frontend/app/context`
- [Frontend Utils](https://github.com/estur-dev/estur-web-development/tree/main/frontend/app/util): helpers · Client-side guards, SEO helpers, and shared utilities. · `frontend/app/util`

### Ops

CI/CD, performance checks, and scheduled maintenance.

- [Commands](https://github.com/estur-dev/estur-web-development/tree/main/backend/app/Console/Commands): scheduled tasks · Cron-driven maintenance for recurring payments, jobs, and cache prewarming. · `backend/app/Console/Commands`
- [CI/CD](https://github.com/estur-dev/estur-web-development/blob/main/.github/workflows): github actions · Independent backend/frontend deploys, rollback, and PSI checks. · `.github/workflows`

### Other components

- **Browser**: client · Public and authenticated user entry point.
- **External Services**: third-party · Email delivery, Moodle, payment providers, and storage-backed media.

## Connections

- Browser → Routes: loads · Users enter the public application through routed pages.
- Routes → Site UI: renders · Routes assemble feature components and layouts.
- Site UI → State & Hooks: uses · UI relies on session/context and data-fetching hooks.
- State & Hooks → API Client: calls · Hooks and contexts use the API client for backend access.
- API Client → API V1: requests · Public frontend consumes versioned Laravel API endpoints.
- API V1 → Services: orchestrates · Controllers delegate business workflows to services.
- Services → Domain Models: reads/writes · Domain services coordinate persistence through Eloquent models.
- Domain Models → MySQL: persists · Models map to the MySQL-backed system of record.
- API V1 → API Resources: serializes · Responses are shaped through API resources.
- API V1 → Form Requests: validates · Incoming payloads are validated with form requests.
- API V1 → Mail Notifications: notifies · API flows trigger transactional email notifications.
- API V1 → External Services: integrates · API flows connect to Moodle, payment, and storage services.
- Admin UI → Admin Controllers: uses · Admin screens are backed by Laravel admin controllers.
- Admin Controllers → Services: delegates · Admin actions reuse the same domain services.
- Blade Views → Admin UI: hosts · Blade layouts and email templates support internal and transactional presentation.
- Middleware → API V1: guards · Request pipeline enforces auth, roles, locale, CSRF, and headers.
- Middleware → Admin UI: protects · Backend middleware also secures the admin experience.
- Commands → Services: runs · Console commands execute recurring business maintenance.
- Seeders → MySQL: primes · Seed data populates CMS and catalog content.
- CI/CD → Laravel App: deploys · CI/CD releases the backend surface.
- CI/CD → Routes: deploys · CI/CD releases the frontend surface.
