Skip to content
BENAA homeالعربية

All work

Retail · Mobile spare parts · 2026

An Arabic ERP for a mobile spare-parts business

A business in Libya that sells mobile spare parts and repairs phones has to know, at any moment, what it holds, who owes it and what it owes. We built the system it runs on: parts with their variants and the models they fit, sales to retail and wholesale customers, purchases priced in dollars or dinars with their shipping costs, stock in each warehouse, repairs with parts and a technician’s commission, cashboxes, staff accounts, and the books, which every invoice, payment and return posts to by itself. It is in Arabic from the first screen, and its reports filter, print and export.

Built by

Tech lead
Client
Withheld at the client’s request
Timeline
May – September 2026
Squad
1 engineer, start to finish
Platform
Web · Arabic, right to left
Market
Libya
Size
106 models · 140 migrations · 65 reports
Access
186 permissions, and branches
Tests
1,453 tests, run on a fresh database
Status
Delivered

Technologies

  • Laravel 11
  • PHP
  • MySQL
  • Blade
  • Tabler (Bootstrap 5
  • RTL)
  • jQuery
  • DataTables
  • Spatie Permission
  • mPDF
  • WhatsApp gateway
  • PHPUnit

The product

16 images

01

Brief

A shop that must know what it holds, who owes it and what it owes.

Context

The business sells spare parts for phones, to retail and wholesale customers, and repairs devices at its counter. It buys from several suppliers, in dollars, dinars or yuan, and keeps stock in more than one warehouse.

What had to be managed

A part comes in several variants (colour, quality, with or without a frame) and fits many models; stock is bought at one cost and sold at several prices; money moves through cashboxes, wallets and credit; and the owner needs the books to agree with all of it.

Goals

  • One catalogue of parts, variants and compatible models
  • Sales, purchases and returns that move stock and money together
  • Cost, profit and ageing reports the owner can trust
  • Repairs with parts, labour and commission
  • Permissions and branches, so each person sees their own work
  • A ledger every document posts to by itself

02

Team

One engineer, from the first screen to the handover.

Lead engineerThe screens, the Laravel system, the ledger, the reports, the permissions, the tests and the client’s hosting×1Senior

Meet the team

03

UI/UX design

A right-to-left theme for people who work at a counter all day.

Who worked on it

Tech lead

The interface is built on a ready-made right-to-left admin theme, with the project’s own stylesheet on top: a dark top bar, a sidebar grouped the way the business works, soft cards for the figures that matter, and a colour for each status. A sale or a purchase is one long form with the totals always in view, and every list has its filters, its print and its export one click away.

  • Figures firstEach list and report opens with cards for the numbers that matter (totals, counts, what is pending), then the table, so the owner reads the day before the rows.
  • A colour for each statusInvoice, payment and repair states each have their own badge colour, so a row can be read at a glance.
  • Print, thermal and A4An invoice prints on an A4 letterhead with the amount in Arabic words, or on an 80 mm or 58 mm thermal receipt with a barcode.

04

Frontend

Forms that keep up with a counter: long, fast, and hard to lose.

Who worked on it

Tech lead

The screens are server-rendered Laravel Blade pages with jQuery, DataTables for the lists and Tom Select for the pickers. A sale starts from a customer, a price tier and a date, then searches parts by name, SKU, brand or model, with the stock and the last prices beside each result. A purchase adds a currency, an exchange rate and the shipping and customs costs. Both show their totals as they change, and take payment into several cashboxes at once.

One form for the whole sale.
A product, single or with variants.
Prices for many products at once.
  1. Decision 1

    Server-rendered pages, not a single-page app

    The system is forms, tables and reports, which server-rendered pages suit, and a ready-made right-to-left theme gave a tested layout from the first day.

    Trade-off · The busiest screens carry their scripts inside the page, so the longest ones are harder to maintain.

  2. Decision 2

    Drafts saved on the way

    A cashier is interrupted all day, and an invoice with thirty lines is a lot to retype.

    Trade-off · A draft sits on the server until it is used or cleared, so abandoned ones collect.

  • Search that ignores word orderTyping "oppo battery" or "battery oppo" finds the same parts, ranked by how well they match, with filters for category, brand, model, manufacturer and attributes.
  • Survives a power cutA long invoice is saved as a draft while it is typed, so a power cut or a closed tab does not lose it, and a page whose session expired returns to the form with its input kept.
  • A save that cannot doubleThe save button locks after the first press, so two quick clicks do not make two invoices.
  • Variants from attributesA product’s variants are generated live from its attributes, with rules such as "colour only applies with a frame", each with its own SKU, barcode and prices.
  • Prices for many products at onceA bulk price screen filters by category, brand, model, stock and warehouse, then raises, lowers or sets prices by a percentage or a fixed amount, with a history of every change.
  • Bulk printing and returnsMany invoices print together, and a consolidated return picks lines across a customer’s invoices and returns each invoice in one all-or-nothing step.

