Food Delivery
This project is a comprehensive next-generation food delivery ecosystem. It consists of three independent applications, interconnected through a shared real-time PostgreSQL database, and designed to c...
Project Overview
This project is a comprehensive next-generation food delivery ecosystem. It consists of three independent applications, interconnected through a shared real-time PostgreSQL database, and designed to cover the entire value chain: from the customer to the driver, through the restaurant operator. The 3 Applications 📱 Client Application (React Native - Mobile) The consumer-facing application. It covers the entire purchase journey, from meal discovery to real-time delivery tracking. 🚗 Driver Application "Le Coursier" (React Native - Mobile) The field logistics application dedicated to drivers. It manages ride acceptance, background GPS tracking, and delivery confirmations. 🖥️ Admin Hub "Le Pilotage" (React Native Web - Tablet/Desktop) The control center for operators and restaurant owners. It provides 7 management modules covering restaurants, menus, orders, drivers, pricing, concierge service, and dispute resolution. This Food Delivery ecosystem is not an MVP (Minimum Viable Product). It is a complete, asynchronous, reactive, and secure software foundation covering the entire food delivery value chain. The architecture of three micro-applications connected via PostgreSQL Realtime guarantees: - Horizontal Scalability: Each application can evolve independently. - Transactional Integrity: PostgreSQL ACID compliance for orders and payments. - Real-Time Experience : Near-zero latency between the driver in the field and the client on their phone. - Business Intelligence: Nutritional matching, dynamic pricing, and gamification natively integrated.
Key Capabilities
Dynamic Geolocation-Based Pricing
- Client ↔ restaurant distance is calculated via the Haversine formula(GPS coordinates, Earth radius 6371 km), with zero external API calls. - Delivery price determined by a system of configurable pricing tiers managed by the admin (table `delivery_pricing_tiers`).
- Client ↔ restaurant distance is calculated via the Haversine formula(GPS coordinates, Earth radius 6371 km), with zero external API calls. - Delivery price determined by a system of configurable pricing tiers managed by the admin (table `delivery_pricing_tiers`).
Smart Nutritional Matching Engine
A real-time scoring algorithm that evaluates every dish against the user's health profile: - Caloric calculation : Mifflin-St Jeor formula (BMR adjusted by activity level and goal). - Compatibility score: Out of 100, with penalties proportional to calorie/protein deviation from per-meal target (divided by 3). - Allergen filtering: Dishes containing a declared allergen are automatically excluded (score = 0). - Result: Visual "Match XX%" badge displayed on each dish card.
A real-time scoring algorithm that evaluates every dish against the user's health profile: - Caloric calculation : Mifflin-St Jeor formula (BMR adjusted by activity level and goal). - Compatibility score: Out of 100, with penalties proportional to calorie/protein deviation from per-meal target (divided by 3). - Allergen filtering: Dishes containing a declared allergen are automatically excluded (score = 0). - Result: Visual "Match XX%" badge displayed on each dish card.
Full Real-Time Synchronization
- All order status changes are broadcast instantly via PostgreSQL WebSockets. - Driver GPS position is updated live (`driver_locations` table, `upsert` on `driver_id` conflict). - The client receives position updates without any action on their part (push via Realtime channel).
- All order status changes are broadcast instantly via PostgreSQL WebSockets. - Driver GPS position is updated live (`driver_locations` table, `upsert` on `driver_id` conflict). - The client receives position updates without any action on their part (push via Realtime channel).
Distributed State Management (Group Orders)
- Unique session code generation (6 alphanumeric characters). - Native sharing (Share API) to WhatsApp, SMS, etc. - Each participant joins via the code and populates a synchronized common cart
- Unique session code generation (6 alphanumeric characters). - Native sharing (Share API) to WhatsApp, SMS, etc. - Each participant joins via the code and populates a synchronized common cart
Gamification & Loyalty Program
- Transactional points system ("Écrin Coins") calculated from delivered orders. - Behavioral bonus: +10 points for eco-responsible orders (no cutlery). - 4 status tiers with progressive reward unlocking.
- Transactional points system ("Écrin Coins") calculated from delivered orders. - Behavioral bonus: +10 points for eco-responsible orders (no cutlery). - 4 status tiers with progressive reward unlocking.
Technology Deep-Dive
Monorepo Architecture & Frontend
- Monorepo: All 3 applications coexist in a single repository (`apps/ecrin`, `apps/course`, `apps/pilotage`), enabling shared configuration and ecosystem consistency. - Expo Router: File-based routing ensuring predictable native navigation and native Deep Linking. - React Native: Native compilation for iOS and Android, delivering performance identical to native apps (direct access to hardware APIs: GPS, Haptics, Camera). - Zustand : Reactive global store, zero boilerplate. Used for the cart (`cartStore`) with local persistence. - Skeleton Loaders: `Animated.timing` animation (opacity 0.3 → 1.0 loop) for a visually premium loading experience.
- Monorepo: All 3 applications coexist in a single repository (`apps/ecrin`, `apps/course`, `apps/pilotage`), enabling shared configuration and ecosystem consistency. - Expo Router: File-based routing ensuring predictable native navigation and native Deep Linking. - React Native: Native compilation for iOS and Android, delivering performance identical to native apps (direct access to hardware APIs: GPS, Haptics, Camera). - Zustand : Reactive global store, zero boilerplate. Used for the cart (`cartStore`) with local persistence. - Skeleton Loaders: `Animated.timing` animation (opacity 0.3 → 1.0 loop) for a visually premium loading experience.
Backend & Database: PostgreSQL
The infrastructure is powered by PostgreSQL, providing guarantees of performance, transactional integrity, and scalability. - Realtime WebSockets (Postgres Changes): Native WebSocket multiplexing. Mutations on tables (`orders`, `driver_locations`) trigger instant notifications to subscribed clients. Zero HTTP polling. - Row Level Security (RLS): Row-level security policies. Strict multi-tenant isolation: a client only sees their orders, a driver only their deliveries, a restaurant owner only their establishment. - PostgreSQL RPC Functions & Triggers: Business logic executed as close to the data as possible via stored procedures, reducing network latency and client-side compute cost. - Object Storage: Dish and restaurant images hosted in a cloud storage bucket with public URLs.
The infrastructure is powered by PostgreSQL, providing guarantees of performance, transactional integrity, and scalability. - Realtime WebSockets (Postgres Changes): Native WebSocket multiplexing. Mutations on tables (`orders`, `driver_locations`) trigger instant notifications to subscribed clients. Zero HTTP polling. - Row Level Security (RLS): Row-level security policies. Strict multi-tenant isolation: a client only sees their orders, a driver only their deliveries, a restaurant owner only their establishment. - PostgreSQL RPC Functions & Triggers: Business logic executed as close to the data as possible via stored procedures, reducing network latency and client-side compute cost. - Object Storage: Dish and restaurant images hosted in a cloud storage bucket with public URLs.
Security & Identity Management
- JWT (JSON Web Tokens): Cryptographic authentication with automatic renewal and encrypted local persistence via `AsyncStorage`. - RBAC (Role-Based Access Control): 3 strict roles (`client`, `driver`, `admin`) verified at both the UI level and the database rule level. - Role verification at login: The Driver app automatically rejects any non-driver user. The Admin app verifies `admin` or `restaurant` roles.
- JWT (JSON Web Tokens): Cryptographic authentication with automatic renewal and encrypted local persistence via `AsyncStorage`. - RBAC (Role-Based Access Control): 3 strict roles (`client`, `driver`, `admin`) verified at both the UI level and the database rule level. - Role verification at login: The Driver app automatically rejects any non-driver user. The Admin app verifies `admin` or `restaurant` roles.
Geolocation
- Client: Haversine formula (pure mathematical calculation, zero API cost) for distance calculation. - Driver: `expo-location` with `watchPositionAsync` (high accuracy, 5s interval, 10m distance). - Client Tracking: `react-native-maps` with dynamic markers and polylines updated in real-time.
- Client: Haversine formula (pure mathematical calculation, zero API cost) for distance calculation. - Driver: `expo-location` with `watchPositionAsync` (high accuracy, 5s interval, 10m distance). - Client Tracking: `react-native-maps` with dynamic markers and polylines updated in real-time.
Interested in this project?
Let's discuss how we can build something extraordinary together.