# camiamaya451-cmd/freysi architecture

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

- Interactive diagram: https://gitdiagram.com/camiamaya451-cmd/freysi
- Repository: https://github.com/camiamaya451-cmd/freysi

## Overview

FREY STUDIO is a PHP/MySQL shop-management starter for makeup retail. The main workflow is staff sign-in, navigating the dashboard, and recording a sale that checks stock, saves sale details and payment, then reduces inventory in a transaction. Product, customer, and supplier management are separate capabilities. The supplied tree is flatter than the README’s described layout, and some referenced directories are absent; edges therefore reflect relationships visible in the excerpts, not a verified runnable deployment. The database schema is documented as a product component, but its SQL was not excerpted.

Main entry points: [`index.php`](https://github.com/camiamaya451-cmd/freysi/blob/main/index.php) (Page router), [`database.php`](https://github.com/camiamaya451-cmd/freysi/blob/main/database.php) (PDO connection), [`dashboard.php`](https://github.com/camiamaya451-cmd/freysi/blob/main/dashboard.php) (Dashboard indicators), [`products.php`](https://github.com/camiamaya451-cmd/freysi/blob/main/products.php) (Products and categories)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and overview"]
  node_router["Page router<br/>[index.php]"]
  node_auth["Login and roles<br/>[bootstrap.php]"]
  node_dashboard["Dashboard indicators<br/>[dashboard.php]"]
end

subgraph group_catalog["Shop records"]
  node_products["Products and categories<br/>[products.php]"]
  node_clients["Customer records<br/>[clients.php]"]
  node_providers["Supplier records<br/>[providers.php]"]
end

subgraph group_operations["Sales operations"]
  node_sales["Sales and payments<br/>[sales.php]"]
end

subgraph group_persistence["Persistence"]
  node_dbhelper["PDO connection<br/>[database.php]"]
  node_store[("Shop database<br/>[database.sql]")]
end

node_staff(("Staff"))

node_staff -->|"opens pages"| node_router
node_router -->|"checks access"| node_auth
node_router -->|"renders"| node_dashboard
node_router -->|"routes saves and views"| node_products
node_router -->|"routes saves and views"| node_clients
node_router -->|"routes saves and views"| node_providers
node_router -->|"routes saves and views"| node_sales
node_router -->|"queries users"| node_dbhelper
node_dashboard -->|"queries metrics"| node_dbhelper
node_products -->|"reads and writes"| node_dbhelper
node_clients -->|"reads and writes"| node_dbhelper
node_providers -->|"reads and writes"| node_dbhelper
node_sales -->|"records transactions"| node_dbhelper
node_dbhelper -.->|"connects to"| node_store

click node_router "https://github.com/camiamaya451-cmd/freysi/blob/main/index.php"
click node_auth "https://github.com/camiamaya451-cmd/freysi/blob/main/bootstrap.php"
click node_dashboard "https://github.com/camiamaya451-cmd/freysi/blob/main/dashboard.php"
click node_products "https://github.com/camiamaya451-cmd/freysi/blob/main/products.php"
click node_clients "https://github.com/camiamaya451-cmd/freysi/blob/main/clients.php"
click node_providers "https://github.com/camiamaya451-cmd/freysi/blob/main/providers.php"
click node_sales "https://github.com/camiamaya451-cmd/freysi/blob/main/sales.php"
click node_dbhelper "https://github.com/camiamaya451-cmd/freysi/blob/main/database.php"
click node_store "https://github.com/camiamaya451-cmd/freysi/blob/main/database.sql"

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_router,node_auth,node_dashboard toneBlue
class node_products,node_clients,node_providers toneAmber
class node_sales toneMint
class node_dbhelper,node_store toneRose
class node_staff toneIndigo
```

## Components

### Access and overview

- [Page router](https://github.com/camiamaya451-cmd/freysi/blob/main/index.php): `index.php`
- [Login and roles](https://github.com/camiamaya451-cmd/freysi/blob/main/bootstrap.php): `bootstrap.php`
- [Dashboard indicators](https://github.com/camiamaya451-cmd/freysi/blob/main/dashboard.php): `dashboard.php`

### Shop records

- [Products and categories](https://github.com/camiamaya451-cmd/freysi/blob/main/products.php): `products.php`
- [Customer records](https://github.com/camiamaya451-cmd/freysi/blob/main/clients.php): `clients.php`
- [Supplier records](https://github.com/camiamaya451-cmd/freysi/blob/main/providers.php): `providers.php`

### Sales operations

- [Sales and payments](https://github.com/camiamaya451-cmd/freysi/blob/main/sales.php): `sales.php`

### Persistence

- [PDO connection](https://github.com/camiamaya451-cmd/freysi/blob/main/database.php): `database.php`
- [Shop database](https://github.com/camiamaya451-cmd/freysi/blob/main/database.sql): `database.sql`

### Other components

- **Staff**

## Connections

- Staff → Page router: opens pages (evidence: `index.php`)
- Page router → Login and roles: checks access (evidence: `index.php`)
- Page router → Dashboard indicators: renders (evidence: `index.php`)
- Page router → Products and categories: routes saves and views (evidence: `index.php`)
- Page router → Customer records: routes saves and views (evidence: `index.php`)
- Page router → Supplier records: routes saves and views (evidence: `index.php`)
- Page router → Sales and payments: routes saves and views (evidence: `index.php`)
- Page router → PDO connection: queries users (evidence: `index.php`)
- Dashboard indicators → PDO connection: queries metrics (evidence: `dashboard.php`)
- Products and categories → PDO connection: reads and writes (evidence: `products.php`)
- Customer records → PDO connection: reads and writes (evidence: `clients.php`)
- Supplier records → PDO connection: reads and writes (evidence: `providers.php`)
- Sales and payments → PDO connection: records transactions (evidence: `sales.php`)
- PDO connection → Shop database: connects to
