# sadekbd/prosper architecture

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

- Interactive diagram: https://gitdiagram.com/sadekbd/prosper
- Repository: https://github.com/sadekbd/prosper

## Overview

1. **Overall shape**
   - This is a Laravel monolith for a content/marketing site with a separate admin CMS.
   - The app is split into two major user-facing areas: a public website and an authenticated admin area.
   - Views are Blade templates, data access is Eloquent models, and the app is configured through standard Laravel `config/*` plus a custom `config/prosper.php`.

2. **Request entry and routing**
   - All HTTP traffic enters through `public/index.php`.
   - Routing is organized by concern: `routes/web.php` for public pages, `routes/admin.php` for the back office, and `routes/console.php` for command-line actions.
   - The route structure likely maps directly to the controller namespaces under `app/Http/Controllers/Public` and `app/Http/Controllers/Admin`.

3. **Public website subsystem**
   - Public controllers include `Home`, `About`, `Services`, `Portfolio`, `Blog`, `Contact`, `Newsletter`, and `Sitemap`.
   - The public views live in `resources/views/public/*` with shared header/footer/SEO components under `resources/views/components/public`.
   - This area serves marketing pages, content detail pages, contact forms, newsletter signup, and sitemap/SEO output.

4. **Admin CMS subsystem**
   - The admin area is a separate controller set under `app/Http/Controllers/Admin`.
   - It manages blog articles and categories, portfolio items, services, contact messages, newsletter subscribers, site settings, and users.
   - Corresponding admin views are grouped under `resources/views/admin/*`, with shared admin layout pieces in `resources/views/components/admin`.

5. **Authentication and role-based access**
   - Admin authentication is handled by dedicated auth controllers: login, signup, and forgot-password.
   - Access control is enforced with custom middleware: `AdminAuth`, `AdminOrAbove`, `SuperAdminOnly`, `ArticleWriterAccess`, and `RedirectIfAdminAuthenticated`.
   - This indicates role-aware authorization rather than a single flat admin login.

6. **Domain model layer**
   - Core persistent entities include `BlogArticle`, `BlogCategory`, `PortfolioProject`, `Service`, `ServiceFeature`, `Page`, `ContactMessage`, `NewsletterSubscriber`, `SiteSetting`, `AdminUser`, `User`, and `ActivityLog`.
   - These models represent the content and operational data used by both public pages and admin CRUD screens.
   - `ActivityLog` suggests audit/history tracking in the admin workflow.

7. **Data flow from content to UI**
   - Public controllers read from Eloquent models and render Blade views with site content.
   - Admin controllers perform CRUD operations on the same domain models, which then immediately affect what the public site shows.
   - Shared data like SEO metadata and site settings likely flows through the settings model and `seo-meta` component into layouts and pages.

8. **Forms, validation, and message ingestion**
   - Form validation is separated into request classes: `Admin/LoginRequest`, `Admin/SignupRequest`, and `Public/ContactFormRequest`.
   - Public contact submissions and newsletter signups feed into persisted models and are visible in the admin interface.
   - This creates a clear boundary between user input validation and controller logic.

9. **Database and bootstrap data**
   - The project uses standard Laravel migrations plus seeders for initial content.
   - Seeders populate blog categories/articles, pages, portfolio items, services, site settings, and a super admin account.
   - `database/factories` exists for test data, suggesting the domain is meant to be exercised through automated tests as well.

10. **Operational and install path**
   - There is a custom console command, `InstallProsperMedia`, which implies a first-run setup or onboarding flow.
   - `DEPLOYMENT.md` and the presence of seeded site content suggest the application is designed to be deployed with preloaded CMS data.
   - Standard Laravel runtime pieces are present for cache, queue, session, logging, and mail configuration.

11. **Front-end asset pipeline**
   - Front-end assets are built with Vite, Tailwind CSS, and JavaScript entrypoints under `resources/js` and `resources/css`.
   - A standalone `public/js/prosper_chat_widget.js` indicates at least one shipped browser-side widget outside the main build pipeline.
   - The UI is primarily server-rendered, with asset bundling supporting styling and small interactive enhancements.

12. **Security and presentation boundaries**
   - `SecurityHeaders` middleware indicates response hardening at the HTTP layer.
   - Error pages are custom-branded for 404, 500, and 503 conditions.
   - The app also includes robots and sitemap support, showing attention to public-site discoverability and crawl behavior.

