Stockie
Inventory, warehouses and sales for auto parts stores in Venezuela, in bolívares and dollars.
MonJeep and GlobalFia each run their own version · demo at stockie.envo-demo.tech · 25 screens
- Admin panel
- Point of sale
- Label printing
The code is private; I can walk you through it on a call.


The problem
An auto parts store in Venezuela sells over the counter, over WhatsApp and on credit, accepts Pago Móvil, POS terminals, cash, Zelle or USDT, and owes suppliers in both dollars and bolívares. With an exchange rate that changes every day, knowing how much stock is left and what the goods sold actually cost requires every movement to store its lot, its cost and its rate. Stockie grew out of the systems I built for MonJeep and GlobalFia.

Screens by role
A single panel with two roles: the admin sees everything; the salesperson sees their point of sale and whatever the admin enables for them. The interface is in Spanish.
Administration
Products with two prices plus a manual one, price history, compatible models and accent-insensitive SKU search. Only the admin can sell below cost, and it's audited.
Warehouses, stock intake with TSPL labels over WebUSB or USB, barcode scanning with the camera, transfers and adjustments. On returns, defective items are kept out of stock.
Suppliers with debts in dollars and bolívares, partial payments and suggested orders by minimum stock. Credit sales to approve, collect and void, voids with a daily limit, fiscal stock, reports and users.
- Stock intake
- Fiscal stock
- Suggested order
- Credit sales
- Reports





Sales
A point of sale for counter, WhatsApp or credit sales, accepting Pago Móvil, POS terminals, cash in bolívares or dollars, Zelle or USDT, and split payments. Salespeople see their own sales and dashboard, plus the panels the admin enables for them.
- Sale with split payment
- Salesperson dashboard


Architecture
Next.js with session middleware and an API with role guards; stock-core transactions write to PostgreSQL, and the API fetches the BCV rate from the bank's website once a day.
Technical decisions
How stock and the cost of goods sold stay accurate, with two currencies and a daily exchange rate.
FIFO lot costing
A sale consumes lots in the order they were received, and each sale line records which lot it came from and which supplier it was bought from. An integrity endpoint checks stock against the lots.
Stock locked before it's deducted
A sale locks the stock with
SELECT … FOR UPDATEinside the transaction. If two salespeople sell the last unit at the same time, the second one waits and then sees the actual stock: no overselling.A single USD conversion
Client and server use the same USD conversion function, with a rounding tolerance, so the total the salesperson sees is the one the API validates. Each sale stores the amount in dollars and in bolívares, along with the day's BCV rate.
Daily BCV rate, with manual entry
The official rate is fetched from the Central Bank of Venezuela (BCV) website once a day, and it can also be entered manually. The automatic fetch does not replace a manually entered rate.
Per-salesperson panels, enforced on pages and in the API
The admin enables panels for each salesperson, and the permission is enforced on the page and in the API: a salesperson can't reach data through a direct URL.
Quality and evidence
Results from npm run test:db against real PostgreSQL: FIFO costing and stock locking in every operation that touches them.
Two sales of the last unit at the same time: the second waits for the lock and is rejected for insufficient stock.
Ten sales against five units: five go through, in FIFO order, and no lot goes negative.
Without the
SELECT … FOR UPDATE, both concurrent-sale tests fail.Transferring, adjusting, voiding a sale, or closing and voiding a purchase while a sale is in progress: each warehouse's stock still equals the sum of its lots, and no lot goes negative.
Each run uses its own PostgreSQL database: it creates it, applies the migrations and empties it before every test.
16
integration tests against real PostgreSQL
12
unit tests for search
65
API routes
30
data models
Tech summary
- My role
- Full design and development
- When
- Since February 2026
- Status
- MonJeep and GlobalFia each run their own version today. The demo uses fictional data that resets every week.
- Components
- Admin panel · Point of sale · Label printing
- Architecture
- Next.js with session middleware and an API with role guards; stock-core transactions write to PostgreSQL, and the API fetches the BCV rate from the bank's website once a day.
- Practices
- Business logic centralized in stock-core transactions
- Role guards on pages and in the API
- Prisma migrations
- Integration tests against real PostgreSQL
- Strict TypeScript
- Focus areas
- Database: FIFO lot costing and stock locked with
SELECT … FOR UPDATE
- Database: FIFO lot costing and stock locked with
- Patterns
- FIFO costing
- Pessimistic locking (
SELECT … FOR UPDATE)
- Stack
Next.js
TypeScript
Prisma
PostgreSQL
Better Auth
Zod
WebUSB