Skip to content

Architecture

This page is for power users and integrators who want to understand how the platform is wired up.

Web client

The dashboard is a Next.js 15 application using the App Router. Routes are colocated under src/app/:

  • src/app/auth/ — sign in, sign up, email verification, password recovery
  • src/app/(app)/ — protected modules (dashboard, drivers, assets, dispatch, risk, maintenance, analytics, users, notifications, fuel, incentive, logs, settings)
  • src/app/driver-dashboard/ — driver-facing experience

State management uses React Query with an AuthContext and a ThemeContext provider tree.

Backend services

The backend is built with Encore.ts. Each business domain is its own service:

  • auth — user identity, sessions, password reset, email verification
  • driver — driver records and verification flows
  • truck — fleet assets and telematics mapping
  • dispatch — routes, trips and on-time tracking
  • maintenance — service tickets and history
  • predictive-maintenance — AI risk engine
  • telemetry-store — live IoT ingestion
  • iot — device protocol bridge
  • chat — operator/driver messaging
  • notification — multi-channel delivery
  • email — transactional email via Resend
  • exporter — CSV/XLSX generation
  • cache — shared Redis-style caches

Each service has its own Postgres database managed through Drizzle migrations.

Data flow

[Truck Telematics] → iot → telemetry-store → predictive-maintenance → notification

[Web Client (Next.js)] ←—————————————— Encore Gateway ——————————————→ [Postgres × N]

The Next.js client talks to a single Encore gateway which fans out to the right backend service per route.

Authentication

  • Session tokens are stored in HttpOnly cookies set by the Encore gateway.
  • Verification codes are 6-digit numeric, valid for a short TTL.
  • Password reset tokens are single-use opaque strings.
  • All sensitive endpoints are marked sensitive: true in their Encore API definition.

Deployment

The web client runs on Vercel (or any Node host). The backend services run as a single Encore application — usually deployed to Encore Cloud, GCP, or AWS depending on the tenant.

For end users

You do not need any of this to use the product. This page is documentation for the technical team. Most users can safely skip it.

N2E Fleet Management User Guide.