Stargas Energies — Supplier Dashboard
A performance analytics dashboard for Stargas Energies, providing real-time insights into supplier spend, product sales, margins, and category breakdowns.
Built with Laravel 12, Chart.js 4, Tailwind CSS, and MariaDB, running in Docker.
Features
- KPI Cards — Total suppliers, products, customers, purchase spend, sales revenue, gross profit, margin %, and invoice count with animated counters
- Purchase Spend Over Time — Monthly line chart tracking supplier costs
- Sales Revenue & Profit Over Time — Dual-line chart showing revenue vs gross profit
- Top 10 Suppliers — Ranked list with progress bars, click to drill down into per-supplier product breakdown and spend timeline
- Top 10 Products — Ranked by revenue with margin indicators
- Category Breakdown — Doughnut chart of revenue by stock category
- Supplier Spend Comparison — Horizontal bar chart comparing top suppliers
Tech Stack
| Layer | Technology |
|---|---|
| Backend | Laravel 12 (PHP 8.2) |
| Database | MariaDB 10.11 |
| Frontend | Tailwind CSS, Chart.js 4 |
| Web Server | Nginx (Alpine) |
| Container | Docker Compose |
Database Schema
Data originates from an Omni Accounts Firebird database, exported to MariaDB. Eight tables:
| Table | Description |
|---|---|
PL_SUPPLIERACCOUNT |
Supplier master records |
PL_BILL |
Supplier invoices (headers) |
PL_BILLTRAN |
Supplier invoice line items |
SL_CUSTOMERACCOUNT |
Customer master records |
SL_SALESINVOICE |
Sales invoices (headers) |
SL_SALESINVOICETRAN |
Sales invoice line items |
STK_STOCKITEM |
Product/stock items |
STK_STOCKCATEGORY |
Product categories |
Important: Omni Accounts stores prices with a "per X units" divisor. The correct unit price formula is COSTPRICE / COSTPRICEPER (and SELLINGPRICE / SELLINGPRICEPER for sales).
Getting Started
Prerequisites
- Docker & Docker Compose
- The
kyle.sqldatabase dump file
Setup
# 1. Clone the repository
git clone <repo-url> supplier-dashboard
cd supplier-dashboard
# 2. Start the containers
docker-compose up -d --build
# 3. Import the database (first time only)
docker cp kyle.sql supplier-dashboard-mysql:/tmp/kyle.sql
docker exec -it supplier-dashboard-mysql mariadb -u root -proot supplier_dashboard -e "source /tmp/kyle.sql"
# 4. Generate application key
docker exec supplier-dashboard-app php artisan key:generate
# 5. Set storage permissions
docker exec supplier-dashboard-app chmod -R 777 /var/www/storage /var/www/bootstrap/cache
# 6. Add performance indexes
docker cp add_indexes.sql supplier-dashboard-mysql:/tmp/add_indexes.sql
docker exec -it supplier-dashboard-mysql mariadb -u root -proot supplier_dashboard -e "source /tmp/add_indexes.sql"
Access
- Dashboard: http://localhost:8000
- MariaDB:
localhost:3307(user:supplier, password:secret)
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | / |
Dashboard page |
| GET | /api/dashboard/summary |
KPI summary totals |
| GET | /api/dashboard/top-suppliers |
Top 10 suppliers by spend |
| GET | /api/dashboard/top-products |
Top 10 products by revenue |
| GET | /api/dashboard/spend-over-time |
Monthly purchase spend trend |
| GET | /api/dashboard/sales-over-time |
Monthly revenue & profit trend |
| GET | /api/dashboard/category-breakdown |
Revenue grouped by category |
| GET | /api/dashboard/supplier/{code} |
Supplier drill-down (products + timeline) |
Project Structure
supplier-dashboard/
├── docker-compose.yml # Container orchestration
├── Dockerfile # PHP-FPM app image
├── nginx/default.conf # Nginx reverse proxy config
├── add_indexes.sql # Performance indexes
├── kyle.sql # Database dump (not committed)
└── src/ # Laravel application
├── app/
│ ├── Http/Controllers/
│ │ └── DashboardController.php # All API endpoints
│ └── Models/ # Eloquent models (8)
├── resources/views/
│ └── dashboard.blade.php # Dashboard UI
├── routes/web.php # Route definitions
└── public/images/
└── star-gas-logo.jfif # Stargas logo