Back to Projects
Live

Fuelsgate

B2B Petroleum Marketplace & Station Management Platform

Key Technical Highlights

Four distinct user types — buyers, sellers (depot owners/traders), transporters, and station managers — each with a dedicated dashboard, workflow, and permission set

DeliveryLedger model: one document per tank per delivery enables granular FIFO cost attribution at tank level rather than truck level — costs distributed pro-rata by volume at ledger creation

Real-time counter-offer negotiation via WebSockets — structured price negotiation UI, not just a chat window

Transport fare calculator using Google Maps distance + configurable cost parameters (fuel consumption rate, maintenance, profit margin) — gives buyers a fair price baseline before negotiation

Automatic P&L emails sent to station owners when a delivery batch is fully sold through — fire-and-forget, non-blocking delivery ledger creation

The Case Study

The Problem

Nigeria's downstream petroleum sector runs on informal networks. Fuel purchases, transport negotiations, and station accounting happen via phone calls, WhatsApp groups, and paper ledgers. Depot owners have no digital storefront. Station managers track profitability in spreadsheets. Transporters negotiate rates blind.

The Solution

Fuelsgate is two products in one: a B2B petroleum marketplace connecting buyers, depot traders, and transporters — and a retail station management system with a FIFO P&L engine. Both share the same NestJS backend and auth system but serve completely different user workflows.

The Marketplace

Buyers browse product listings posted by depot owners and traders. When interested, they send an RFQ. The seller responds with a counter-offer. This isn't just messaging — it's a structured negotiation UI where each party can see the current offer, submit a counter, or accept. The entire flow is WebSocket-powered, so responses appear in real time.

Once price is agreed, the buyer selects a transporter. The same negotiation pattern repeats for transport cost. A fare calculator uses Google Maps to compute distance between loading point and destination, then applies configurable cost parameters — giving both parties a data-backed starting point for negotiation.

The FIFO P&L Engine

This is the technical core of the station management layer. A DeliveryLedger document is created per tank per delivery — not per truck. A single truck might deliver to four tanks. Four ledger documents are created, each carrying that tank's share of the delivery costs, calculated pro-rata by volume.

When a station manager records daily pump readings, the system attributes sales to the oldest ledger first (FIFO). When a ledger's stock is fully sold, the exact profit margin for that delivery batch is calculated and emailed to the station owner automatically — no manual computation, no spreadsheet.

Supporting Infrastructure

  • WebSocket-powered real-time notifications across all four user types
  • Rating system between buyers, sellers, and transporters after completed transactions
  • Full audit logging on all state-changing operations
  • Nigerian DPR-compliant export reports for station records
  • Cloudinary for waybill photo uploads
  • Resend for all transactional emails