Case study
Shakirin Mills Gold Refining Management System
A centralized operational and financial platform built to digitize the complete workflow of a gold grinding and refining business — from customers and grinding sessions to inventory, payroll, collections, accounting, and final profitability.
- Discipline
- Backend Systems
- Type
- ERP · Dashboard · API · Inventory
- Domain
- Gold Grinding & Refining Operations
- Role
- Backend Architecture & Full-Stack Development
- Status
- Production
01Project overview
What this system is
Shakirin Mills is an operational, financial, and administrative system built for a gold grinding and refining business. It takes a workflow that normally lives across notebooks, spreadsheets, and memory, and binds it into one dependent cycle: a customer arrives, a grinding session is opened against a machine, bags are ground, gold is produced and refined, direct expenses and inventory consumption are absorbed into the session, payroll accrues against the month, the company collects from its own profit, and every one of those movements lands in a single financial ledger that the accounting reports read from. The result is a mill whose operational and financial state can be read at any moment from one source instead of reconciled after the fact.
02The challenge
The problem it had to solve
Running a grinding mill means keeping bags, price per bag, gold output, refining fees, customer discounts, direct expenses, inventory consumption, payroll, maintenance, and company collections consistent with one another. Held in separate registers or manual calculations, those figures drift: expenses get counted twice, calculations differ between screens, historical reports change when a price is edited, and real profitability becomes very hard to establish.
03Solution & features
What was built
A centralized platform where every operation is bound to the rest of the system and every financial calculation resolves through one shared engine. Prices are captured as snapshots on the transaction, so historical records never move when settings change. Dashboards, the administrative report, the accountant workbook, and the financial ledger all read the same numbers, which makes the mill's operational and financial position provable rather than estimated.
Core features
Grinding Operations Management
Every session records its customer, machine, bags, gold quantity, grinding cost, refining cost, customer discount, operational expenses, inventory consumption, customer net, and its own profit — visible as a filterable register with per-session detail.
Accountant Workbook
A dedicated accountant surface listing each customer's grinding, gold weight, refining calculation, discount, total, microscope data, and notes for the day or month, with a period summary and CSV export.
Unified Financial Ledger
Every financial movement appears in one record with its source — grinding, expense, maintenance, payroll, financial adjustment, or company collection — its actor, role, income, expense, net effect, and reference, so any figure can be traced back to what produced it.
Administrative Reporting
Daily, monthly, yearly, and custom date ranges reporting customer net totals, operating expenses, session profits, payroll, maintenance, collections, and final company profit, with CSV export.
Payroll Management
Employees with monthly salary, employment start date, derived daily salary, worked days, accrued salary, and paid or pending status, summarised by total, paid, and outstanding.
Inventory Management
Item catalogue with supplier, category, unit, current quantity, minimum threshold, unit cost, and stock value, plus movement history and low or out-of-stock flags.
Grinding Machine Management
Machines are registered with a number and location, carry an availability state — available, under maintenance, or inactive with a stated reason — and each session is bound to the machine that performed it.
Dynamic Financial Configuration
Bag price, gold price per gram, refining price, customer discounts, and additional financial items are all editable by management without touching code. Items can be created, renamed, repriced, and deactivated.
Role-Based Access Control
General Manager, Manager, Accountant, Supervisor, and Assistant Supervisor each reach only the functions their role permits, managed from a user register showing role, status, and last sign-in.
Audit Logs
A read-only operations log recording who acted, when, from which address, and what changed — covering authentication, payroll, inventory, and accounting period activity.
Multilingual Interface
Arabic, English, and French, with RTL for Arabic and LTR for English and French. The selected language is stored against the user rather than reset on each visit.
Dark & Light Themes
An enterprise interface in graphite and black with a gold accent, in both dark and light modes, built on professional tables, cards, responsive forms, and consistent modals.
04Architecture & integrations
How the system fits together
The system is organised as a Laravel REST backend with a lightweight browser client, and the business rules live in a domain layer rather than in controllers. The operational lifecycle below is the spine of the product: each stage writes into the same financial source, which is why a figure on the dashboard, the administrative report, the accountant workbook, and the ledger cannot disagree.
Layers
01
Customer & Grinding
A customer record opens a grinding session against a specific machine, with the number of bags and the grinding account for that session.
02
Gold & Refining
Gold output is recorded in grams, the refining account is calculated from it, and any customer discount is applied to reach the customer's net.
03
Cost Absorption
Direct operational expenses, inventory consumption, and maintenance are charged against the session so its profit reflects real cost.
04
Payroll & Collections
Salaries accrue against the month and company remittances are drawn from validated available profit, both landing in the same ledger.
05
Accounting & Profit
The ledger, the accountant workbook, and the administrative report resolve to one final company net profit for the selected period.
Back-end services
- Unified Financial Engine
- A centralized financial layer rather than calculations scattered through controllers and views. It resolves grinding revenue, refining value, services, discounts, customer net due, operational expenses, inventory cost, maintenance, payroll, manual adjustments, company collections, grinding profit, and final company net profit — so every dashboard and report is reading the same computation.
- Grinding Operations
- Session lifecycle covering customer, grinding machine, number of bags, gold quantity, grinding cost, refining cost, customer discount, operational expenses, inventory consumption, customer net, and session profit.
- Payroll Service
- Employees, monthly salary, employment start date, derived daily salary, worked days, accrued salary, and pending or paid state. Accrual is computed rather than entered by hand.
- Company Collections
- Remittances are checked against available company profit before they are written, and are stored with the acting user, timestamp, profit before, and profit after. They are kept distinct from operational expenses.
- Inventory Service
- Item catalogue, current quantities, minimum thresholds, and inventory movements. Consumption is costed into the session so profit reflects the materials actually used.
- Maintenance
- Independent maintenance costs classified by type — emergency, periodic, and repair — tracked separately from session expenses but landing in the same ledger.
- Audit Logging
- A read-only record of system operations — who acted, when, from which address, and on what entity. Entries such as accounting period creation, payroll changes, inventory updates, and authentication events cannot be edited or deleted.
- Access Control
- Role-based authorisation across General Manager, Manager, Accountant, Supervisor, and Assistant Supervisor, enforced with Laravel policies so each user reaches only the functions their role allows.
APIs & integrations
- REST API surface
- The browser client talks to the system exclusively over a versioned Laravel REST API, with API Resources shaping every response so the client never depends on the database schema.
- Sanctum session authentication
- Authentication runs on a Sanctum session cookie, with password policy enforced at account creation and session events recorded in the audit log.
- Form Requests & Policies
- Input validation lives in Form Requests and authorisation in Policies, so a controller cannot accidentally accept an invalid payload or serve a record the role is not entitled to.
- CSV export
- The administrative report and the accountant workbook export their period to CSV for archiving and for handover to external accounting.
Dashboard modules
- Customer
- The registered customer the session belongs to, with their own history and statistics.
- Grinding
- A session opened against a machine, carrying the number of bags and the grinding account.
- Gold
- Gold output recorded in grams for the session, or no gold at all when the operation produced none.
- Refining
- The refining account calculated from the gold, then reduced by any applicable customer discount.
- Expenses
- Direct operational expenses attached to the session rather than pooled at the end of the month.
- Inventory
- Materials and spare parts consumed by the session, costed into it from the inventory ledger.
- Payroll
- Salaries accruing against the month from each employee's start date and worked days.
- Collections
- Company remittances drawn from available profit, validated before they are allowed to record.
- Accounting
- The financial ledger, the accountant workbook, and the administrative report over the chosen period.
- Company Profit
- The final net figure for the period, derived from the same engine every other screen reads.
05Technologies & role
The stack, and the role in it
Role on the projectBackend Architecture & Full-Stack Development
- Frontend
- HTML5
- CSS3
- Vanilla JavaScript
- Back end
- Laravel 12
- PHP
- MySQL
- REST API
- Laravel Sanctum
- Policies
- Form Requests
- API Resources
- Services
- Actions
- Automated Tests
- Integrations
- Sanctum session authentication
- CSV export
- Arabic / English / French localization
- Infrastructure
- VPS
- Nginx
- Dedicated PHP-FPM socket
- Dedicated MySQL database
- HTTPS / SSL
- GitHub Actions
06Challenges & decisions
The hard parts, and the decisions behind them
Challenge 01
Editing a financial setting retroactively changed historical operations and every report built on them.
How it was handled
Prices are snapshotted onto the transaction at creation time, so settings changes apply forward only and historical reports stay reproducible.
Challenge 02
The same figure was at risk of being computed differently on the dashboard, the report, and the ledger.
How it was handled
All financial computation was moved behind one service layer that every consumer calls, removing the possibility of two screens disagreeing.
Challenge 03
Operational expenses and inventory consumption were easy to double-count between the session and the monthly report.
How it was handled
Expenses and consumption are attached to the session that incurred them and flow upward into period reporting from there, so each cost is recognised exactly once.
Challenge 04
Company remittances could be taken against profit that did not exist.
How it was handled
Collections calculate available profit first, reject a request larger than it, and store profit before and after alongside the acting user and timestamp.
Technical decisions
- Historical price snapshots on every transaction.
- When a session is created at a given bag price, gold price, or refining price, those values are captured onto the transaction itself. If management changes a price later, the older operation does not move — and neither does any report built on it. Without this, editing a single financial setting would silently rewrite months of history.
- One centralized financial engine instead of per-screen calculation.
- Financial logic was deliberately kept out of controllers and out of the UI. Every consumer — dashboard, administrative report, accountant workbook, ledger — calls the same services, which is the only way two screens can be guaranteed to agree on a number.
- Decimal-based money and gold arithmetic.
- The system computes money against gold weights, where floating-point representation accumulates rounding error across a chain of multiplications and subtractions. Decimal-based backend calculation keeps totals stable across the grinding, refining, discount, and expense chain.
- Payroll accrual derived, not entered.
- Accrued salary is computed as monthly salary ÷ days in month × actual worked days, which handles months of different lengths and leap years without special cases. Once a salary is paid, the accrued value is frozen historically so a later month cannot alter a settled record.
- Collections validated against available profit.
- A company remittance is checked against calculated available profit before it can be recorded, and is stored with profit before and after. This prevents the company from collecting more than it actually earned, and keeps collections separate from operational expenses in every report.
- Deactivate rather than delete financial items in use.
- A financial item can only be deleted if it was never used historically. Anything referenced by an existing transaction is deactivated instead, so historical records keep resolving their line items and reports stay reproducible.
- Operations that produce no gold are first-class.
- Some sessions legitimately yield no gold. Rather than forcing a placeholder quantity to satisfy the schema, the system models the no-gold case directly, so reporting is never polluted with invented weights.
- Vanilla JavaScript on the client, not a frontend framework.
- The interface is a set of data-dense tables, forms, and modals driven by a REST API. HTML5, CSS3, and vanilla JavaScript keep it light and dependency-free; adding a frontend framework would have introduced a build pipeline and runtime weight this product did not need.
Performance
- Financial aggregates resolved server-side so the client renders prepared figures instead of computing them.
- Indexed lookups on the date, customer, and session columns the reports filter on.
- Paginated and filterable registers rather than loading full history into the browser.
- A dependency-free client that ships no framework runtime.
Interface & experience
- Enterprise interface in graphite and black with a single gold accent.
- Dark and light modes, switchable from the top bar.
- Arabic RTL alongside English and French LTR, with the choice persisted per user.
- Data-dense tables with consistent filters, modals, and responsive forms.
- Financial state carried by colour and label together — profit, loss, paid, pending — never colour alone.
Production readiness
- Deployed to a VPS in an independent production directory, isolated from the other applications on the same host.
- Dedicated MySQL database and a dedicated PHP-FPM socket for the application.
- Nginx in front, with HTTPS / SSL terminated at the edge.
- Automated deployment from GitHub via GitHub Actions.
- Backups taken before sensitive operations, with backup integrity verified rather than assumed.
- Production database guards protecting against accidental resets and preserving master data.
- Automated tests covering the financial paths that reports depend on.
07Gallery
The system on screen
08Outcome
Where it stands
- Status
- Production
- Interface languages
- Arabic · English · French
- Access roles
- 5
- Financial source
- Single unified engine
Related work
More systems like this

Morshed Platform Management System
A centralized management system that operates the whole Morshed educational platform — users, curriculum, lessons, courses, exams, subscriptions, payments, permissions, and the content the public site renders.

Awlad Ragab Wholesale System
The Laravel platform that runs Awlad Ragab's wholesale operation: products and categories, customer and representative accounts, orders, promotions, loyalty points, permissions and reporting, served to every client through one REST API.

Yusr Advanced Business
A complete business platform combining a multilingual custom CMS, E-Commerce, CRM, customer and order management, Blog CMS, business requests, notifications, and a full REST API integrated with a dynamic frontend.
Building something similar?
Describe what you need — the users, the scope, the systems it has to connect to — and I’ll reply with questions or a next step.
