GitHub - skorotkiewicz/vending-operations-portal: This is a responsive operations portal for a vending business with passive machines. Employees physically count stock during service visits;

2 min read Original article ↗

Vending Operations logo

A responsive operations portal for vending businesses with passive, old-school machines.
VOP, for short — vending operations, proven by physical counts.

Employees physically count stock during service visits; the portal never claims live machine telemetry.

It tracks cities, physical locations, multiple machines per location, location reserve stock, slot stock, product purchase/selling prices, refill planning, cash collection, issues, employee accounts, and immutable attributed audit history.

Portal preview

Fleet overview

Desktop fleet overview showing operational and financial priorities

Mobile service workflow

View mobile service workflow

Mobile physical count and refill workflow

Run locally without Cloudflare login

Requirements: Bun and Node-compatible system tooling.

bun install
cp .env.example .env
bunx wrangler d1 migrations apply DB --local
bun run db:seed       # optional realistic estate data
bun run dev

Set ORIGIN=http://localhost:5173 and a high-entropy BETTER_AUTH_SECRET of at least 32 characters in .env. Open http://localhost:5173; a fresh database starts with the one-time first-employee setup.

Wrangler’s local D1 emulator stores data under .wrangler/state. Local development needs no Cloudflare account, login, account ID, database ID, or API token.

Verification

bun run lint
bun run check
bun test
bun run build

Move the same app to hosted D1

No application rewrite is needed. Create a hosted D1 database, add its database_name and database_id to the existing DB binding in wrangler.jsonc, configure production auth values, and apply the same migrations remotely.

bunx wrangler login
bunx wrangler d1 create vending-operations
bunx wrangler secret put BETTER_AUTH_SECRET
bunx wrangler secret put ORIGIN
bunx wrangler d1 migrations apply DB --remote
bun run build
bunx wrangler deploy

Set ORIGIN to the final HTTPS origin, without a trailing path. Keep .env, .wrangler/, and all credentials out of source control. See local development, remote deployment, and the approved product plan.