Shipping agency ERP

Shipping-agency ERP for a port agent in the UAE: job orders, disbursement accounts and billingCase Study

Timeline
Jul to Oct 2026. Phase 4 was merged to main on 26 Oct 2026.
Platforms
Web
Category
Web Applications
Status
Case Study

Overview

A server-authoritative ERP for a shipping agency in the UAE. It covers vessel calls, port disbursement accounts (PDA and FDA), operational checklists, logistics and receivables. The browser decides what to draw; the server decides whether a write happens.

A server-authoritative ERP for a shipping agency in the UAE. It covers vessel calls, port disbursement accounts (PDA and FDA), operational checklists, logistics and receivables. The browser decides what to draw; the server decides whether a write happens.

My role: Co-built with a second developer. I wrote 27 of the 60 API commits and 50 of the 83 client commits. I also ran the requirements loop with the client.

Two developers on the API. A third contributor made 5 commits on the client.

  1. 01

    Problem

    The browser could be trusted to enforce the workflow, and it cannot.

    Approach

    The role matrix and workflow gates are checked inside the writing transaction, so a stale tab, a queued click or a curl request cannot get past them. A parity test checks the API matrix against the client’s copy.

  2. 02

    Problem

    An invoice without an approved disbursement account could be inserted.

    Approach

    Check constraints and triggers in PostgreSQL (invariants.sql) refuse the insert. CI runs against a real PostgreSQL, never SQLite.

  3. 03

    Problem

    Two beat processes would fire every scheduled job twice.

    Approach

    The beat schedule lives in the database through django-celery-beat. It prevents the double fire, and it changes without a deploy.

  4. 04

    Problem

    An unset Redis URL makes the broker, the channel layer and the rate limiter process-local, and they stop being shared as soon as a second process starts.

    Approach

    REDIS_URL is the only Redis setting the service reads, and the README says what happens when it is unset.

  5. 05

    Problem

    The client was a single-file HTML prototype whose design was signed off and could not change.

    Approach

    A faithful port. Layout, colours, labels, navigation, breakpoints, workflow, exports and printed documents all stayed as they were.

  6. 06

    Problem

    An ERP that shows made-up figures when the API is down is dangerous.

    Approach

    The client has no offline fixtures. It says when the API cannot be reached, and an end-to-end test checks that the failure is visible.

  7. 07

    Problem

    An audit log that can be edited proves nothing.

    Approach

    The UPDATE privilege on the audit table is revoked, so it can only be appended to. A PII access log records reads of personal data too.

Engineering

My role
Co-built with a second developer. I wrote 27 of the 60 API commits and 50 of the 83 client commits. I also ran the requirements loop with the client.
Ownership
Two developers on the API. A third contributor made 5 commits on the client.
Timeline
Jul to Oct 2026. Phase 4 was merged to main on 26 Oct 2026.
Status
Phase 4 (AED and VAT, the unified FDA and tax-invoice PDF, go-live tests) is on main. The production host and go-live status are not recorded in the repository.

API

Django, with seven domain apps and more than 40 models. The single authority on the workflow.

Repository: API repository

Web client

A React and TypeScript client, migrated from a single-file HTML prototype with the UI unchanged.

Repository: Client repository

Stack: API

  • Python 3.13, Django 5.2, Django REST Framework
  • PostgreSQL through psycopg 3
  • Celery and Redis, with the beat schedule in the database
  • Django Channels WebSockets, on Uvicorn behind Gunicorn
  • OpenTelemetry for the API, Celery and the database
  • uv with a committed lock file

Stack: Client

  • React 18.3, Vite 5, TypeScript
  • react-router 6, Redux Toolkit 2
  • A hand-written API client, with no UI kit and no form library
  • Vitest, Playwright, and a bundle budget that runs inside the build
  • Three auth modes, chosen by the server

Migration: A React and TypeScript client

From A single-file HTML prototype

The brief did not allow a change to the UI, so layout, colours, labels, navigation, breakpoints, workflow, exports and printed documents were kept as they were.

Migration: Seven domain apps: accounts, organisation, masters, jobs, logistics, billing and records

From A Django monolith called erp

Migration 0008, models_move_to_domain_apps, records the split. A test keeps the boundary from closing again.

Migration: Redis below 6.5, with the reason written in pyproject.toml

From Redis 8.1 in the API

Celery’s kombu caps Redis below 6.5, and channels-redis needs 4.6 or later. The version choice is documented next to the pin.

The role matrix and the workflow gates are checked inside the writing transaction.

A stale tab, a queued click or a curl request cannot get past them.

The browser holds a copy of the role matrix, used only to decide what to draw.

A test in the API parses the client’s roles.ts and fails when the two copies disagree, so the drift is tested, not trusted.

Database constraints back the business rules.

invariants.sql adds check constraints and triggers. An invoice without an approved FDA cannot be inserted at all.

The app has no offline fixtures.

An ERP that shows made-up figures when the API is down is worse than one that says it cannot connect. A test checks the failure is visible.

Reads of personal data are logged, not just writes.

A PII access log records reads, and the audit log has its UPDATE privilege revoked, so it can only be appended to.

Release, run and handover

  • A five-container stack (database, Redis, API, worker, beat), with a healthcheck on each. make services-up waits for both healthchecks before returning, so migrate does not race a database still starting.
  • make stack-down keeps the data volume. make dev is safe to re-run.
  • CI runs the same make verify command as a developer, on every branch, against a real PostgreSQL.
  • The client has a production-CSP preview, so a policy violation shows before deploy, and the bundle budget runs as part of the build.
  • The client is served by nginx in a container on :8080, with WEB_ORIGIN set so CORS admits that origin.
  • The requirements loop left a paper trail: three question rounds, two answer documents, a go-live decision record and a P&L audit.

Measured in the repositories

  • Seven domain apps, more than 40 models, three business lines: ship agency, logistics and direct billing.
  • More than 40 API test modules. The client has 40+ Vitest suites and 6 Playwright specs.
  • Three independent enforcement layers, the deepest in PostgreSQL.
  • Three authentication modes, and a one-time password that holds the user on a change-password screen.

Skills this shows

  • Workflow and role enforcement
  • Financial correctness with AED and VAT
  • Database-level invariants
  • Requirements elicitation with a client
  • Observability with OpenTelemetry
  • Reproducible builds

Not settled in the repositories

  • The scope document, with the role matrix and the gates, is referenced throughout but is not in the repository.
  • The production host and go-live status are not recorded.
  • Whether Cognito is the production sign-in mode.
  • Where the OTLP exporter sends data in production, and the storage configuration.

Results

Phase 4 (AED and VAT, the unified FDA and tax-invoice PDF, go-live tests) is on main. The production host and go-live status are not recorded in the repository.

Next projects

  1. FabrikBooksBookkeeping for founders, bridged to QuickBooks, Xero and Zoho, with a review workbench for the ops team
  2. EC Infosolutions websiteRebuilding a 318-page Wix company site as React, with prerendered pages and a build-blocking SEO gate
  3. ArkmantraAyurvedic Cosmetics E-Commerce Storefront & Admin