Skip to content
Mehdi Messaoudene
B2B SaaS · own product2025 - todayin production

FleetOra

The management software for car rental agencies in Algeria. Puts the notebook away.

Where it started

Algerian rental agencies with 10 to 40 vehicles run their business on a notebook and a spreadsheet. Nobody knows, at any given moment, which car is free next week, which contract is overdue, or which vehicle is losing money. Double booking is the norm, not the accident.

What was built

A complete SaaS that replaces the notebook: fleet, customers, contracts, bookings, maintenance, traffic fines and accounts. It works offline - essential when the connection drops - and syncs without ever losing a version.

Results

9
business modules
1,177
addressable agencies
4
subscription tiers
100%
offline capable

Interactive demo

Two bookings cannot overlap

Move the new request along the month and watch when the vehicle is already taken.

Confirmed booking
Cancelled booking
Active contract
New request
Slot availabledays 12 to 15

Two details the rule enforces that you cannot guess: bounds are inclusive, so taking the vehicle out on the very day it comes back counts as a conflict. And the cancelled booking, dashed, is ignored: only statuses that really tie up the vehicle block.

Mechanism rebuilt for this site, not a screenshot of the product. Rule taken from packages/shared/src/index.ts, hasVehicleOverlap(). Sample data: no real customer or vehicle.

From the interface down to the data

  1. 01

    Interface

    9 business views, responsive without platform detection - a single code base, one breakpoint at 820 px. Marketing site and application in the same bundle.

  2. 02

    Pure business logic

    packages/shared - contract calculations, overlap detection, validation, permission matrix. No UI or network dependency: testable without a browser.

  3. 03

    Sync policy

    sync-policy.ts - a pure function that takes a snapshot and returns a decision: push, apply, or do nothing. With systematic archiving.

  4. 04

    Persistence

    Supabase as the source of truth, localStorage as the offline cache. Per-agency isolation, enforced with RLS in the database and RPC for privileged actions.

Engineering decisions

The choices worth defending, and why.

  • 01

    Sync is a pure function, not an effect

    The classic local-first trap: an empty state overwriting a full account, or a local edit lost by a cloud reload. I moved the decision out of React effects into an isolated module that takes a snapshot as input and returns an explicit decision - push, apply, do nothing - with a reason and an archiving order. The rule is "most recent wins, with systematic archiving of the replaced version": no version is ever destroyed without a copy. A failed read is explicitly not treated as an empty account, which prevents wiping an account over a simple network drop. In practice, every conflict case can be tested from the command line, without a browser.

    • apps/web/src/sync-policy.ts
    • apps/web/src/backup.ts
  • 02

    The unit of isolation is the agency, not the user

    The first version isolated data per account. But an agency is an owner and two employees who must see the same fleet. So I moved the tenancy key to the agency owner - a secondary user reads and writes the owner's row - and stacked three layers: a full remount of the root component on account change to guarantee zero leftover state, the agency key for storage and sync, and RLS policies in PostgreSQL. The permissions themselves are pure functions in the shared package, not conditions scattered across components: the permission matrix is tested like any calculation.

    • apps/web/src/main.tsx
    • packages/shared/src/index.ts
  • 03

    A schedule with two triggers: time or usage

    An oil change is not due "in six months": it is due in six months OR in 5,000 km, whichever comes first. The calculator evaluates both branches independently and keeps the most urgent. A detail that matters: when the reference data is missing, the status is forced to "soon" rather than "up to date" - better a false alert than a missed deadline. The model transposes as is to any asset maintenance: flight hours, cycles, tonnage.

    • apps/web/src/main.tsx
  • 04

    A service key that never touches the browser

    The conversion funnel table is locked by RLS - an anonymous client cannot write to it, on purpose. Collection therefore goes through a serverless function that alone holds the service key. That is exactly what a serverless function is for in a SPA: carrying the secret the bundle must not see.

    • api/track.mjs
    • supabase/funnel-analytics.sql
  • 05

    A test seam that disappears in production

    End-to-end testing an application behind a login needs either a test backend or a back door. I took the back door, but gated both on development mode and on a local flag - Vite removes it from the production bundle at compile time. The Playwright suite covers the full customer → vehicle → contract path, booking confirmation, every view, and rendering at several screen widths.

    • apps/web/src/AuthContext.tsx
    • e2e/flows.spec.ts

Tech stack

  • React 19
  • Vite 6
  • TypeScript
  • Supabase
  • PostgreSQL + RLS
  • PWA
  • Playwright
  • Vercel
See the service

A similar project?

Other projects