# awais-124/jobspark---php-sql architecture

> Architecture diagram of the GitHub repository awais-124/jobspark---php-sql, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/awais-124/jobspark---php-sql
- Repository: https://github.com/awais-124/jobspark---php-sql

## Overview

##### Project Type and Purpose
- A monolithic PHP/MySQL web application
- Serves two main audiences: job seekers & employers (public site) and administrators (admin panel)
- Dynamic pages are rendered server-side in PHP, client enhancements via JavaScript/CSS

##### Main Components
1. Client Layer
– Web Browser
2. Presentation Layer (Views)
– Public Pages: Pages/*.php
– Shared Components: components/*.php (e.g., job-modal)
– Includes: includes/*.php (headers, footers, sidebar)
– Admin Views: admin/Views/*.php
3. Application Layer (Controllers)
– Public Controllers: controllers/*.php (job posting, login, registration, fetch featured jobs)
– Admin Handlers: admin/handlers/*.php (admin-login, CRUD operations)
4. Data Layer
– Database: MySQL (db/schema.sql, insert-data.sql)
– DB Connection Logic: includes/db-connection.php
– Uploaded Files Storage: uploaded-files/ (resumes, profile pics)
5. Web Server & Runtime
– Apache or Nginx + PHP interpreter (not in repo)

##### Relationships and Data Flows
- Web Server dispatches to PHP entry points:
– index.php and Pages/*.php for public site
– admin/index.php or admin/admin.php for admin portal
- PHP entry point includes helpers (includes/*.php), then invokes Controllers or Handlers
- Controllers/Handlers execute business logic → read/write via includes/db-connection.php → MySQL
- Controllers pass results to Views (Pages/, components/, admin/Views/) → render HTML
- Browser receives HTML + static assets → user sees UI
- File uploads saved to uploaded-files/; DB stores file metadata

##### Architectural Patterns & Principles
- Layered (Presentation / Application / Data)
- Procedural MVC-like separation:
– Models are implicit (SQL in handlers/controllers)
– Views are PHP templates (Pages/, admin/Views/, components)
– Controllers handle request logic
- Reusable shared components: includes/ and components/
- Single monolith—no microservices

##### Key Technologies & Frameworks
- PHP 7+ (server-side scripting)
- MySQL (relational database)
- Apache/Nginx (web server)
- JavaScript (client interactivity)
- CSS (styles/ directory)
- SQL scripts for schema and seed data

##### Final Checklist
[ ] Client Browser
[ ] Static Assets (styles/, js/, assets/)
[ ] Presentation Layer: Pages/, includes/, components/, admin/Views/
[ ] Application Layer: controllers/, admin/handlers/
[ ] Data Layer: MySQL (db/), includes/db-connection.php
[ ] Uploaded-files storage
– HTTP Request/Response
– PHP calls to DB
– File uploads to storage

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    subgraph "Client Layer"
        Browser["Web Browser"]:::client
        StaticAssets["Static Assets"]:::static
        Browser -->|HTTP Request/Response| WebServer
    end

    subgraph "Static Assets" 
        styles["styles/"]:::static
        adminStyles["admin/styles/"]:::static
        jsDir["js/"]:::static
        assetsDir["assets/"]:::static
    end

    Browser -->|loads| styles
    Browser -->|loads| adminStyles
    Browser -->|loads| jsDir
    Browser -->|loads| assetsDir

    %% Web Server & Runtime
    WebServer["Web Server\n(Apache/Nginx + PHP)"]:::server

    %% Presentation Layer
    subgraph "Presentation Layer"
        subgraph "Public Views"
            PublicPages["Pages/"]:::presentation
            HomePage["HomePage.php"]:::presentation
            AboutPage["AboutUsPage.php"]:::presentation
            EmployerPage["EmployerPage.php"]:::presentation
            JobsListing["JobsListing.php"]:::presentation
            JobApplication["JobApplication.php"]:::presentation
            LoginPage["LoginPage.php"]:::presentation
            RegisterPage["RegisterPage.php"]:::presentation
        end
        subgraph "Shared Components & Includes"
            Components["components/"]:::presentation
            JobModal["job-modal.php"]:::presentation
            Includes["includes/"]:::presentation
        end
        subgraph "Admin Views"
            AdminViewsDir["admin/Views/"]:::presentation
            AddAdmin["add-admin.php"]:::presentation
            ApplicantList["applicant-list.php"]:::presentation
            CategoryList["category-list.php"]:::presentation
            FeaturedJobsView["featured-jobs.php"]:::presentation
            JobListView["job-list.php"]:::presentation
            UserList["user-list.php"]:::presentation
        end
    end

    WebServer -->|dispatch to public| EntryPublic
    WebServer -->|dispatch to admin| EntryAdmin

    EntryPublic["index.php"]:::server -->|includes| Includes
    EntryPublic -->|renders| PublicPages
    PublicPages -->|uses| Components
    Components -->|includes| JobModal

    EntryAdmin["admin/index.php\nadmin.php\ndashboard.php\nadmin-login.php"]:::server -->|includes| Includes
    EntryAdmin --> AdminViewsDir

    %% Application Layer
    subgraph "Application Layer"
        subgraph "Public Controllers"
            ControllersDir["controllers/"]:::application
            PostJob["post-job.php"]:::application
            ChangeStatus["change-job-status.php"]:::application
            ApplyJob["apply-for-job.php"]:::application
            DeleteJob["delete-job.php"]:::application
            FetchFeatured["fetch-featured-jobs.php"]:::application
            CheckLogin["check-login.php"]:::application
            CheckRegister["check-register.php"]:::application
            Logout["logout.php"]:::application
        end
        subgraph "Admin Handlers"
            HandlersDir["admin/handlers/"]:::application
            CheckAdminLogin["check-admin-login.php"]:::application
            AddCategory["add-new-category.php"]:::application
            ModifyFeatured["modify-featured-jobs.php"]:::application
            NewAdmin["new-admin.php"]:::application
            DeleteCats["delete-categories.php"]:::application
            DeleteJobAdmin["delete-job.php"]:::application
            DeleteUser["delete-user.php"]:::application
            DeleteApplicant["delete-applicant.php"]:::application
            LogoutAdmin["logout-admin.php"]:::application
        end
    end

    PublicPages -->|calls| ControllersDir
    ControllersDir -->|executes logic| FetchFeatured
    FetchFeatured -->|returns JSON| Browser
    ApplyJob -->|uploads file| UploadedFiles
    ControllersDir -->|queries| DBConnection

    EntryAdmin -->|calls| HandlersDir
    HandlersDir -->|queries| DBConnection

    %% Data Layer
    subgraph "Data Layer"
        MySQL["MySQL Database"]:::data
        DBConnection["includes/db-connection.php"]:::data
        Schema["db/schema.sql\ninsert-data.sql\nmore-records.sql"]:::data
        UploadedFiles["uploaded-files/"]:::data
    end

    DBConnection --> MySQL
    Schema --> MySQL
    UploadedFiles ---|stores files| MySQL

    ControllersDir -->|reads/writes| MySQL
    HandlersDir -->|reads/writes| MySQL

    %% Click Events
    click styles "https://github.com/awais-124/jobspark---php-sql/tree/main/styles/"
    click adminStyles "https://github.com/awais-124/jobspark---php-sql/tree/main/admin/styles/"
    click jsDir "https://github.com/awais-124/jobspark---php-sql/tree/main/js/"
    click assetsDir "https://github.com/awais-124/jobspark---php-sql/tree/main/assets/"
    click HomePage "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/HomePage.php"
    click AboutPage "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/AboutUsPage.php"
    click EmployerPage "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/EmployerPage.php"
    click JobsListing "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/JobsListing.php"
    click JobApplication "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/JobApplication.php"
    click LoginPage "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/LoginPage.php"
    click RegisterPage "https://github.com/awais-124/jobspark---php-sql/blob/main/Pages/RegisterPage.php"
    click JobModal "https://github.com/awais-124/jobspark---php-sql/blob/main/components/job-modal.php"
    click Includes "https://github.com/awais-124/jobspark---php-sql/tree/main/includes/"
    click AddAdmin "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/Views/add-admin.php"
    click ApplicantList "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/Views/applicant-list.php"
    click CategoryList "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/Views/category-list.php"
    click FeaturedJobsView "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/Views/featured-jobs.php"
    click JobListView "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/Views/job-list.php"
    click UserList "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/Views/user-list.php"
    click ControllersDir "https://github.com/awais-124/jobspark---php-sql/tree/main/controllers/"
    click PostJob "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/post-job.php"
    click ChangeStatus "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/change-job-status.php"
    click ApplyJob "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/apply-for-job.php"
    click DeleteJob "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/delete-job.php"
    click FetchFeatured "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/fetch-featured-jobs.php"
    click CheckLogin "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/check-login.php"
    click CheckRegister "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/check-register.php"
    click Logout "https://github.com/awais-124/jobspark---php-sql/blob/main/controllers/logout.php"
    click HandlersDir "https://github.com/awais-124/jobspark---php-sql/tree/main/admin/handlers/"
    click CheckAdminLogin "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/check-admin-login.php"
    click AddCategory "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/add-new-category.php"
    click ModifyFeatured "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/modify-featured-jobs.php"
    click NewAdmin "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/new-admin.php"
    click DeleteCats "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/delete-categories.php"
    click DeleteJobAdmin "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/delete-job.php"
    click DeleteUser "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/delete-user.php"
    click DeleteApplicant "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/delete-applicant.php"
    click LogoutAdmin "https://github.com/awais-124/jobspark---php-sql/blob/main/admin/handlers/logout-admin.php"
    click DBConnection "https://github.com/awais-124/jobspark---php-sql/blob/main/includes/db-connection.php"
    click Schema "https://github.com/awais-124/jobspark---php-sql/blob/main/db/schema.sql"
    click UploadedFiles "https://github.com/awais-124/jobspark---php-sql/tree/main/uploaded-files/"

    %% Styles
    classDef client fill:#9f6,stroke:#393,stroke-width:2px
    classDef static fill:#cfc,stroke:#393,stroke-width:2px
    classDef server fill:#9cf,stroke:#036,stroke-width:2px
    classDef presentation fill:#6cf,stroke:#036,stroke-width:2px
    classDef application fill:#fa3,stroke:#a50,stroke-width:2px
    classDef data fill:#f66,stroke:#a00,stroke-width:2px
```
