P.01Internal prototype

CarWatch

Mapping of garages and fuel stations, with routing and fuel-cost estimation based on the vehicle's actual characteristics.

Period
March – April 2026
Role
Data schema design, TypeScript API, mapping interface.
Stack
  • TypeScript
  • Express
  • PostgreSQL
  • React
  • Vite
  • Leaflet
  • react-leaflet
  • React Router

Reference points

  • 64

    commits

    project git repository, 3 March to 5 April 2026

  • 6

    fuel types typed in the database

    fuel_type_enum: SP95, SP98, E10, E85, Diesel, LPG

  • 4

    map layers

    stations, garages, route, user vehicle

The problem

A driver looking for fuel does not want the lowest price per litre: they want the lowest total cost, detour included. That requires knowing their consumption, their fuel type and their position, then crossing those three against a road network and prices that change daily.

What was built

  • 01

    A Leaflet map with separate layers for stations, garages, the computed route and the user's vehicle position.

  • 02

    An Express API in strict TypeScript split into routes, services and middlewares, with centralised error handling and a health route.

  • 03

    A PostgreSQL schema describing the user's vehicle: plate, fuel, power, consumption per 100 km, make, model.

  • 04

    A licence-plate lookup that pre-fills those fields.

  • 05

    An account area, a watched-fuel list and a weather card tied to the current position.

Architecture

vehiclel/100 kmPlate enteredAA-123-BBPositionnavigator.geolocationFuel pricesexternal feedExpress APIroutes / servicesTrip costusage × distance × pricePostgreSQLenum + CHECKLeaflet map4 layers
Path of a request, from the entered plate to the rendered map.

Technical decisions

Business rules live in the database, not only in the code

Fuel type is a PostgreSQL enum, the plate is validated by a regular expression at the database level, power and consumption carry CHECK constraints. A badly written API, an import script or a manual insert cannot produce a 4,000 hp vehicle burning 800 litres per 100 km. The database stays consistent even when the code above it is not.

Dated migrations from day one

The initial schema and the migration adding authentication and vehicle fields are two separate files, the second prefixed with its date. Replaying the history on an empty database yields exactly the current state. That is what makes picking the project back up possible without a production dump.

Leaflet rather than a proprietary map

No API key, no per-map-view billing, no dependency on a vendor's pricing policy. The route and marker layers are hand-written, which costs more code up front but makes the rendering fully controllable.

What it demonstrates

Vehicle data modelling, integrity constraints, typed API, map rendering with no proprietary dependency.