SYSTEMS & DATA2026-10 · TECHNICAL CASE

Delivery Ya Voy — Multi-PWA On-Demand Delivery Platform

On-demand food delivery and parcel logistics startup built from scratch. Multi-PWA architecture with dynamic subdomain isolation, Clean Architecture designed for seamless migration to a custom backend, offline-first fault tolerance with IndexedDB, 344 automated Vitest tests, and $0.00 infrastructure cost.

React 19TypeScriptVite 8SupabaseLeafletTailwind CSS v4Konsta UIIndexedDBVitest

Engineering Stack & Zero-Cost Architecture Decisions

Arquitectura de Software
React
React 19 & Vite 8v19.2 / v8.3

Single multi-tenant SPA with optimized client rendering, subdomain isolation, and per-role route prefetching.

Supabase
Supabase (PostgreSQL)BaaS Free Tier

Relational persistence, Row-Level Security (RLS), atomic triggers, and Realtime WebSockets for tracking.

Leaflet
Leaflet & OpenStreetMapv1.9.4 / OSM

Zero-cost interactive mapping engine, completely eliminating recurring Google Maps API billing.

Tailwind CSS
Tailwind CSS & Konsta UIv4.3 / v5.5

Mobile touch ergonomic components (iOS/Material) with high-contrast color tokens.

#
IndexedDB & WorkboxADR-013 Storage

Offline-first transactional outbox queue for event capture during 4G dead zones with FIFO sync.

React
Vitestv5.0.5

Automated test suite of 344 unit and integration tests verifying pricing algorithms, wallets, and business rules.

Netlify
NetlifyEdge Free Tier

Edge hosting with wildcard subdomain support (*.demo-yavoy.hxzzu.dev) for a single compiled application.

WhatsApp
Telegram Bot APIWebhook Engine

Zero-cost instant dispatch broadcast channel to driver Supergroups without SMS or WhatsApp API fees.


Executive Summary: Problem, Solution & Results

Dimension Project Details
Role Performed Co-Founder & Lead Software Engineer (Software architecture, functional analysis, and 100% end-to-end full-stack development alongside a business partner).
Business Problem High marketplace commissions (20% to 30%), kitchen-to-courier thermal mismatch, cash order losses, and the operational/financial impossibility of maintaining three separate native mobile development teams in an early-stage startup.
Engineering Solution Multi-PWA architecture on a single SPA with dynamic subdomain routing, decoupled Clean Architecture to prepare for future migration to a custom backend, offline-first resilience with IndexedDB, and transactional PostgreSQL RPCs.
Measurable Impact Zero fixed server costs ($0.00/month) during validation, 344 automated tests passing at 100%, 3 independent native PWAs installable on Android without WebAPK collision, and atomic trip claiming with zero race conditions.

1. Startup Context: Engineering Velocity Without Sacrificing Scalability

When building Delivery Ya Voy, the real-time operational requirements were demanding: an on-demand delivery ecosystem must coordinate four distinct actors seamlessly:

  1. The Customer: Expects instant catalog browsing without the friction of mandatory app store downloads, alongside live map tracking.
  2. The Kitchen (Merchant): Requires a high-visibility tactile Kitchen Display System (KDS) with continuous acoustic alerts and real-time stock kill-switches.
  3. The Courier (Rider): Operates on motorcycles facing sunlight glare, vibrations, rain, and abrupt 4G connectivity drops.
  4. Control Tower (Admin): Monitors order throughput, audits prepaid commission wallets, and manages urban geofencing polygons.

The Strategic Decision: Why PWA + React 19 + Supabase?

In an early-stage startup with a solo technical engineer, attempting to build separate native mobile codebases (iOS in Swift, Android in Kotlin or Flutter) for customers, merchants, and riders would have been a catastrophic mistake: it would have tripled development time, multiplied maintenance overhead, and delayed market entry with app store review queues.

The engineering decision was to build a unified Multi-PWA system powered by React 19, TypeScript, Vite, and Konsta UI, backed by Supabase BaaS. This strategy unlocked:

  • Immediate Time-to-Market: A single developer architected and shipped all 4 operational consoles in a fraction of traditional timelines.
  • $0.00/Month Infrastructure Cost: Leveraging reliable serverless free tiers (Netlify Edge, Leaflet/OpenStreetMap, and Supabase), eliminating cloud and map API bills from day one.
  • Store-Free Distribution: Instant app installation via QR or browser prompt without the 30% take-rate of Apple App Store or Google Play.

Architectural Foresight: Ready for a Custom Dedicated Backend

To prevent vendor lock-in with the BaaS provider, the codebase was structured under strict Clean Architecture principles:

  • Domain Layer & Pure Use Cases (/src/use-cases): All business and financial algorithms (dynamic tariffs, Adaptive Trust fraud scoring, legal courier checks, and shift cash balances) are written in pure TypeScript with zero dependencies on frameworks or UI libraries.
  • Infrastructure & Repository Layer (/src/infrastructure/repositories): Database interactions are fully abstracted behind repository contracts and interfaces.

[!TIP] Future Migration Roadmap: When transaction volume warrants dedicated infrastructure, the team can migrate data persistence to a custom backend in Node.js, Go, or Python over PostgreSQL by simply replacing the repository layer—without touching a single line of domain business logic or frontend user interfaces.


2. Engineering Challenge: Multi-PWA in a Single SPA & The WebAPK Conflict