05

Backend & architecture

A ledger every document posts to, and costs that add up.

Who worked on it

Tech lead

The back end is one Laravel 11 application organised as 26 domain modules under src/Domain, each with its models, DTOs, services and tables. A request becomes a DTO, a service runs it inside a transaction with row locks, and an event posts the document to a double-entry ledger of control accounts: cash per cashbox, receivables, payables and stock. A document that is edited or cancelled is reversed and posted again, never deleted. Stock is valued at a moving weighted average cost per warehouse, and a purchase’s shipping and customs costs enter that value. Branches scope every read and write, and the owner shapes permissions in a role screen of 186 permissions.

A purchase in dollars, with its shipping.
Profit and margin by product.
Stock at cost and at selling price.
Who owes what, and for how long.
The trial balance.
Entries posted by the documents.
The chart of accounts.
The income statement.
Every cashbox and its balance.
Repairs, with the technician’s commission.
A role built from permissions.
The reports hub.
  1. Decision 1

    Moving average cost, with a repair that replays history

    Edits and returns once left stock valued at two or three times what was paid, so a command replays the surviving documents with the same arithmetic as the live flow and logs what it changed.

    Trade-off · It is an average per warehouse row, not FIFO, so a sale does not say which purchase it came from.

  2. Decision 2

    An accounting failure never blocks a save

    The cashier must be able to finish a sale even if a posting fails, so the failure is logged and the document stays.

    Trade-off · The ledger can miss an entry until someone notices and posts it again.

  3. Decision 3

    Landed cost is spread by quantity

    One class works out the unit cost, so a receipt and its reversal remove exactly what was added.

    Trade-off · A dear part and a cheap one carry the same share of a shipment.

  4. Decision 4

    A person with no branch sees every branch

    Branches were added to a live system, and this kept every existing account working on the day they arrived.

    Trade-off · Pinning someone to a branch is an explicit act, and forgetting it leaves them unrestricted.

  5. Decision 5

    No queue worker: a cron tick instead

    The hosting has no worker, so a command run each minute works the queue and WhatsApp messages send after the response.

    Trade-off · A message can wait up to a minute, and a slow gateway slows the request that sent it.

  • Fifteen kinds of document post themselvesSales, purchases, returns, vouchers, repairs, transfers, damages, accruals and more each write their own balanced entry; an entry that does not balance is refused, and a document posts once.
  • Purchases in several currenciesA purchase freezes its exchange rate; prices are typed in the invoice currency and shipping in dinars, and supplier balances use the frozen rate, never today’s.
  • Landed costShipping, customs and clearing are added per unit to the stock value and owed to their own payable account, not to the supplier, and paid from a costs screen.
  • Returns settle the way the sale was paidA return refunds the cash share to the original cashbox and takes the rest off the customer’s balance, never more than was sold.
  • Repairs with parts, labour and commissionA device is received first, then invoiced with part lines that move stock and labour lines; the technician’s commission is frozen on the invoice and accrued in the ledger.
  • Reports from one frameworkSixty-five reports across sales, purchases, stock, customers, suppliers, finance, repairs and staff share one filter bar, print and CSV export, and branch filters that can only narrow.

06

DevOps

On the client’s own hosting, with a cron tick for the queue.

Who worked on it

Tech lead

We set up the business’s own hosting and installed the system on it, so the business keeps its data and its server. The hosting has no queue worker, so the queue is worked by a command that cron runs each minute, and WhatsApp messages are sent right after the response is returned. The project’s maintenance commands run from the same command line when the books need correcting.

  • A queue without a workerA command run by cron each minute works the queue, so nothing depends on a background process the hosting does not allow.
  • Commands for the booksFour commands are there for the day the books need correcting: rebuild the average cost, repair sale costs, audit the cashiers’ safes, and reset transactions, with a dry run and a confirmation.
  • Safe to run againThe seeders can run a second time on a live install without duplicating anything, and never reset an existing administrator’s password.

07

QA

A test suite that keeps the money honest.

Who worked on it

Tech lead

The project ships with 1,453 tests in 166 files, written alongside the features. We ran the whole suite on a fresh MySQL-compatible database: 5,493 assertions pass, apart from Laravel’s stock example test, which still expects a public home page the system redirects from, and two skipped tests. They cover the places where an error costs money: invoice numbering, cost and landed cost, foreign-currency balances, returns, vouchers, the ledger, branch isolation, permissions, printing and the reports. One of them checks that per-branch reports add up to the company total.

08

Outcome

Delivered to the business.

The system was delivered to the business in 2026: the catalogue, sales, purchases, stock, repairs, cashboxes, staff, branches and the books described above, for its team to work in.

An Arabic ERP for a mobile spare-parts business

Arrow keys or a swipe to move · Esc to close

Tell us what you’re building.

A short message is enough. A senior engineer replies within 1 working day.