DEV Community

Cover image for Building a Cloud-Native School ERP: Architecture, Real-Time Fleet Tracking, and Data Integrity
Ankit Karan
Ankit Karan

Posted on

Building a Cloud-Native School ERP: Architecture, Real-Time Fleet Tracking, and Data Integrity

Educational institutions frequently juggle an unmanageable software stack: a legacy desktop tool for accounting, spreadsheets for grades, fragmented messaging apps for parent communication, and disconnected standalone hardware for attendance.

When administrative tools operate in silos, data bottlenecks arise. Report cards require days of manual exports, fee reconciliation involves cross-referencing physical receipts, and parents are left waiting for fragmented updates.

At AcadHex, we approached this problem as a systems integration and distributed architecture challenge. Below is a look into how we architected a unified, multi-tenant Cloud School ERP designed to automate campus workflows in real time.


1. Core Architectural Pillars

A production-grade School Management System handles wide variations in traffic: minimal load during instructional hours, sudden spikes during morning gate check-ins, and heavy concurrent sessions during report-card releases or fee deadlines.

To balance these patterns, our platform relies on three key design principles:

  • Strict Multi-Tenancy & Data Isolation: Each school network or academy operates with strict logical data isolation. Tenant resolution occurs at the gateway layer via subdomain routing, with database connection pooling ensuring isolated tenant contexts while sharing compute resources efficiently.
  • Event-Driven Communication: Critical campus actions—such as biometric check-ins or fee receipts—emit domain events rather than triggering synchronous write chains.
  • Hardware-Agnostic Ingestion: Campuses deploy diverse hardware setups. Our API abstracts physical hardware (biometric terminals, GPS units) behind standardized webhook and telemetry ingestion pipelines.
                +---------------------------------------+
                |          API Gateway & Routing        |
                |    (Tenant Resolution via Subdomain)   |
                +-------------------+-------------------+
                                    |
          +-------------------------+-------------------------+
          |                                                   |
+---------v---------+                               +---------v---------+
|  Real-Time Fleet  |                               |   Core Business   |
| Telemetry Service |                               |   Domain APIs     |
+---------+---------+                               +---------+---------+
          | (MQTT/UDP)                                        | (REST/RPC)
+---------v---------+                               +---------v---------+
| Hardware/Vehicles |                               | PostgreSQL / Read |
|   (GPS Devices)   |                               |      Replicas     |
+-------------------+                               +-------------------+
Enter fullscreen mode Exit fullscreen mode

2. Ingesting Live GPS Fleet Telemetry at Scale

Managing student transportation demands reliable, low-latency telemetry. Traditional HTTP polling introduces unnecessary overhead for vehicle tracking updates transmitted every 3 to 5 seconds.

Telemetry Pipeline

  1. Device Packets: Onboard vehicle GPS trackers broadcast lightweight UDP/MQTT packets containing coordinates, speed, ignition status, and vehicle telemetry.
  2. Ingestion Layer: A Node.js worker layer decodes incoming binary/NMEA data payloads and validates device signatures.
  3. Geofencing & Event Triggers: Ingested coordinates pass through an in-memory spatial index. When a vehicle crosses a defined perimeter (e.g., Approaching Stop: Sector 4), the system triggers parent notification events.
  4. Broadcast via WebSockets: Real-time updates are published via Redis Pub/Sub directly to authenticated client dashboard sockets.
interface VehicleTelemetryPacket {
  deviceId: string;
  tenantId: string;
  latitude: number;
  longitude: number;
  speedKmh: number;
  timestamp: number;
}

// Ingestion validation handler
export async function processTelemetry(packet: VehicleTelemetryPacket): Promise<void> {
  const { deviceId, tenantId, latitude, longitude } = packet;

  // 1. Update latest vehicle state in cache
  await cache.geoadd(`fleet:${tenantId}`, longitude, latitude, deviceId);

  // 2. Publish to authenticated active web/mobile listeners
  await pubsub.publish(`fleet:updates:${tenantId}`, JSON.stringify(packet));

  // 3. Evaluate active route geofences asynchronously
  queue.add('evaluate-geofence', { tenantId, deviceId, latitude, longitude });
}
Enter fullscreen mode Exit fullscreen mode

3. Financial Consistency in Fee Automation

Automated fee collection requires strict consistency. Distributed transactions can fail midway if parent payments, fee concessions, ledger writes, and receipt generation are not handled within transactional boundaries.

We implement atomic transactions with idempotency keys across all collection endpoints:

-- Atomic ledger write pattern for fee processing
BEGIN;

-- 1. Lock invoice record to prevent concurrent double-collection
SELECT id, balance_due 
FROM student_invoices 
WHERE id = 'inv_98234' AND status = 'PENDING'
FOR UPDATE;

-- 2. Register successful transaction entry
INSERT INTO payment_transactions (
    id, invoice_id, amount_paid, gateway_ref, status, created_at
) VALUES (
    'txn_44102', 'inv_98234', 15000.00, 'pay_tok_live_891', 'SUCCESS', NOW()
);

-- 3. Reconcile balance and update invoice status
UPDATE student_invoices 
SET balance_due = balance_due - 15000.00,
    status = CASE WHEN (balance_due - 15000.00) <= 0 THEN 'SETTLED' ELSE 'PARTIAL' END,
    updated_at = NOW()
WHERE id = 'inv_98234';

COMMIT;
Enter fullscreen mode Exit fullscreen mode

Idempotency tokens on payment callbacks prevent duplicate receipts or balance miscalculations if a payment gateway retries a webhook during network fluctuations.


4. Hardware Integration: Biometric Attendance Pipelines

Connecting campus biometric hardware to cloud infrastructure presents practical challenges: school-level devices frequently experience intermittent offline states.

To prevent missing punch records, biometric terminals send batches using local storage replay:

  • Every punch is assigned a monotonically increasing sequence ID per device.
  • Devices buffer attendance records locally during network outages and flush payloads sequentially upon reconnection.
  • The API ingestion service deduplicates punches against a composite key (device_id, student_rfid, timestamp_minute) to guarantee zero duplicate markings while maintaining reliable attendance records.

5. System Design Takeaways

Building software for physical campus environments requires designing for edge-case resilience:

  1. Expect Intermittent Connectivity: Hardware bridges (turnstiles, vehicle tracking) must have built-in queuing and retry guarantees.
  2. Decouple Event Feeds from Query APIs: Separating live tracking feeds and heavy analytics queries prevents dashboard latency during peak morning check-ins.
  3. Prioritize Auditability: Administrative actions—grading adjustments, fee waivers, schedule updates—require immutable audit trails to maintain institutional trust.

By moving schools away from disconnected spreadsheets and legacy systems toward event-driven cloud platforms, administrators gain real-time oversight while parents stay informed.

Top comments (0)