Fleet EcosystemClient project

Fleeticc Mobile: From a Five-Second Splash to 200ms with SQLite

The Fleeticc mobile app used to sit on a splash screen for four to five seconds on every cold start. We moved fleet metadata and last-known positions into SQLite so the home screen loads in under 200 milliseconds, then refreshes in the background.

FlutterSQLitesqfliteNestJSFirebase
Build-That Team3 min read
Fleeticc Mobile: From a Five-Second Splash to 200ms with SQLite

How cache-first boot in Flutter cut cold-start time using on-device SQLite while live data still streams in over SSE

Live maps were solved with Server-Sent Events on the backend. Mobile had a separate problem: the app felt slow before the user ever saw a vehicle. Every cold start blocked on a network waterfall. Firebase init, auth token refresh, fleet list fetch, vehicle metadata, map style config, all sequential, all over the network. Splash screens sat visible for four to five seconds on a typical 4G connection in Colombo.

Dispatch managers open Fleeticc first thing in the morning. Waiting five seconds for data the app already had yesterday is a product bug, not a network excuse. We fixed it with cache-first boot using on-device SQLite, without changing how live positions arrive once the app is open.


What blocked the splash screen

  • Auth and config fetched on every launch before any UI rendered
  • Fleet roster and vehicle labels re-downloaded even when unchanged overnight
  • Map screen waited for network before showing last-known markers
  • No local persistence beyond the auth token in secure storage

SQLite cache-first boot

We moved durable, slow-changing data into SQLite via sqflite. After the first successful login, the app persists fleet roster, vehicle labels, last-known positions, user permissions, and map defaults. On the next launch the splash reads SQLite first, paints the home screen from cache, and refreshes in the background.

  • SQLite tables: fleets, vehicles, last_positions, user_prefs, with versioned schema and migrations
  • Splash phase 1 (sync, about 150ms): read cache, validate JWT expiry locally, route to map or login
  • Splash phase 2 (async): delta sync against NestJS for rows changed since cached updated_at
  • Stale-while-revalidate: map shows last-known markers instantly; SSE replaces them as live data arrives
  • Cache invalidation on logout: wipe SQLite and secure storage in one transaction
dart
// Splash: cache-first boot, network is secondary
Future<BootResult> bootFromCache() async {
  final db = await AppDatabase.open();
  final session = await db.readSession();
  if (session == null || session.isExpired) return BootResult.needsLogin;

  final fleet = await db.readPrimaryFleet(session.userId);
  final vehicles = await db.readVehicles(fleet.id);
  final positions = await db.readLastPositions(fleet.id);

  unawaited(syncService.refreshInBackground(fleet.id));
  return BootResult.ready(fleet, vehicles, positions);
}

What we deliberately did not cache

Trip history, full playback routes, and report exports still load on demand. SQLite holds what the home screen and map need to feel instant: who the user is, which fleet they manage, vehicle names, and the last coordinate per vehicle. Live movement still comes from SSE after boot, not from stale cache pretending to be live.

  • Cached: fleet roster, vehicle labels, permissions, map defaults, last-known positions
  • Not cached locally: full trip archives, PDF reports, admin settings that change rarely mid-session
  • TTL on last_positions: shown immediately on boot, replaced within seconds by SSE stream

Measured outcome

Real-time transport and local cache solve different problems. SSE keeps the map honest while the app is open. SQLite makes opening the app feel instant. Both ship in the same Fleeticc mobile product, but they are separate engineering decisions and worth documenting separately.

Production case study

Fleeticc

Sri Lanka's locally built fleet tracking platform — fleeticc.com, web dashboard, and iOS/Android apps on one account for live GPS, alerts, and reports.

Next.jsFlutterGoNestJS
View project
ShareLinkedIn
FleeticcFlutterSQLitePerformanceMobile

Project Inquiry

Let's do great
work together

Tell us about your project, whether it is a mobile app, web platform, or MVP, and we'll respond within 24 hours.

Ahmed Anwer, Founder of Build-That

Connect with Founder · Ahmed Anwer

Your name
Email address
Project details...