← Back to Projects
In production
Full-Stack

Nebluna Inventory & Sales

Operations system and online store for a specialty coffee micro-roastery in Mexico City: two Next.js apps on one Supabase database.

View Demo
Nebluna Inventory & Sales

Main result

1,900+

automated tests: unit, component and integration

Date

August 20, 2026

Theme

Specialty coffee roasting and retail

Objective

Replace a spreadsheet and sell online without a second inventory.

Covers green coffee intake, roasting, packaging, sales, shipping and reporting. Business rules live in PostgreSQL constraints and triggers, so stock, lots and costs stay consistent whichever app writes them.

Challenges

  1. 01Stock must never go negative
  2. 02Cost per kilo depends on the weight lost in each roast
  3. 03Sales reps share data with administration but must not see costs or margins

How it was solved

  1. 01Database constraints and triggers reject invalid writes
  2. 02Shrinkage is recorded per roast and cost per kilo derived from it
  3. 03Row Level Security on every table

Results

  • One database and one inventory for the panel and the store
  • Integration tests against a database rebuilt from scratch in CI
  • Versioned migrations with an automated drift check against production

Overview

Administration and sales reps work in the panel; customers buy in the store.

Technical Implementation

Data Model

Every sale points to a lot, and a blend deducts from its source lots through a single path. Supplies are costed FIFO, so new purchases do not rewrite past margins.

Online Store

Each order becomes a panel sale, and each payment is recorded once even if it arrives late or twice. Customers pay by bank transfer or Mercado Pago and sign in with an emailed code.

Roast Log

Each roast records a target, a curve and a sensory evaluation. The curve is captured on a phone or imported from Artisan, then compared against a reference profile.

Features

  • Sales: retail and wholesale pricing, partial payments, printable ticket.
  • Store: checkout, customer account, coupons, reviews.
  • Inventory: packaged and bulk stock by lot, with freshness.
  • Production: roasts, shrinkage, blends.
  • Cupping: blind multi-coffee sessions across tasters.
  • Shipping: tracking and printable label.
  • Finance: commissions, expenses, period results.
  • Reports: by channel, product, customer and profitability.

Technologies

  • Next.js 16
  • React 19
  • TypeScript
  • Supabase
  • PostgreSQL
  • Row Level Security
  • Mercado Pago
  • React Query
  • Tailwind CSS 4
  • shadcn/ui
  • Zod
  • Vitest
  • Vercel

Impact

The roastery traces each lot from green coffee to online order and knows its real cost per kilo. Before roasting a coffee again, the log shows what was decided last time.

Ask my portfolio

AI

I answer from what's published on this site and link the project each answer comes from. If you'd rather talk to Fer, tell me and I'll pass on your details.