Skip to content

US Arabian Perfume: storefront, till, stock and payroll on one platform

One platform for a perfume retailer with online and in-store sales: storefront, point of sale, branch stock, attendance, commission and payroll, sharing one codebase and one database.

Client
US Arabian Perfume
Industry
retail
Duration
Live (built 2025)

The problem

US Arabian Perfume sells perfume oils and sprays online and across retail locations in New Jersey and New York. Both halves of the business share the same products, stock, staff and money, so they cannot be run as two systems that are reconciled afterwards. Four questions had to be answered correctly every day: what can actually be sold and where (a 30 ml oil is raw oil, an empty bottle and often a carry bag, so a branch can hold oil and still be unable to sell); who made a sale and what they are owed; whether the money and the stock both moved; and whether head office can see everything without getting in a branch's way.

The approach

We built one Next.js application over one PostgreSQL database, carrying four product surfaces: a storefront for customers, an admin portal for head office, a branch portal for each shop and a mobile-first employee app. The rules live in a service layer rather than in route handlers, so a screen cannot calculate something different from the scheduled job that pays it. Inventory is typed (raw oil, bottles, carry bags, testers, finished sprays) and counted per branch, so whether a product is sellable is derived from what is actually in stock. Access is layered: routes are gated by role, branch scope comes from the signed-in session, and the riskiest checks run inside the database transaction.

The outcome

The platform is live and trading, online and in store. The website, the shop floor and head office work from one catalogue, one stock position and one set of staff records. Every in-store sale belongs to an open register shift with a named opener and closer. Commission is derived from recorded attendance and attributed sales, and the employee sees the same working as the approver. A payment that cannot become an order is refunded automatically and queued for review. Repository and deployment audit of the live system, September 2026: 210 API route handlers, 72 page routes, 64 database models, 146 automated test files, 6 scheduled jobs and 4 product surfaces. No performance or commercial figures are published: none were measured, and the client's trading numbers are theirs.

Challenges

A till can lose its connection after charging a customer. Each checkout carries an identifier generated before it is sent, and the server uses a PostgreSQL advisory lock on it, so a retry returns the original receipt instead of charging or deducting stock twice. The same identifier with a different basket is refused. Online, a card payment can succeed while order creation fails. Before creating anything the server checks the captured amount against its own total; if the amount differs or the order cannot be created, it refunds, stores a snapshot of the checkout, alerts an administrator and tells the customer. Commission is calculated per employee, per branch and per day, and each ledger row stores its inputs and the rules that produced it. Only pending rows recalculate, so an approved or paid decision is never silently rewritten. Payroll settles in a single transaction, with no amount sent from the browser, and declines to pay hours it cannot price.

What was built

  • — Storefront with size variants and Square checkout
  • — with destination-based US sales tax and international shipping
  • — Point of sale that will not open without a register shift
  • — with prices and tax worked out on the server
  • — Composite inventory: raw oils
  • — bottles
  • — carry bags
  • — testers and finished sprays held and counted per branch
  • — Register shifts with cash reconciliation
  • — branch-scoped reporting and stock requests against central availability
  • — Session-based clock in and out with breaks
  • — branch attribution and a two-sided correction workflow
  • — Daily commission ledger under per-branch
  • — effective-dated rules
  • — with approval and payroll settled in one transaction
  • — Employee app showing the shift clock
  • — commission with its workings
  • — outstanding pay and attendance history
  • — Six roles enforced at the network edge
  • — in the API layer and again inside the database transaction
  • — Audit logging
  • — rate limiting
  • — immediate session revocation and an administrator-controlled maintenance mode

Technology

Next.jsReactTypeScriptTailwind CSSPostgreSQLPrismaAuth.jsSquareShippoResendCloudflare R2Upstash RedisSentryVitestVercel

Have a similar operational problem?

Start with a 30-minute conversation about the operation and the useful next step.

  • Free 30-minute call
  • No obligation
  • Reply within 24 hours
Book a free 30-min call