2025 – 2026

Gasoline System

Fleet fuel control, as microservices

Route management: origin, destination, distance and status of each trip.

Fleet fuel tracking with gRPC, NATS events and a database per service.

Year
2025 – 2026
Context
University project · Distributed Applications, UTA
Team
4 people
Code
GitHub
independent microservices
5
sync and async
gRPC + NATS
roles with JWT
3

The system

Fuel consumption control for a vehicle fleet, designed as independent microservices (authentication, drivers, vehicles, routes and fuel), each with its own database and container, behind a single API Gateway.

Architecture

Architecture: Gasoline SystemHTTPgRPCWeb clientNext.jsAPI GatewayNestJS · JWTAuthDriversVehiclesRoutesFuelNATSevents
syncasync

Technical decisions

Services use gRPC for immediate replies and NATS to publish events without blocking. This separation means handling partial failures and keeping separate databases consistent.

What it does

  • Five microservices (authentication, drivers, vehicles, routes and fuel) behind an API Gateway in NestJS.
  • gRPC contracts defined with Protocol Buffers for synchronous calls.
  • NATS events to notify the other services without blocking the publisher.
  • Each service in layers: gRPC controllers, application, domain, infrastructure and persistence.
  • Admin, operator and supervisor roles, with JWT.
  • Light and heavy machinery with different rules; refuelling records in MongoDB and the rest in PostgreSQL.
  • A Next.js dashboard that flags anomalous consumption as possible theft.
  • The whole system starts with Docker Compose.

One concrete problem

Each piece of data in the database that fits it

Drivers, vehicles and routes are relational data with referential integrity; refuelling records are numerous, grow constantly and change shape with the type of machinery. So each service has its own database: PostgreSQL for the relational data and MongoDB for fuel. The price is that no query crosses databases: whatever a service needs from another, it asks for over gRPC or receives in a NATS event.

Screenshots

My part

Microservices, gRPC contracts, and publishing and consuming NATS events, in a team of four.

Stack

  • NestJS
  • gRPC
  • Protocol Buffers
  • NATS
  • Prisma
  • PostgreSQL
  • MongoDB
  • Docker Compose
  • JWT
  • Next.js
Next projectAccounting module · Miñarica Water BoardDouble-entry accounting for a community water board