Leaf ComputeBook a call (opens in a new tab)

ROUTD · Platform rebuild · Logistics

A last-mile delivery platform rebuilt in 6 months, replacing 1.5 years of code.

How we rebuilt a multi-tenant SaaS logistics platform for last-mile delivery: a team of 8 replaced 1.5 years of custom code in 6 months, and the platform now handles 30,000+ orders a month on a cloud bill under $700. A full platform rebuild with dedicated engineering, cloud architecture, and real-time tracking across mobile and web.

Client
ROUTD, UK
Industry
Logistics and last-mile delivery
Our role
Led a team of 8 through the rebuild
Stack
.NET, React, React Native, Azure

30k+

orders a month · cloud bill under $700

to rebuild 1.5 years of custom code
6 monthsto rebuild 1.5 years of custom code
engineers in the team we led
8engineers in the team we led
orders delivered a month
30,000+orders delivered a month
cloud bill while handling them
< $700cloud bill while handling them

The Problem

ROUTD had a real business: around $5M worth of orders a year, and customers like Compass Group and Ole & Steen depending on them for last-mile delivery across the UK. But after 1.5 years of iterative development, the codebase was a liability.

The system worked, but only just: real-time tracking was flaky, route optimization was slow, multi-tenancy had been bolted on and cloud costs were climbing. The team knew they needed a full rebuild, but they couldn’t afford to stop shipping.

They needed a team that would rebuild the platform without losing velocity and own the code it wrote.

The Architecture

We led a team of 8 and rebuilt the platform in 6 months: a ground-up redesign of 1.5 years of custom development.

ROUTD Platform Architecture Driver Mobile React Native Admin Dashboard React + TypeScript API Gateway .NET Web API • Global tenant filter • Auth + rate limiting Event Bus Azure Service Bus Core Microservices Order Management Route Optimization Tracking Service

Stack Choices

Backend: .NET Web API + Azure Functions

We chose .NET because the team already had C# experience, and we needed something that could handle synchronous request/response at scale. The Web API layer handles all CRUD operations, auth, and tenant isolation.

Azure Functions handle the expensive operations: route optimization, ETA calculation with third-party APIs, and notification delivery. These workloads are bursty, and a route optimizer has no reason to run 24/7, so serverless was the better fit.

Frontend: React Dashboard + React Native Mobile

The admin dashboard is React with TypeScript. Real-time driver tracking uses WebSockets for live position updates. The mobile app is React Native, a single codebase for iOS and Android. That mattered because the team was small and couldn’t afford separate native engineers.

Database: Azure SQL with Multi-Tenancy

We implemented multi-tenancy at the database level with global query filters. Every table has a TenantId column. Every query automatically includes WHERE TenantId = @CurrentTenant via EF Core’s global filters. This prevents data leakage between customers without maintaining separate databases.

Row-level security in SQL Server adds a second layer of defense. Even if the application layer fails, the database won’t return cross-tenant data.

Timeline

The rebuild reached its MVP in 6 months, inside an engagement that ran for more than a year. We led a team of 8 through it, replacing 1.5 years of custom development with a platform designed for the scale ROUTD was heading towards.

Key Engineering Decisions

1. Multi-Tenant Data Isolation

Multi-Tenant Data Isolation Strategy Application Layer: Global Query Filters • EF Core global filter on every DbSet • TenantId injected from JWT claims • Applied automatically to all queries • Can't be accidentally bypassed Database Layer: Row-Level Security • SQL Server RLS policies on all tables • Security function checks SESSION_CONTEXT • Database-level enforcement • Protects against SQL injection var orders = await _context.Orders.Where(o => o.Status == "Pending").ToListAsync(); ↓ Automatically secured ↓

A multi-tenant platform has to choose between a separate database per customer and a shared database with tenant isolation.

Separate databases are safer but expensive to operate. A shared database is efficient, but one bad query can leak data across customers.

We chose shared database with two layers of isolation: application-level global filters and database-level row-level security.

In EF Core, we applied a global filter to every entity:

modelBuilder.Entity<Order>().HasQueryFilter(o => o.TenantId == _currentTenant.Id);

Every query then includes the tenant filter automatically, so developers can’t forget to add it or bypass it by accident.

At the database level, we added SQL Server row-level security policies:

CREATE SECURITY POLICY TenantSecurityPolicy
ADD FILTER PREDICATE dbo.fn_TenantAccessPredicate(TenantId) ON dbo.Orders
WITH (STATE = ON);

Even if someone writes raw SQL, the database won’t return cross-tenant data.

That gave ROUTD the simpler operations of a shared database, with tenant isolation enforced in two places.

2. Cloud Cost Optimization

The rebuilt platform runs on a cloud bill under $700 while handling 30,000+ orders a month.

Serverless for bursty work. Route optimization only runs when a new delivery batch comes in, maybe 50 times a day, which suits Azure Functions well. We pay for execution time and have no idle servers to pay for.

Right-sized databases. We moved from a General Purpose tier to a Basic tier for non-production environments. Production stayed on Standard tier but with auto-pause enabled during low-traffic hours.

CDN for static assets. Images, maps and driver profile photos are served from Azure CDN with aggressive caching.

