thiago-menezes/ career.fig
PTArticlesRésumé
Case 04 · LF Transporte

A fleet system that runs on five platforms

Since August 2026 I've been designing and building the system LF Serviços e Transporte uses to run its trucks. It covers maintenance, parts, fuel and alerts, from the moment a truck comes in to the printed work order.

Role
Design and code, on my own. 111 of the 145 commits are mine and the rest come from release bots
Period
Aug 2026 to now · 32 releases
In use
39 trucks, 230 fuel logs so far
Platforms
Web, Windows and macOS (Tauri 2), Android and iOS (Capacitor 8)
Stack
React 19, TypeScript, Vite, Supabase, Playwright, Vitest

ProblemWhat LF needed

LF maintains its own trucks. A truck comes in with a problem and someone writes down the symptoms, then parts come out of a stock that was bought in batches at different prices, and preventive work comes due by kilometer or by date. The office needs to know what each truck costs, and the people in the shop need all of this to work on a phone.

Fleet list: trucks with model, plate, year, mileage, tag and status
This is the staging build running on demo data. I left the money figures out of this page.

My roleWhat I did

  • I designed the interface and wrote the code, with React on the front end and Supabase for auth, Postgres, storage and six edge functions.
  • The database has 19 tables built from 34 append-only migrations, and CI applies them on every push to main.
  • There are 34 Playwright specs and 29 Vitest files, including integration tests against the database layer.
  • semantic-release cuts each release, and GitHub Actions builds the installers for every platform.

DecisionOne codebase for every platform

The office works on a desktop and the shop works on a phone. So instead of three apps, I have one React codebase that goes to the web, to Windows and macOS through Tauri, and to Android and iOS through Capacitor. On a small screen the tables turn into cards.

Dashboard on a phone: total fleet, trucks in maintenance and active work orders

DecisionKeeping the demo away from real data

Every new version goes to a public staging site first, and that's where I test it. Staging always runs on a mock database in the browser, seeded with dozens of trucks, parts and work orders, and every screen shows a test badge. I think the other direction matters even more. If a production build has no credentials, it stops on an error screen, because otherwise it would quietly save the fleet's data in one browser.

// Simplified from the project. Comments translated.
// The public demo always runs on a local mock database,
// even if the build carries real Supabase credentials.
export const isTestEnvironment =
  import.meta.env.VITE_APP_ENV === 'staging' ||
  window.location.hostname === 'staging.lftransporte.net';

export const isSupabaseConfigured =
  !isTestEnvironment && !!(supabaseUrl && supabaseAnonKey);

// A production build without credentials must block,
// never fall back to the mock: that would keep real fleet
// data in one browser, with no sync and no backup.
export const isMisconfiguredProduction =
  import.meta.env.PROD && !isTestEnvironment && !isSupabaseConfigured;
Comment from Thiago
Thiago · why
Falling back to the mock is handy in development, but in production it would lose a fleet's history and nobody would notice.

DecisionParts leave stock oldest batch first

LF buys the same part many times, at different prices. A work order uses the oldest batches first, so the cost of a repair is what those parts actually cost, and if a batch had a discount, that discount goes into the order too. When there isn't enough stock for an order, the order opens a pending purchase and keeps going.

Stock control: alert for parts at zero and low stock, list with code, description, brands and quantity
// Simplified from the project.
export const consumeFIFO = (batches: StockBatch[], partId: string, qty: number) => {
  const open = batches
    .filter((b) => b.part_id === partId && b.quantity_available > 0)
    .sort(oldestFirst);

  const available = open.reduce((sum, b) => sum + b.quantity_available, 0);
  if (available < qty) throw new Error(`Not enough stock: ${available} of ${qty}`);

  let left = qty;
  return open.flatMap((batch) => {
    if (left <= 0) return [];
    const take = Math.min(left, batch.quantity_available);
    left -= take;
    // The work order is charged what this batch really cost.
    return [{ batch: batch.id, quantity: take, unit_price: batch.unit_price }];
  });
};

DecisionSetting up axles and tires on a diagram

Tires are tracked by position, and axles vary from truck to truck, with steering, drive, tandem and dual wheels. So the truck page draws the chassis. You drag axle types into the diagram and set each tire by clicking its wheel, and on duals you set the inner and the outer one. Wheels that still don't have a tire show in orange, and kilometers add up per axle until the tire-life alert goes off.

Axle editor: palette of axle types, chassis diagram with three axles and the list of registered axlesTire control: chassis diagram with wheels pending configuration in orange

DetailsSmaller things I took care of

  • A truck can't go into the shop until someone records the symptoms, and the work order prints as a sheet for the mechanic.
  • Each truck has preventive rules by kilometer or by date, counted from the last time that service was done.
  • There's a daily backup to Google Drive, and a restore script that loads it into any Postgres in one transaction and checks the row counts.
  • I write the release notes by hand for the people who use the system. The changelog stays in the repo, because "currency masking for fuel logs" means nothing to someone who runs trucks.
  • Search matches the start of each word, so typing "fil ol" finds "Filtro de Óleo".
Work orders: list with truck, plate, reported problem, opening date and status

NumbersWhere it is after nine weeks

32releases since Aug 13, 2026
19tables, 34 migrations
63test files, E2E and unit

Shortcuts

Tab, arrows
Move between frames
Enter
Open a case
Esc
Back to the canvas
L
List view
D
Dev Mode
C
Show or hide comments
R
Résumé
+ / −
Zoom
Shift 1 / 2
Fit all / fit selection