# rupertgalit/sales-invoice architecture

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

- Interactive diagram: https://gitdiagram.com/rupertgalit/sales-invoice
- Repository: https://github.com/rupertgalit/sales-invoice

## Overview

This repository combines a CodeIgniter 3 PHP application with a REST-controller library; its visible default application route renders a sales-invoice view. The runtime path is HTTP request → framework routing/bootstrap → controller → view. REST request parsing and API-key/rate-limit checks are also present in the sampled library, but no application REST endpoint is shown. The README provides no product detail, and frontend assets are absent from the supplied tree, so the invoice view’s behavior and any broader dashboard workflow cannot be established here.

Main entry points: [`system/core/CodeIgniter.php`](https://github.com/rupertgalit/sales-invoice/blob/main/system/core/CodeIgniter.php) (Framework bootstrap), [`system/core/Loader.php`](https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Loader.php) (Class and view loader), [`system/database/DB_query_builder.php`](https://github.com/rupertgalit/sales-invoice/blob/main/system/database/DB_query_builder.php) (Query builder), [`application/libraries/REST_Controller.php`](https://github.com/rupertgalit/sales-invoice/blob/main/application/libraries/REST_Controller.php) (REST controller)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_routes["Route configuration<br/>[routes.php]"]
  node_sales["Sales invoice controller<br/>[SalesInvoice.php]"]
  node_invoice["Sales invoice view<br/>[sales_invoice.php]"]
  node_welcome["Welcome controller<br/>[Welcome.php]"]
end

subgraph group_rest["REST API"]
  node_restcontroller["REST controller"]
  node_restconfig["REST configuration<br/>[rest.php]"]
  node_formatter["Response formatter<br/>[Format.php]"]
end

subgraph group_framework["CodeIgniter Runtime"]
  node_front["PHP entry point<br/>[index.php]"]
  node_bootstrap["Framework bootstrap<br/>[CodeIgniter.php]"]
  node_router["URI router<br/>[Router.php]"]
  node_frameworkcore["Core services"]
  node_loader["Class and view loader<br/>[Loader.php]"]
  node_controllerbase["Controller base<br/>[Controller.php]"]
end

subgraph group_state["Persistence"]
  node_dbquery["Query builder"]
  node_dbdrivers["Database drivers"]
  node_dbconfig["Database configuration<br/>[database.php]"]
  node_session["Session manager<br/>[Session.php]"]
  node_sessiondb["Database session driver"]
end

node_browser(("Browser"))

node_browser -->|"sends request"| node_front
node_front -->|"starts runtime"| node_bootstrap
node_bootstrap -->|"initializes routing"| node_router
node_router -->|"loads routes"| node_routes
node_routes -->|"defaults to"| node_sales
node_sales -->|"loads view via"| node_loader
node_loader -.->|"renders"| node_invoice
node_bootstrap -->|"initializes services"| node_frameworkcore
node_controllerbase -->|"initializes"| node_loader
node_bootstrap -.->|"dispatches controller"| node_controllerbase
node_restcontroller -.->|"reads settings"| node_restconfig
node_restcontroller -->|"checks keys and limits"| node_dbquery
node_dbquery -.->|"uses driver"| node_dbdrivers
node_dbconfig -.->|"configures connection"| node_dbdrivers
node_session -->|"loads configured driver"| node_sessiondb
node_sessiondb -->|"reads and writes session data"| node_dbquery

click node_front "https://github.com/rupertgalit/sales-invoice/blob/main/index.php"
click node_bootstrap "https://github.com/rupertgalit/sales-invoice/blob/main/system/core/CodeIgniter.php"
click node_router "https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Router.php"
click node_routes "https://github.com/rupertgalit/sales-invoice/blob/main/application/config/routes.php"
click node_sales "https://github.com/rupertgalit/sales-invoice/blob/main/application/controllers/SalesInvoice.php"
click node_invoice "https://github.com/rupertgalit/sales-invoice/blob/main/application/views/sales_invoice.php"
click node_restcontroller "https://github.com/rupertgalit/sales-invoice/blob/main/application/libraries/REST_Controller.php"
click node_restconfig "https://github.com/rupertgalit/sales-invoice/blob/main/application/config/rest.php"
click node_formatter "https://github.com/rupertgalit/sales-invoice/blob/main/application/libraries/Format.php"
click node_frameworkcore "https://github.com/rupertgalit/sales-invoice/tree/main/system/core"
click node_loader "https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Loader.php"
click node_controllerbase "https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Controller.php"
click node_dbquery "https://github.com/rupertgalit/sales-invoice/blob/main/system/database/DB_query_builder.php"
click node_dbdrivers "https://github.com/rupertgalit/sales-invoice/tree/main/system/database/drivers"
click node_dbconfig "https://github.com/rupertgalit/sales-invoice/blob/main/application/config/database.php"
click node_session "https://github.com/rupertgalit/sales-invoice/blob/main/system/libraries/Session/Session.php"
click node_sessiondb "https://github.com/rupertgalit/sales-invoice/blob/main/system/libraries/Session/drivers/Session_database_driver.php"
click node_welcome "https://github.com/rupertgalit/sales-invoice/blob/main/application/controllers/Welcome.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_routes,node_sales,node_invoice,node_welcome,node_browser toneBlue
class node_restcontroller,node_restconfig,node_formatter toneAmber
class node_front,node_bootstrap,node_router,node_frameworkcore,node_loader,node_controllerbase toneMint
class node_dbquery,node_dbdrivers,node_dbconfig,node_session,node_sessiondb toneRose
```

## Components

### Application

- [Route configuration](https://github.com/rupertgalit/sales-invoice/blob/main/application/config/routes.php): `application/config/routes.php`
- [Sales invoice controller](https://github.com/rupertgalit/sales-invoice/blob/main/application/controllers/SalesInvoice.php): `application/controllers/SalesInvoice.php`
- [Sales invoice view](https://github.com/rupertgalit/sales-invoice/blob/main/application/views/sales_invoice.php): `application/views/sales_invoice.php`
- [Welcome controller](https://github.com/rupertgalit/sales-invoice/blob/main/application/controllers/Welcome.php): `application/controllers/Welcome.php`

### REST API

- [REST controller](https://github.com/rupertgalit/sales-invoice/blob/main/application/libraries/REST_Controller.php): `application/libraries/REST_Controller.php`
- [REST configuration](https://github.com/rupertgalit/sales-invoice/blob/main/application/config/rest.php): `application/config/rest.php`
- [Response formatter](https://github.com/rupertgalit/sales-invoice/blob/main/application/libraries/Format.php): `application/libraries/Format.php`

### CodeIgniter Runtime

- [PHP entry point](https://github.com/rupertgalit/sales-invoice/blob/main/index.php): `index.php`
- [Framework bootstrap](https://github.com/rupertgalit/sales-invoice/blob/main/system/core/CodeIgniter.php): `system/core/CodeIgniter.php`
- [URI router](https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Router.php): `system/core/Router.php`
- [Core services](https://github.com/rupertgalit/sales-invoice/tree/main/system/core): `system/core`
- [Class and view loader](https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Loader.php): `system/core/Loader.php`
- [Controller base](https://github.com/rupertgalit/sales-invoice/blob/main/system/core/Controller.php): `system/core/Controller.php`

### Persistence

- [Query builder](https://github.com/rupertgalit/sales-invoice/blob/main/system/database/DB_query_builder.php): `system/database/DB_query_builder.php`
- [Database drivers](https://github.com/rupertgalit/sales-invoice/tree/main/system/database/drivers): `system/database/drivers`
- [Database configuration](https://github.com/rupertgalit/sales-invoice/blob/main/application/config/database.php): `application/config/database.php`
- [Session manager](https://github.com/rupertgalit/sales-invoice/blob/main/system/libraries/Session/Session.php): `system/libraries/Session/Session.php`
- [Database session driver](https://github.com/rupertgalit/sales-invoice/blob/main/system/libraries/Session/drivers/Session_database_driver.php): `system/libraries/Session/drivers/Session_database_driver.php`

### Other components

- **Browser**

## Connections

- Browser → PHP entry point: sends request
- PHP entry point → Framework bootstrap: starts runtime (evidence: `index.php`)
- Framework bootstrap → URI router: initializes routing (evidence: `system/core/CodeIgniter.php`)
- URI router → Route configuration: loads routes (evidence: `system/core/Router.php`)
- Route configuration → Sales invoice controller: defaults to (evidence: `application/config/routes.php`)
- Sales invoice controller → Class and view loader: loads view via (evidence: `application/controllers/SalesInvoice.php`)
- Class and view loader → Sales invoice view: renders
- Framework bootstrap → Core services: initializes services (evidence: `system/core/CodeIgniter.php`)
- Controller base → Class and view loader: initializes (evidence: `system/core/Controller.php`)
- Framework bootstrap → Controller base: dispatches controller (evidence: `system/core/CodeIgniter.php`)
- REST controller → REST configuration: reads settings
- REST controller → Query builder: checks keys and limits (evidence: `application/libraries/REST_Controller.php`)
- Query builder → Database drivers: uses driver
- Database configuration → Database drivers: configures connection
- Session manager → Database session driver: loads configured driver (evidence: `system/libraries/Session/Session.php`)
- Database session driver → Query builder: reads and writes session data (evidence: `system/libraries/Session/drivers/Session_database_driver.php`)
