Case Study_04

Somalia LMIS.

A national livestock market information system built for the Somali Ministry of Livestock, Forestry & Range. REST APIs powering real-time price tracking, market analytics, and role-based data access across 16 regions and 33+ active markets — live on a government domain.

ROLE

Backend Lead

TIMELINE

2024 – Present

0

Regions Covered Nationwide

0+

Active Markets

0

Livestock Species Tracked

Hybrid Cloud + On-Premise Architecture

The NestJS API runs on AWS EC2 as the primary server with AWS RDS (PostgreSQL) as the live database and S3 for file and image storage. A physical on-premise government server acts as the backup — receiving database replication from RDS and image sync from S3. GitHub Actions handles CI/CD, deploying to both AWS EC2 and the on-premise server on every push to main, keeping both environments current. JWT secures all endpoints with role-based access across four user tiers.

NestJSAWS EC2AWS RDSS3GitHub ActionsDockerTypeORMJWT
Somalia LMIS portal dashboard

FIGURE D.01

Hybrid Cloud + On-Premise Deployment

Engineering Challenges.

01

The system needed to run on both AWS EC2 and an on-premise government server simultaneously — with both code and data staying in sync — without manual intervention or risking divergence between the two environments.

Solution

GitHub Actions CI/CD pipeline deploys to both servers on every push to main. AWS RDS streams data to the on-premise PostgreSQL via logical replication, and S3 image assets are synced to local on-premise storage on a scheduled job — keeping both environments identical without manual effort.

02

Regional data entry officers operate in areas with unreliable internet, causing gaps in price submissions and delayed market visibility at the national level.

Solution

Designed the API to support bulk submission and idempotent writes, allowing field apps to queue records locally and sync in batches when connectivity is restored — without creating duplicate entries.

Building for government infrastructure means designing for the real world — hybrid deployments, intermittent connectivity, and strict audit requirements.

CI/CD to Multiple Targets

A single GitHub Actions pipeline deploying to both AWS and on-premise kept both environments in lockstep — no manual SSH, no version drift between servers.

Replication Over Manual Sync

Using AWS RDS logical replication to the on-premise database eliminated an entire class of sync errors that manual exports would have introduced.

Design for Field Reality

Idempotent bulk-submit APIs let field officers queue and retry without creating duplicate records — essential when connectivity is unreliable.

Audit Trails Are Non-Negotiable

Audit logs baked in from day one made compliance reviews straightforward and built lasting trust with ministry stakeholders.

price-report.service.ts

Brian Mutai / Backend Lead