Main entry points: [`app/Models`](https://github.com/sadekbd/prosper/tree/main/app/Models) (Content models), [`routes/admin.php`](https://github.com/sadekbd/prosper/blob/main/routes/admin.php) (Admin routes), [`app/Http/Controllers/Public`](https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Public) (Public controllers), [`routes/web.php`](https://github.com/sadekbd/prosper/blob/main/routes/web.php) (Web routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime"]
  node_public_index["index.php<br/>HTTP entry<br/>[index.php]"]
  node_web_routes["Web routes<br/>route map<br/>[web.php]"]
  node_admin_routes["Admin routes<br/>route map<br/>[admin.php]"]
  node_console_routes["Console routes<br/>cli routes<br/>[console.php]"]
end

subgraph group_public_site["Public site"]
  node_public_controllers["Public controllers<br/>site controllers"]
  node_public_views["Public views<br/>Blade views"]
  node_public_components["Public UI<br/>view components"]
end

subgraph group_admin_cms["Admin CMS"]
  node_admin_controllers["Admin controllers<br/>cms controllers"]
  node_admin_auth["Auth controllers<br/>admin auth"]
  node_admin_views["Admin views<br/>Blade views"]
  node_admin_components["Admin UI<br/>view components"]
end

subgraph group_domain["Domain models"]
  node_domain_models[("Content models<br/>Eloquent models")]
end

subgraph group_infrastructure["Infrastructure"]
  node_middleware{{"Middleware<br/>HTTP guards"}}
  node_form_requests["Form requests<br/>validation"]
  node_artisan_cmd["Install command<br/>console command"]
  node_seeders["Seeders<br/>bootstrap data"]
  node_build_assets["Assets<br/>frontend build"]
  node_app_config["Config<br/>[prosper.php]"]
end

node_public_index -->|"dispatches"| node_web_routes
node_public_index -->|"dispatches"| node_admin_routes
node_web_routes -->|"maps to"| node_public_controllers
node_admin_routes -->|"maps to"| node_admin_controllers
node_admin_routes -->|"maps to"| node_admin_auth
node_public_controllers -->|"reads/writes"| node_domain_models
node_admin_controllers -->|"crud"| node_domain_models
node_admin_auth -->|"auth data"| node_domain_models
node_public_controllers -->|"renders"| node_public_views
node_admin_controllers -->|"renders"| node_admin_views
node_public_views -->|"uses"| node_public_components
node_admin_views -->|"uses"| node_admin_components
node_web_routes -->|"protected by"| node_middleware
node_admin_routes -->|"protected by"| node_middleware
node_public_controllers -->|"validates with"| node_form_requests
node_admin_auth -->|"validates with"| node_form_requests
node_artisan_cmd -->|"bootstraps"| node_seeders
node_seeders -->|"creates"| node_domain_models
node_build_assets -->|"styles/scripts"| node_public_views
node_build_assets -->|"styles/scripts"| node_admin_views
node_app_config -->|"configures"| node_middleware
node_app_config -.->|"drives"| node_domain_models

click node_public_index "https://github.com/sadekbd/prosper/blob/main/public/index.php"
click node_web_routes "https://github.com/sadekbd/prosper/blob/main/routes/web.php"
click node_admin_routes "https://github.com/sadekbd/prosper/blob/main/routes/admin.php"
click node_console_routes "https://github.com/sadekbd/prosper/blob/main/routes/console.php"
click node_public_controllers "https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Public"
click node_public_views "https://github.com/sadekbd/prosper/tree/main/resources/views/public"
click node_public_components "https://github.com/sadekbd/prosper/tree/main/resources/views/components/public"
click node_admin_controllers "https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Admin"
click node_admin_auth "https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Admin/Auth"
click node_admin_views "https://github.com/sadekbd/prosper/tree/main/resources/views/admin"
click node_admin_components "https://github.com/sadekbd/prosper/tree/main/resources/views/components/admin"
click node_domain_models "https://github.com/sadekbd/prosper/tree/main/app/Models"
click node_middleware "https://github.com/sadekbd/prosper/tree/main/app/Http/Middleware"
click node_form_requests "https://github.com/sadekbd/prosper/tree/main/app/Http/Requests"
click node_artisan_cmd "https://github.com/sadekbd/prosper/blob/main/app/Console/Commands/InstallProsperMedia.php"
click node_seeders "https://github.com/sadekbd/prosper/tree/main/database/seeders"
click node_build_assets "https://github.com/sadekbd/prosper/tree/main/resources/js"
click node_app_config "https://github.com/sadekbd/prosper/blob/main/config/prosper.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_public_index,node_web_routes,node_admin_routes,node_console_routes toneBlue
class node_public_controllers,node_public_views,node_public_components toneAmber
class node_admin_controllers,node_admin_auth,node_admin_views,node_admin_components toneMint
class node_domain_models toneRose
class node_middleware,node_form_requests,node_artisan_cmd,node_seeders,node_build_assets,node_app_config toneIndigo
```

## Components

### Runtime

Laravel bootstrap, HTTP entrypoint, and route dispatch

- [index.php](https://github.com/sadekbd/prosper/blob/main/public/index.php): HTTP entry · Front controller that receives all web requests. · `public/index.php`
- [Web routes](https://github.com/sadekbd/prosper/blob/main/routes/web.php): route map · Routes for the public site. · `routes/web.php`
- [Admin routes](https://github.com/sadekbd/prosper/blob/main/routes/admin.php): route map · Routes for the back office and admin workflows. · `routes/admin.php`
- [Console routes](https://github.com/sadekbd/prosper/blob/main/routes/console.php): cli routes · Command-line route definitions and scheduled actions. · `routes/console.php`

### Public site

Marketing pages, content rendering, and public forms

- [Public controllers](https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Public): site controllers · Home, about, services, portfolio, blog, contact, newsletter, and sitemap handlers. · `app/Http/Controllers/Public`
- [Public views](https://github.com/sadekbd/prosper/tree/main/resources/views/public): Blade views · Server-rendered pages for the public-facing website. · `resources/views/public`
- [Public UI](https://github.com/sadekbd/prosper/tree/main/resources/views/components/public): view components · Shared header, footer, and SEO metadata pieces. · `resources/views/components/public`

### Admin CMS

Authenticated back office and CRUD management

- [Admin controllers](https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Admin): cms controllers · CRUD controllers for content, settings, messages, subscribers, and users. · `app/Http/Controllers/Admin`
- [Auth controllers](https://github.com/sadekbd/prosper/tree/main/app/Http/Controllers/Admin/Auth): admin auth · Login, signup, and password reset flows for administrators. · `app/Http/Controllers/Admin/Auth`
- [Admin views](https://github.com/sadekbd/prosper/tree/main/resources/views/admin): Blade views · Dashboard and management screens for the CMS. · `resources/views/admin`
- [Admin UI](https://github.com/sadekbd/prosper/tree/main/resources/views/components/admin): view components · Shared sidebar and topbar used by admin layouts. · `resources/views/components/admin`

### Domain models

Persistent content, settings, and operational records

- [Content models](https://github.com/sadekbd/prosper/tree/main/app/Models): Eloquent models · Articles, pages, services, portfolio, messages, subscribers, settings, users, and audit logs. · `app/Models`

### Infrastructure

Middleware, requests, commands, and build assets

- [Middleware](https://github.com/sadekbd/prosper/tree/main/app/Http/Middleware): HTTP guards · Authentication, role checks, redirect rules, and security headers. · `app/Http/Middleware`
- [Form requests](https://github.com/sadekbd/prosper/tree/main/app/Http/Requests): validation · Request validation for admin auth and public contact submissions. · `app/Http/Requests`
- [Install command](https://github.com/sadekbd/prosper/blob/main/app/Console/Commands/InstallProsperMedia.php): console command · First-run installation and setup command. · `app/Console/Commands/InstallProsperMedia.php`
- [Seeders](https://github.com/sadekbd/prosper/tree/main/database/seeders): bootstrap data · Initial content and super-admin provisioning for a fresh install. · `database/seeders`
- [Assets](https://github.com/sadekbd/prosper/tree/main/resources/js): frontend build · Vite, Tailwind, and app JavaScript/CSS entrypoints plus a standalone chat widget. · `resources/js`
- [Config](https://github.com/sadekbd/prosper/blob/main/config/prosper.php): runtime config · Laravel configuration plus custom prosper and role settings. · `config/prosper.php`

## Connections

- index.php → Web routes: dispatches · HTTP entrypoint hands requests to the web router.
- index.php → Admin routes: dispatches · Admin requests are routed through the back office route file.
- Web routes → Public controllers: maps to · Public routes invoke site controllers.
- Admin routes → Admin controllers: maps to · Admin routes invoke CMS controllers.
- Admin routes → Auth controllers: maps to · Authentication routes are handled by dedicated auth controllers.
- Public controllers → Content models: reads/writes · Public pages read content and persist submissions.
- Admin controllers → Content models: crud · CMS controllers manage the shared domain records.
- Auth controllers → Content models: auth data · Admin login and signup operate on user records.
- Public controllers → Public views: renders · Site controllers return Blade templates.
- Admin controllers → Admin views: renders · CMS controllers return admin Blade templates.
- Public views → Public UI: uses · Public pages compose shared header, footer, and SEO metadata.
- Admin views → Admin UI: uses · Admin screens share common layout elements.
- Web routes → Middleware: protected by · Public and mixed routes use HTTP middleware for security and access control.
- Admin routes → Middleware: protected by · Admin area depends on auth and role middleware.
- Public controllers → Form requests: validates with · Public form submissions use request validation.
- Auth controllers → Form requests: validates with · Login and signup forms use dedicated requests.
- Install command → Seeders: bootstraps · Install command complements seeded initial content and admin setup.
- Seeders → Content models: creates · Seed data populates the main content and settings models.
- Assets → Public views: styles/scripts · Bundled assets support the server-rendered public UI.
- Assets → Admin views: styles/scripts · Bundled assets also support admin interface styling.
- Config → Middleware: configures · Role and security behavior are driven by configuration.
- Config → Content models: drives · Site settings and role configuration shape model behavior.
