# arifmardhavi/simpangan architecture

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

- Interactive diagram: https://gitdiagram.com/arifmardhavi/simpangan
- Repository: https://github.com/arifmardhavi/simpangan

## Overview

##### Project type and purpose
- This is a server-side rendered web application built on PHP using the CodeIgniter MVC framework.
- The “application” folder holds your custom business logic (controllers, models, views). The “system” folder is the CI core. “assets” holds static CSS/JS/images. “html” holds standalone prototype pages.

##### File structure
- Top level:
- index.php – front-controller entry point
- application/ – your MVC code
- system/ – CodeIgniter core (Router, Controller base class, Model base class, etc.)
- assets/ – CSS, JS, images served statically
- html/ – static UI prototypes
- application/config – routing, database, autoload, hooks, caching configuration
- application/controllers – Feature controllers (Berkas, Pengajuan, Users, etc.)
- application/models – Data-access (M_crud.php, M_send_email.php)
- application/views – PHP templates (frontend pages, error pages, modul header/footer/sidebar)
- system/… – core libraries, helpers, database drivers, caching, sessions, etc.

##### README for additional insights
- Confirms CodeIgniter MVC usage, PHP requirements, caching capabilities (memcached, file, Redis), email library, session drivers.

##### Main components
a. Client (Browser or SPA front-end)
b. Load Balancer or Web Server (Apache/Nginx with .htaccess rewrites)
c. Front Controller (index.php)
d. CodeIgniter Core Components
- Router → Dispatch
- Hooks → Pre/post controller events
- Security/Input → XSS, CSRF checks
- Loader → Loads helpers, libraries, models
e. Application Layer
- Controllers – handle routes (Berkas, Pengajuan, Users, etc.)
- Models – interact with the database via DB drivers (MySQL, PDO, etc.)
- Views – render output with header/footer/sidebar templates + dynamic data
f. Database Server (MySQL, PostgreSQL, etc.)
g. External/Caching Services
- Memcached/Redis for sessions or caching
- SMTP or third-party email via M_send_email
- Any third_party libraries (in application/third_party)
h. Static Assets
- CSS, JS, Images served directly from assets/

##### Relationships and interactions
- Client → HTTP request → Web Server → index.php
- index.php → Router → matches URI to Controller
- Controller ↔ (uses) Loader to pull in Models, Helpers, Libraries
- Controller ↔ Model → Database (query/build/transaction)
- Controller → passes data to View → HTML output
- HTML + References to assets → response → Client
- For caching/session: Controller/Model uses Cache library → Memcached/Redis
- For email: Controller calls M_send_email → SMTP or API

##### Architectural patterns/design principles
- MVC (separation of concerns between data, logic, and presentation)
- Front Controller pattern (single index.php entry point)
- Loose coupling via DI/Loader and helpers/libraries
- Configurable via application/config and environment hooks
- Extensible via application/third_party and custom core overrides in application/core