One of the most complex technical challenges when bundling multiple applications into a single codebase emerged on physical Android devices:

[DNS Request: *.demo-yavoy.hxzzu.dev]
               │
               ▼
[Netlify: Single Vite SPA]
   ├─► cliente.demo-yavoy.hxzzu.dev (Customer PWA)
   ├─► comercio.demo-yavoy.hxzzu.dev (Kitchen KDS PWA)
   ├─► rider.demo-yavoy.hxzzu.dev   (Courier PWA)
   └─► admin.demo-yavoy.hxzzu.dev   (Control Tower)
               │
               ▼
[Supabase: PostgreSQL + RLS]
(Unified Auth + Realtime WebSockets)
   ┌───────────┴───────────┐
   ▼                       ▼
[Leaflet + OSM]     [Telegram Bot API]
(Zero-cost Maps)    (Courier Broadcasts)

Scope Collision & Google’s WebAPK Minting Service

The common approach of using path subroutes (/cliente, /comercio, /rider) failed on standard Android devices (Samsung Galaxy, Motorola, Google Pixel):

  • Chrome contacts Google’s cloud service (WebAPK Minting Service) to generate and install a system .apk package (org.chromium.webapk.*).
  • If the first installed app held "scope": "/", it claimed the entire domain origin. Navigating to /rider led Android to determine the path was already owned by the Customer app, blocking the creation of the courier APK and showing only “Open in app”.

The Solution: Runtime Subdomain Isolation

I solved this conflict without splitting the repository:

  1. Subdomain Partitioning: Assigning unique W3C origins (cliente.*, comercio.*, rider.*, admin.*).
  2. Runtime Tenant Detection: The getTenantFromHostname helper inspects window.location.hostname at boot and dynamically binds the appropriate manifest (manifest-rider.webmanifest, manifest-cliente.webmanifest, etc.).
  3. Outcome: Each PWA maintains its own independent scope: "/". Android compiles three separate WebAPKs with individual icons, permissions, and service worker caches—all served from a single Vite build on Netlify.

3. Street Resilience: Offline-First Architecture with IndexedDB (ADR-013)

In high-density urban areas and hilly topographies, couriers frequently lose 4G connectivity right upon reaching delivery destinations.

To ensure uninterrupted operations, I engineered the offlineQueueService:

  • Transactional Outbox Queue: When a rider transitions trip states (AT_STORE, IN_TRANSIT, DELIVERED) without signal, the mutation is safely written to an IndexedDB transactional object store.
  • Asynchronous FIFO Processing: The service listens to the window.ononline event and flushes the outbox in strict chronological order.
  • Backpressure Resilience: Automatic retry scheduling with Exponential Backoff and Jitter prevents server thundering herd problems when multiple couriers re-establish signal simultaneously.

4. Atomic Concurrency, Native Hardware & Adaptive Trust

Atomic Trip Claiming (Zero Race Conditions)

In high-velocity dispatch, two couriers tapping “Accept Order” within the same millisecond must never result in duplicate assignment. I authored the PostgreSQL function rpc_aceptar_pedido:

  • Applies pessimistic row-level locking (SELECT ... FOR UPDATE).
  • Atomically validates that the order remains in BROADCASTED status, the courier is not blacklisted by the merchant, and has sufficient prepaid wallet balance.
  • Transitions the trip to ASSIGNED and deducts the fee in a single atomic transaction, returning a controlled rejection to any concurrent attempt.

Tapping into Native Mobile Hardware

Without the overhead of hybrid wrappers, the web platform accesses modern browser APIs directly:

  • Screen Wake Lock API: Prevents the courier’s screen from dimming during active trips, eliminating hazardous phone tapping while riding a motorcycle.
  • Synthesized Web Audio API: The kitchen KDS synthesizes harmonic sine waves for acoustic incoming-order alerts, ensuring clear audibility in noisy kitchens without downloading audio assets.
  • Adaptive Trust (Dynamic Delivery Friction): The evaluarAdaptiveTrust algorithm calculates whether an order requires a 2-digit PIN code, building reception photo proof (Point & Shoot), or instant 1-tap completion based on customer reputation and cash amount.

5. Engineering Rigor: 344 Automated Tests with Zero Regressions

To support an ambitious startup product built by an agile team, test automation was non-negotiable:

  • 344 unit and integration tests executed with Vitest in under 1.5 seconds.
  • Comprehensive coverage across core domain use cases:
    • Operating cash settlement and daily financial balances (calcularCierreCajaOperativa).
    • Incline payload limits and narcotics legal parcel verification under local laws (validarEncomiendaLey1008).
    • Dynamic fare breakdowns (rain surge, heavy weight, night mode).
    • Offline mutation queueing and idempotent synchronization.

6. Key Learnings

  1. Resource constraints cultivate superior architecture: The lack of a native app team was not a limitation, but the catalyst to design a lightweight, modern, zero-cost web architecture that covers 100% of operations without app store friction.
  2. Clean Architecture guarantees evolution: Decoupling business logic from database storage allows an early-stage startup to iterate rapidly with BaaS tools (Supabase) while maintaining a clean, painless path to migrate to dedicated microservices as the platform expands.
  3. Automated testing empowers solo builders: Having 344 continuous tests provides the confidence to refactor code, optimize complex business rules, and deploy to production daily with zero fear of breaking core flows.