Compañeros en Ruta
A production-grade, multi-tenant SaaS for logistics and brand distribution — a Next.js web app plus native iOS/Android apps — sharing a QR-driven loyalty engine and a strict PostgreSQL + RLS security core.

Gallery
Project Overview
Compañeros en Ruta is a comprehensive, multi-tenant SaaS platform for high-scale logistics and brand distribution. It is built on a schema-truth philosophy, where the PostgreSQL database structure dictates the application’s capabilities and security boundaries. The platform serves six distinct roles — Admin, Brand Manager, Supervisor, Promotor, Asesor de Ventas, and Client — each with its own guarded experience. It ships as a Turborepo monorepo: a Next.js web app plus native iOS and Android apps, all sharing typed logic and a single Supabase backend.
Technical Excellence
Multi-Tenancy & Security
The core of the application is its Row Level Security (RLS) implementation in Supabase. Every table is governed by policies that guarantee absolute data isolation between tenants (brands, distributors, and zones). The policy layer was consolidated for performance to ~135 policies powering 88 API routes, with role guards enforced across all six dashboard layouts.
Modern Stack
The platform runs on Next.js 16 (App Router, Turbopack) and React 19, styled with Tailwind CSS 4 and shadcn/ui under a bespoke design system. Forms are validated end-to-end with react-hook-form + Zod, and dashboards visualize metrics with Recharts.
Database-Driven Design
The project maintains a 1:1 mapping between the PostgreSQL schema and TypeScript types for full type safety. Complex operational flows — from 7Ps visit assessments to QR redemption and distributor billing — are handled with transactional integrity and versioned migrations.
Cross-Platform Delivery
Beyond the web app, the platform includes two native mobile apps built with Expo & React Native (SDK 54) — one for field staff and one for clients — sharing code through the monorepo. The staff app leverages the device camera for QR scanning, geolocation for GPS-tagged evidence, and push notifications. Builds are shipped to iOS and Android through EAS Build, and are actively tested on real devices.
Tested & Verified
Reliability is backed by a full testing stack: Playwright for end-to-end flows, Vitest / Jest + Testing Library for units, and MSW for API mocking.
Key Functionalities
- Role-Based Dashboards: Six guarded experiences (Admin, Brand, Supervisor, Promotor, Sales Advisor, Client), each with tailored workflows and real-time KPIs.
- QR Loyalty & Redemption: Client-side QR generation and a full-screen scanner drive a points, tiers, and memberships loyalty engine, with redemption tracking for distributor-to-brand billing.
- Promotions & Surveys: Brand-authored promotions and surveys with a 48h admin approval workflow, coupon banners, and dynamic segmentation.
- Audience Targeting: JSONB
targeting_criteriapowers server-side audience filtering and reach estimation across promotions, surveys, and communication plans. - Field Operations: A 3-stage visit assessment wizard with GPS-tagged photo evidence, auto-save, and mobile-first screens for promoters in the field.
- Real-Time Notifications: In-app notification bell with toast and sound alerts, wired into operational events via Supabase realtime.
- Data Exports: Segmented dataset exports bundled as ZIP archives for reporting and analysis.
Project Details
Objective
Deliver a scalable, cross-platform SaaS for distribution networks — web and native mobile — with strict multi-tenant isolation, field operations tooling, and real-time operational metrics across six distinct user roles.
Theme
Enterprise Modern SaaS
Date
July 6, 2026