##### Detail level
- That application/config/database.php points to the DB driver.
- That application/config/memcached.php or session drivers may point to Redis/Memcached.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Clients
    subgraph "Clients"
        Client["Browser / API Consumer"]:::external
    end

    %% Web Server & Front Controller
    subgraph "Web Server & Front Controller"
        WebServer["Apache / Nginx"]:::framework
        HTRoot[".htaccess (root)"]:::framework
        HTApp[".htaccess (application/)"]:::framework
        HTSys[".htaccess (system/)"]:::framework
        Index["index.php"]:::framework
    end

    %% Framework Core
    subgraph "CodeIgniter Core"
        Router["Router"]:::framework
        Security["Security / Input"]:::framework
        Hooks["Hooks System"]:::framework
        Loader["Loader"]:::framework
        CoreBootstrap["Bootstrap (CodeIgniter.php)"]:::framework
        CommonFn["Common Functions"]:::framework
        ControllerBase["Controller Base Class"]:::framework
        ModelBase["Model Base Class"]:::framework
        Output["Output Class"]:::framework
        DBDriver["DB_driver"]:::framework
        QB["DB_query_builder"]:::framework
        CacheLib["Cache Library"]:::framework
        CacheMem["Cache_memcached Driver"]:::framework
        CacheRedis["Cache_redis Driver"]:::framework
        SessionLib["Session Library"]:::framework
        SessFiles["Session_files Driver"]:::framework
        SessMem["Session_memcached Driver"]:::framework
        SessRedis["Session_redis Driver"]:::framework
        EmailLib["Email Library"]:::framework
        Helpers["Helpers"]:::framework
    end

    %% Application Layer
    subgraph "Application Layer" 
        subgraph Controllers
            Berk["Berkas.php"]:::app
            Peng["Pengajuan.php"]:::app
            Users["Users.php"]:::app
            Login["Login.php"]:::app
            Daftar["Daftar.php"]:::app
            Dosen["Dosen.php"]:::app
            Errors["Errors.php"]:::app
            Cek["Cek.php"]:::app
            Blank["Blank.php"]:::app
            Welcome["Welcome.php"]:::app
        end
        subgraph Models
            Mcrud["M_crud.php"]:::app
            Msend["M_send_email.php"]:::app
        end
        subgraph Views
            VH["Header / Footer / Sidebar"]:::app
            VPages["Views (*.php)"]:::app
            VErrors["application/views/errors"]:::app
        end
        Configs["application/config"]:::app
        ThirdParty["application/third_party"]:::app
    end

    %% External Services
    subgraph "External Services"
        DBServer["Database Server\n(MySQL/PostgreSQL)"]:::db
        Memcached["Memcached Service"]:::service
        Redis["Redis Service"]:::service
        SMTP["SMTP / Email API"]:::service
    end

    %% Static Assets & Prototypes
    subgraph "Static Assets & Prototypes"
        Assets["assets/css, js, images"]:::static
        Prototypes["html/ (static pages)"]:::static
    end

    %% Connections
    Client -->|HTTP Request| WebServer
    WebServer -->|Rewrite| HTRoot
    HTRoot --> Index
    Index --> Router
    Router --> Security
    Security --> Hooks
    Hooks --> Loader
    Loader --> Controllers
    Controllers --> Models
    Controllers --> Views
    Models --> DBDriver
    DBDriver --> QB
    QB --> DBServer
    Controllers -->|send email| EmailLib
    EmailLib --> SMTP
    Controllers -->|cache/session| CacheLib
    CacheLib --> CacheMem
    CacheLib --> CacheRedis
    CacheLib --> SessionLib
    SessionLib --> SessFiles
    SessionLib --> SessMem
    SessionLib --> SessRedis
    Loader --> Helpers
    Loader --> Configs
    Loader --> ThirdParty
    Controllers --> Output
    Views --> Output
    Output -->|HTML Response| Client
    Assets -->|static serve| WebServer
    Prototypes -->|static serve| WebServer

    %% Click Events
    click Index "https://github.com/arifmardhavi/simpangan/blob/main/index.php"
    click HTRoot "https://github.com/arifmardhavi/simpangan/blob/main/.htaccess"
    click HTApp "https://github.com/arifmardhavi/simpangan/blob/main/application/.htaccess"
    click HTSys "https://github.com/arifmardhavi/simpangan/blob/main/system/.htaccess"
    click Router "https://github.com/arifmardhavi/simpangan/blob/main/system/core/Router.php"
    click Security "https://github.com/arifmardhavi/simpangan/blob/main/system/core/Security.php"
    click Security "https://github.com/arifmardhavi/simpangan/blob/main/system/core/Input.php"
    click Hooks "https://github.com/arifmardhavi/simpangan/blob/main/system/core/Hooks.php"
    click Hooks "https://github.com/arifmardhavi/simpangan/blob/main/application/config/hooks.php"
    click Loader "https://github.com/arifmardhavi/simpangan/blob/main/system/core/Loader.php"
    click Configs "https://github.com/arifmardhavi/simpangan/blob/main/application/config/autoload.php"
    click Configs "https://github.com/arifmardhavi/simpangan/blob/main/application/config/config.php"
    click Configs "https://github.com/arifmardhavi/simpangan/blob/main/application/config/database.php"
    click Configs "https://github.com/arifmardhavi/simpangan/blob/main/application/config/memcached.php"
    click Configs "https://github.com/arifmardhavi/simpangan/blob/main/application/config/routes.php"
    click Configs "https://github.com/arifmardhavi/simpangan/blob/main/application/config/constants.php"
    click Berk "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Berkas.php"
    click Peng "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Pengajuan.php"
    click Users "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Users.php"
    click Login "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Login.php"
    click Daftar "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Daftar.php"
    click Dosen "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Dosen.php"
    click Errors "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Errors.php"
    click Cek "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Cek.php"
    click Blank "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Blank.php"
    click Welcome "https://github.com/arifmardhavi/simpangan/blob/main/application/controllers/Welcome.php"
    click Mcrud "https://github.com/arifmardhavi/simpangan/blob/main/application/models/M_crud.php"
    click Msend "https://github.com/arifmardhavi/simpangan/blob/main/application/models/M_send_email.php"
    click VH "https://github.com/arifmardhavi/simpangan/blob/main/application/views/modul/header.php"
    click VH "https://github.com/arifmardhavi/simpangan/blob/main/application/views/modul/footer.php"
    click VH "https://github.com/arifmardhavi/simpangan/blob/main/application/views/modul/sidebar.php"
    click VPages "https://github.com/arifmardhavi/simpangan/blob/main/application/views/pengajuan.php"
    click VPages "https://github.com/arifmardhavi/simpangan/blob/main/application/views/berkas.php"
    click VPages "https://github.com/arifmardhavi/simpangan/blob/main/application/views/login.php"
    click VPages "https://github.com/arifmardhavi/simpangan/blob/main/application/views/welcome_message.php"
    click VErrors "https://github.com/arifmardhavi/simpangan/tree/main/application/views/errors/"
    click DBDriver "https://github.com/arifmardhavi/simpangan/blob/main/system/database/DB_driver.php"
    click QB "https://github.com/arifmardhavi/simpangan/blob/main/system/database/DB_query_builder.php"
    click CacheLib "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Cache/Cache.php"
    click CacheMem "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Cache/drivers/Cache_memcached.php"
    click CacheRedis "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Cache/drivers/Cache_redis.php"
    click SessionLib "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Session/Session.php"
    click SessFiles "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Session/drivers/Session_files_driver.php"
    click SessMem "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Session/drivers/Session_memcached_driver.php"
    click SessRedis "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Session/drivers/Session_redis_driver.php"
    click EmailLib "https://github.com/arifmardhavi/simpangan/blob/main/system/libraries/Email.php"
    click ThirdParty "https://github.com/arifmardhavi/simpangan/tree/main/application/third_party/"
    click Assets "https://github.com/arifmardhavi/simpangan/tree/main/assets/css/"
    click Assets "https://github.com/arifmardhavi/simpangan/tree/main/assets/js/"
    click Assets "https://github.com/arifmardhavi/simpangan/tree/main/assets/images/"
    click Prototypes "https://github.com/arifmardhavi/simpangan/tree/main/html/"

    %% Styles
    classDef framework fill:#D0E8FF,stroke:#0366d6,stroke-width:1px
    classDef app fill:#E2F4D7,stroke:#22863a,stroke-width:1px
    classDef db fill:#FFEBCD,stroke:#D2691E,stroke-width:1px
    classDef service fill:#F5E1FF,stroke:#6F42C1,stroke-width:1px
    classDef static fill:#E0E0E0,stroke:#4A4A4A,stroke-width:1px
    classDef external fill:#FFF5B1,stroke:#735C0F,stroke-width:1px
```
