Daveysapphttps://www.daveysapp.com
A multi-tenant, geo-aware marketplace pairing customers with local service providers — real-time chat, bookings, dispute resolution, and Stripe subscriptions across a Next.js web platform and a companion React Native app.
The Problem
The client needed a marketplace where customers could discover and book local service providers by location, message them in real time, and pay securely — with each provider operating as an independent tenant on a tiered subscription. The hard parts: keeping two services (the web/API platform and a standalone real-time chat server) sharing one database in perfect sync, making provider search fair rather than pay-to-win, and guaranteeing that billing state could never drift from Stripe's source of truth — all while holding up under real concurrency.
The Approach
I split the system into a Next.js 16 App Router platform (auth, bookings, payments, admin) and a dedicated Express 5 + Socket.io chat server, both backed by the same MongoDB, with shared Mongoose models kept byte-identical across the two repos so the services never disagree on schema. I delivered in six independently shippable phases: the booking lifecycle, the notification data layer, real-time chat fan-out, the notification UI, an evidence-based dispute system, and the email/consent/rate-limiting layer. Stripe webhooks are the single authoritative writer of subscription state, and provider search uses a stratified aggregation so every subscription tier gets fair visibility.
Architecture
The Next.js platform owns authentication (JWT in an httpOnly session cookie), the booking lifecycle — a ServiceRequest state machine with cron-driven auto-cancel at 48h and auto-confirm at 7 days — Stripe billing, Mapbox-powered geo search, and media on DigitalOcean Spaces. The Express chat server handles Socket.io connections and a smart notification fan-out that only targets engaged users, with a dedup window to prevent spam. The platform calls the chat server over HTTP for cross-service events. A subscription tier is identified by its environment-variable slot, and the Stripe webhook is the only path permitted to mutate subscription state, so billing can never silently diverge.
Outcome
Shipped all six phases as a production-ready platform: a complete booking lifecycle with automated state transitions, a 23-type notification system delivered in real time over Socket.io and 10 socket events, an evidence-based dispute flow with an admin console, and Stripe-backed tiered subscriptions. A full security-and-consistency audit then hardened the system — eliminating a booking race condition, unifying notification creation across services, enforcing a single authoritative writer for billing, and replacing probabilistic search ordering with a fair, tier-stratified ranking — leaving it deployment-ready.
Tech Stack
Have a project like this?
I build multi-tenant SaaS, real-time systems, and mobile apps end-to-end.
Get in touch →