Project case study

Dryft and Wick

A full-stack candle e-commerce platform with M-Pesa mobile payments, a protected admin dashboard, real-time stock management, and Docker-containerised deployment.

Dryft and Wick screenshot
Next.js App RouterFramework
Prisma + PostgreSQLDatabase
M-Pesa Daraja APIPayments
DockerDeployment
Overview

What is Dryft and Wick?

Customers can browse the catalogue, manage a persistent cart, and pay directly through the app using M-Pesa STK Push; no redirects, no third-party checkout pages.

The platform includes a protected admin dashboard where the store owner can manage products, update stock in real time, upload product images via Cloudinary, and track orders alongside their payment statuses. The entire application is containerised with Docker for consistent local development and production deployment.

Features

What it does

M-Pesa STK Push
Real-time mobile payment processing via Daraja API, with async callback handling and automatic order status polling with timeout management.
Persistent cart
Cart state managed via React Context: add, remove, update quantity, and clear, all tied directly to the checkout and payment flow.
Protected admin dashboard
Session-based authentication gates the admin area. The owner can manage products (CRUD), edit stock in real time, upload images, and view orders with payment status.
Transactional order creation
API routes handle atomic stock decrement on successful payment, with stock validation before order creation to prevent overselling.
Docker containerisation
Custom Dockerfile with environment-specific configuration for consistent local development and production deployment readiness.
Cloudinary image uploads
Product images are uploaded and managed through Cloudinary directly from the admin dashboard.
Tech stack

Built with

Framework
Next.js App Router
Language
TypeScript
Styling
Tailwind CSS
Database
PostgreSQLPrisma ORM
Payments
M-Pesa Daraja API
Media
Cloudinary
Deployment
Docker
Challenges

What I worked through

Handling asynchronous M-Pesa callbacks Solved
M-Pesa STK Push is asynchronous; the payment result arrives via a callback URL, not as a direct response. I implemented a polling mechanism on the frontend that checks order status every few seconds after initiating payment, with an automatic timeout so the user isn't left waiting indefinitely if the callback is delayed.
Atomic stock management on payment confirmation Solved
Stock needed to be decremented only after a confirmed payment, not at cart or checkout time. I used Prisma transactions to handle order creation and stock decrement atomically, with upfront stock validation to reject orders for out-of-stock items before the payment flow even begins.
Server/client component split in Next.js App Router Solved
The App Router's server/client boundary required careful planning: data fetching and database calls live in server components, while interactive UI like the cart and payment flow live in client components. Getting this split right was key to keeping the app performant without sacrificing interactivity.
CRM All projects