# πŸš— RentalDriveGoβ€” Multi-Tenant Car Rental SaaS + Storefront ## Platform Model **Rental Companies (B2B)** β€” pay RentalDriveGoa subscription (AmanPay or PayPal), get: - A fully private dashboard (zero data overlap with any other company) - Fleet management with vehicle photo upload (photos auto-appear on global storefront) - Promotional offers management - A white-label site at `company.RentalDriveGo.com` where renters book and pay **Renters (B2C)** β€” free account, can: - Browse ALL companies' vehicles and offers on `RentalDriveGo.com/explore` - Click a vehicle β†’ **redirected to the company's site** to book and pay - Receive full notifications (Email + SMS + WhatsApp + Push + In-App) - Track all bookings across companies in one account --- ## ⚠️ Payment Providers β€” Stripe Has Been Removed | Provider | Purpose | |----------|---------| | **AmanPay** (amanpay.net) | Primary. National/international cards, cash (3000+ points), e-wallet. Moroccan PCI-DSS Level-1 PSP. | | **PayPal** | Secondary. Global coverage. | **Two payment contexts:** 1. Company pays RentalDriveGosubscription β†’ RentalDriveGo's own AmanPay/PayPal account 2. Renter pays company for rental β†’ Company's own AmanPay merchant + PayPal account (direct, no intermediary) --- ## 🌐 Storefront is Discovery Only β€” No Booking on RentalDriveGo.com/explore The global storefront shows all vehicles with photos from all companies. When a renter clicks "Book this vehicle", they are **redirected to the company's branded site** (`{slug}.RentalDriveGo.com/book?vehicleId=X&from=Y&to=Z&ref=storefront`). The booking form is pre-filled. All payment happens on the company site using the company's own payment accounts. --- ## πŸ“Έ Vehicle Photos β†’ Storefront Visibility ``` Company uploads photos in /dashboard/fleet β†’ Stored in Cloudinary β†’ Vehicle.photos[] holds the URLs β†’ First photo = cover image on storefront cards β†’ All photos shown in storefront vehicle gallery β†’ isPublished=true makes vehicle appear on storefront ``` --- ## πŸ— Five-Layer Architecture ``` Layer 1A: RentalDriveGo.com β€” B2B marketing site Layer 1B: RentalDriveGo.com/explore β€” B2C storefront (discovery + redirect only) Layer 2: app.RentalDriveGo.com β€” Company dashboard (private, subscription-gated) Layer 3: {slug}.RentalDriveGo.com β€” Company branded site (booking + payment here) Layer 4: api.RentalDriveGo.com β€” REST API ``` --- ## πŸ“ Project Structure ``` rental-car-site/ β”œβ”€β”€ README.md β”œβ”€β”€ docs/ β”‚ β”œβ”€β”€ ARCHITECTURE.md ← Payment providers, storefront redirect model, photo flow β”‚ β”œβ”€β”€ DESIGN_SYSTEM.md β”‚ β”œβ”€β”€ PAGES.md ← All pages. Storefront = discovery only. Booking = company site. β”‚ β”œβ”€β”€ FEATURES.md β”‚ └── DEPLOYMENT.md └── skills/ β”œβ”€β”€ rental-car-website/ β”œβ”€β”€ rental-car-components/ β”œβ”€β”€ rental-car-backend/ β”‚ └── references/ β”‚ β”œβ”€β”€ schema.md ← AmanPay/PayPal fields, no Stripe β”‚ β”œβ”€β”€ api-routes.md ← All routes β”‚ β”œβ”€β”€ payment-service.md ← AmanPay + PayPal implementation ← KEY FILE β”‚ β”œβ”€β”€ subscription-service.md ← Manual renewal, plan prices in MAD/USD/EUR β”‚ β”œβ”€β”€ subdomain-service.md ← Storefront redirect + company site β”‚ └── notification-service.md ← All 5 channels └── rental-car-i18n/ ``` --- ## πŸ›  Tech Stack | Concern | Technology | |---------|-----------| | Subscription payment | AmanPay (primary) + PayPal (secondary) | | Rental payment | Company's own AmanPay merchant + PayPal | | PDF generation | `@react-pdf/renderer` β€” server-side, on-demand, never stored | | Damage diagrams | SVG top-down car map (22 zones, React interactive + PDF static render) | | Insurance | Per-company configurable policies with per-day/flat/% charge types | | Pricing rules | Age/experience-based surcharges & discounts (configurable per company) | | Email | Resend | | SMS + WhatsApp | Twilio | | Push | Firebase FCM | | Real-time in-app | Socket.io + Redis | | Images | Cloudinary | | Company auth | Clerk | | Renter auth | JWT (custom) | | API | Node.js + Express + Prisma + PostgreSQL | | Frontend | Next.js 14 + React 18 + Vite | | Deployment | Vercel + Railway |