Third-party API batching. Instead of calling the ETA API for every address update, we batch requests every 2 minutes, so the bill tracks deliveries rather than GPS pings.

Each of these was a deliberate design choice, and together they keep infrastructure a small cost for a platform handling 30,000+ orders a month. This is the kind of cloud architecture work we do, and the money ROUTD doesn’t spend on infrastructure can go toward growth.

3. Real-Time Tracking Without the Database Bottleneck

Real-Time Location Updates Architecture Driver App GPS update every 10 seconds SignalR Hub WebSocket server • Validates tenant • Broadcasts to group • Rate limits updates Redis Cache Latest position only TTL: 1 hour SQL Database Batched writes every 5 minutes Admin Dashboard Live map view 30+ drivers tracked 10s interval WebSocket Write-through Batch insert Result: Sub-second latency for live tracking Batched writes to the database Zero location data loss

The original system wrote every GPS update directly to the database. When you have 30 drivers on the road, each sending location updates every 10 seconds, that’s 180 writes per minute just for location tracking.

We decoupled real-time display from durable storage.

Driver apps send GPS updates to a SignalR hub via WebSockets. The hub validates the tenant, broadcasts the update to all connected dashboards, and writes the latest position to Redis.

Every 5 minutes, a background job reads from Redis and batch-inserts location history into SQL. Live tracking stays real-time on the map while the database takes far fewer writes.

Admin dashboards connect to the SignalR hub and receive location updates as they happen, without polling, so the map shows each driver’s current position.

4. Route Optimization Without Vendor Lock-In

The previous system paid a third-party route optimization API for every route calculation, which gets expensive at 30,000+ orders a month.

We built a custom route optimizer using the Traveling Salesman Problem (TSP) with a greedy nearest-neighbor heuristic. It doesn’t find the perfect route every time, but it replaced manual route assignment.

For complex routes (15+ stops), we fall back to the third-party API. For simple routes (3-8 stops), we use our own algorithm. This hybrid approach keeps most routes off the paid API without losing quality on the hard ones.

The optimizer runs as an Azure Function triggered when a new delivery batch is created. It takes a list of addresses, calculates optimal visit order, estimates ETAs based on traffic data, and returns a route manifest.

The Results

We rewrote 1.5 years of custom development in 6 months, leading a team of 8. The platform now handles:

  • 30,000+ orders delivered per month
  • Around $5M worth of orders a year
  • A cloud bill under $700

ROUTD is used by companies including Compass Group and Ole & Steen for their last-mile delivery operations across the UK.

Beyond the Code

Alongside the software, we embedded with the ROUTD team and worked on:

Pricing strategy. We modeled customer pricing based on order volume, data growth, third-party API costs, and infrastructure spend. That gave ROUTD a pricing breakdown per customer built on data growth, third-party, development, maintenance and cloud costs.

Monitoring and chaos engineering. We set up Grafana dashboards with SLA-driven alerts. We ran chaos experiments, such as killing database connections, simulating API timeouts and injecting latency into WebSocket connections, to test failure modes before customers hit them.

Business guidance. We consulted on HCI principles for driver UX, advised on GDPR compliance for location data retention, and analyzed user behavior patterns to improve onboarding flows.

Sales enablement. We helped the sales team demo the platform by building a sandbox environment with realistic test data. We also created technical sales collateral explaining the multi-tenant architecture to enterprise buyers.

Build vs. buy decisions. We identified areas where renting third-party services (SMS delivery, push notifications, map rendering) saved tens of thousands in unnecessary development costs.

This is how we run dedicated engineering. Our engineers sit in your Slack, push to your repo and own the outcomes alongside your team. When something breaks at 2am, we’re in the incident channel. When the engagement ends, you keep the code, the architecture, the CI/CD pipelines and a team that now knows how to maintain it.

What We’d Do Differently

If we rebuilt this today, we’d consider:

Event sourcing for order state. Right now, order status is a single column that gets updated in place. If we tracked order state as an append-only event log, we’d get built-in audit trails and better debugging when customers ask “why was this order marked as delivered at 3pm when the driver says they delivered it at 2pm?”

GraphQL instead of REST. The dashboard makes 8-10 REST calls on page load to fetch orders, drivers, routes, and analytics. A single GraphQL query could fetch everything in one round-trip.

Edge functions for geofencing. We run geofence calculations (is the driver inside the delivery zone?) in Azure Functions. Moving this to Cloudflare Workers or Deno Deploy would reduce latency for real-time alerts.

None of these is blocking anything today; the platform works, scales and makes money as it is.

Summary

ROUTD had a working product and paying customers, but the codebase couldn’t scale and the team couldn’t ship fast enough.

We led a team of 8, rebuilt the platform in 6 months and shipped it to production. On dedicated engineering work we write the code, own the architecture and stay until it’s running.

If your platform is hitting a ceiling and you want engineers who will build the fix, join us on Discord and tell us what you’re working on. You can also read about our cloud architecture and dedicated engineering services to see how we work.

Same problem on your side?

Tell us what you'd like to fix.

Book a call (opens in a new tab)Next: VAVA Cars