Skip to content
All projectsA · Case study · Multi-role grocery commerce

Grabit

A grocery marketplace with ten roles, payments that are safe to retry, live chat and real-time rider tracking.

Live2026

Next.js 16 · Redux Toolkit · NestJS · Prisma 7 · Stripe · Leaflet

Grabit multi-screen storefront mockup showing home, categories, and shopping cart.
B

Overview

What it is
A multi-role grocery marketplace: storefront, vendor and admin tools, and rider delivery tracking.
Why it exists
To build commerce end to end at a realistic scale of roles, money handling and real-time logistics.
The problem
Commerce breaks at the edges: a double-clicked Pay button, a retried request, a delivery nobody can see. Each needs an engineered answer.
Who uses it
Customers, vendors, riders, support and admin staff — ten roles with their own permissions.
C

Given / Find

Given

  1. a)Ten roles, from customer and vendor to rider and admin
  2. b)Card payments where a retry must never become a second charge
  3. c)Deliveries customers want to follow live

Find

  1. a)One modular backend that keeps role permissions explicit
  2. b)Payment endpoints that are idempotent by design
  3. c)Live chat and rider location without page reloads

Approach

A modular NestJS application (33 modules) on Prisma and PostgreSQL. Payment requests carry an idempotency key that an interceptor records and replays. Socket.IO gateways carry chat, notifications and rider GPS; Leaflet draws the route. The storefront is Next.js 16 with Redux Toolkit, GSAP and Lenis across 118 pages.

D

My role

Full-stack developer · every commit in both repositories

  • FrontendOwned118 Next.js 16 pages: storefront, dashboards, tracking.
  • BackendOwned33 NestJS modules, payment safety, real-time gateways.
  • Data modelOwned26 Prisma schema files.
E

Stack

Frontend
Next.js 16Redux ToolkitGSAPLenisLeafletTailwind CSS
Backend
NestJSSocket.IO gatewaysIdempotency interceptorPDF invoices
Database
PostgreSQLPrisma 7 (26 schema files)
Auth & security
JWT with refresh rotationTOTP two-factorTen-role RBAC
Third-party services
Stripe + webhooks
Infrastructure
Docker ComposeCoolify · VPS PaaS
F

Key features

  1. F.01

    Idempotent payments

    Every payment request carries an idempotency key. Repeats get the stored response back instead of creating another charge.

  2. F.02

    Rider tracking

    Riders stream GPS positions over Socket.IO; customers watch the delivery move on a Leaflet map.

  3. F.03

    Live chat and notifications

    Customers and support talk in real time through the same gateway layer.

  4. F.04

    Ten-role operations

    Vendors, riders, support and admins each get their own tools, enforced by role guards on the API.

  5. F.05

    Invoices and refunds

    Orders produce PDF invoices; refunds, payouts and coupons each live in their own module.

G

Architecture

  1. Browser · Next.js 16

    Redux Toolkit · GSAP + Lenis · Leaflet map

    REST (Idempotency-Key on payments) · WebSocket
  2. NestJS · one modular application

    33 modulesidempotency interceptorgateways: chat, notifications, rider tracking

    Prisma 7
  3. PostgreSQL

    26 schema files

Called by the API

Stripe

checkout + webhooks

PDF

invoice generation

Fig. 1 · Grabit request path. One modular NestJS application with real-time gateways.
H

Challenges

  1. Problem 01

    Given

    A double-click or a network retry can send the same payment request twice.

    Approach

    An idempotency interceptor reads the Idempotency-Key header, stores the first response, and returns that stored response for every repeat.

    Result

    A retried request returns the original result instead of charging the customer a second time.
  2. Problem 02

    Given

    Product lookups over a large sorted catalogue should not scan every row.

    Approach

    An interpolation-search service estimates where a key should sit from the value range, probing fewer positions than binary search on evenly spread keys.

    Result

    O(log log n) average lookups on uniform keys, with O(n) as the documented worst case.
I

Results

Outcome

Storefront deployed on Vercel; 118 pages and a 33-module API in the codebase.

What I learned

  • Idempotency belongs in the payment API contract, not only in the button.
  • Real-time features need the same permission checks as REST endpoints.