1. Point of Sale
Reactive Alpine.js split-screen cart with search, categories, discount handling, and quick checkout.
2. Dashboard
Live KPIs, best-sellers, low-stock warnings, and inventory valuation at a glance.
3. Reports & Analytics
Sales summaries, best-selling products, low-stock alerts, and stock movement ledgers.
StockFlow POS
A Full-Stack Laravel Point-of-Sale with Atomic Stock Deduction, Thermal Receipt Printing, and a Complete Inventory Audit Trail
Note: this demo runs on Render's free tier and may take 30–60 seconds to spin up if it has been idle.
At a Glance
- Problem
- A retail store tracked stock in disconnected spreadsheets, causing overselling, stock-outs, and no audit trail.
- Role
- Designed and built the full-stack system: Laravel API, Alpine.js POS, schema, auth, and reporting.
- Solution
- A point-of-sale with atomic stock deduction, thermal receipt printing, and a stock-movement ledger.
- Result
- Server-side stock verification prevents overselling, and every movement is attributable to a user with a reason.
- Proof
- Live demo (Render free tier), GitHub repository, screenshots, and the schema and API documentation below.
Executive Summary
StockFlow POS is a production-ready point-of-sale and inventory management system built on Laravel 12. It replaces error-prone, spreadsheet-driven store operations with a transactional backend, a reactive Alpine.js checkout interface, and a complete audit trail for every stock movement.
Sales are processed inside a single database transaction that atomically deducts stock, records a stock_movements ledger entry, and returns change computation for cash, GCash, or card payments. A printable 80mm thermal receipt view completes the loop, making the system fully functional for a small retail counter out of the box.
The Manual Nightmare
- • Guessing Stock Levels: Cashiers sell from memory while actual on-hand quantity lives in a disconnected spreadsheet.
- • Overselling & Stock-outs: No low-stock warnings, so fast-moving items sell out before anyone notices.
- • No Audit Trail: Adjustments, deliveries, and sales are undocumented, making shrinkage impossible to trace.
- • Manual Receipts: Handwritten or manually typed receipts leave room for pricing and change errors.
The Digital Solution
- • Atomic Checkout: Sales deduct stock and write ledger entries inside one
DB::transaction(). - • Live Stock Visibility: Dashboard surfaces low-stock alerts and inventory valuation in real time.
- • Full Audit Trail: Every
stock_in,sale, andadjustmentis logged with the responsible user. - • Thermal Receipts: 80mm print-ready receipt preview with automatic change calculation on every sale.
Core Architecture
1. Transactional POS Engine
The POST /api/transactions endpoint is the heart of the system. Each sale runs inside a database transaction that:
- Re-verifies current stock for every line item server-side, returning
422if any item is oversold. - Deducts product stock atomically and writes a
salemovement entry per product. - Captures a historical snapshot of product name and unit price on each line item, so old receipts remain accurate even after a product is edited or deleted.
- Computes subtotal, discount, total, amount paid, and change, then returns a
201 Createdresponse with the full receipt payload.
2. Reactive Alpine.js Frontend
Built with Vite 7 and Tailwind CSS v4, the POS page uses a lightweight Alpine.js cart component for instant, dependency-free reactivity:
- Product search and category filtering without full page reloads.
- Live cart totals, quantity steppers, and discount input (fixed or percentage).
- A checkout modal with payment method, quick-cash buttons, and automatic change calculation.
- An 80mm thermal receipt preview that triggers the browser's native
@media printwindow.
3. Role-Based Access & Stock Audit
Users are assigned an admin or cashier role. Cashiers can process sales while admins manage products, categories, inventory, and reports. Every stock change — deliveries (stock_in), sales (sale), and manual corrections (adjustment) — is recorded with the responsible user and an optional reason for full traceability.
Database & Schema Design
A normalized relational schema (SQLite by default, MySQL/PostgreSQL-ready) keeps historical sales accurate while enabling fast reporting:
users
Auth + Roles- name string(255)
- email [UNIQUE] string(255)
- role admin | cashier
- password string(255)
- remember_token string nullable
categories
Soft Deletes- name [UNIQUE] string(255)
- relationship hasMany products
- deleted_at timestamp nullable
products
Soft Deletes- sku [UNIQUE] string(100)
- category_id [FK] unsigned bigint
- price decimal(12,2)
- stock_quantity integer
- low_stock_threshold integer (default 5)
transactions
1 : * transaction_items- transaction_number string(100) UNIQUE
- user_id [FK] Cashier
- subtotal / total decimal(12,2)
- payment_method cash | gcash | card
- amount_paid / change decimal(12,2)
transaction_items
Historical Snapshot- transaction_id [FK CASCADE] unsigned bigint
- product_id [FK SET NULL] nullable
- product_name string snapshot
- unit_price / subtotal decimal(12,2)
- quantity integer
stock_movements
Audit Ledger- product_id [FK CASCADE] unsigned bigint
- user_id [FK SET NULL] nullable
- type stock_in | sale | adjustment
- quantity (+/-) integer
- reason string nullable
REST API Surface
A clean, versioned JSON API powers both the Blade frontend and any future mobile or integration clients:
| Domain | Key Endpoints | Description |
|---|---|---|
| Auth | POST /api/login · logout · GET /api/user | Session-based auth with role-aware profile fetch. |
| Products | GET/POST/PUT/DELETE /api/products | Searchable list with category and low-stock filters; soft-delete safe. |
| Transactions | POST /api/transactions | Atomic sale: verify stock, deduct, write ledger, compute change. |
| Inventory | POST /api/inventory/stock-in · /adjust | Restock and manual adjustments with reasons, plus movement audit log. |
| Reports | GET /api/reports/* | Sales summary, best-sellers, low-stock, valuation, and movement totals. |
Key Benefits & Tangible Outcomes
Zero Overselling
Server-side stock verification inside every sale guarantees cashiers can never sell more than what's actually on hand.
Complete Audit Trail
Every stock-in, sale, and adjustment is attributable to a user with a reason, eliminating shrinkage blind spots.
Historical Integrity
Line items snapshot product name and price at sale time, so past receipts stay correct after edits or deletes.
Counter-Ready Workflow
From scan to printed 80mm thermal receipt in seconds, with change calculated automatically — no calculator required.
Need a custom POS or inventory system?
Let's coordinate to build scalable Laravel backends, offline-first storefronts, or reporting dashboards tailored to your business.
Get in Touch →