All projects

Odyssey

An underwriting platform where insurance brokers and insurers handle surety bonds and trade credit insurance.

Built at MDN Labs, 2026

What it is

  • A platform for surety bonds and trade credit insurance, used by brokers, managing general agents and insurers on shared infrastructure.
  • It covers applications, proposals and renewals, documents, messaging and notifications, with company risk reports from BABIS.
  • The backend is shared work, and I did much of it. The release platform is mine.

The problem

Odyssey needed a new product line, trade credit insurance. At the same time, older foundations needed replacing: separate legacy models for companies and contractors, email sent over SMTP, and a two-way sync with a legacy platform that shared its document storage.

Releases had to reach four environments from two repositories, the API and the frontend, without one service’s release overwriting the version of the other.

How I built it

  • I made the initial design of the trade credit insurance module and built its first version as a new Django app: domain models, applications, prescreening, lifecycle, assignment, premium estimates, documents, per-proposal chat rooms, role-based permissions and notifications.
  • I did most of the refactor that merged the separate company and contractor models into a single Entity domain, across database tables, migrations, queries, APIs and notifications.
  • I replaced SMTP with Microsoft Graph sendMail through MSAL, with a recipient allowlist in QA so test emails cannot reach real clients.
  • I hardened the two-way sync with the legacy platform: document storage decoupled from the integration and unified into one store, bond IDs that collided across platforms told apart by platform, and outbound document sync moved to Celery jobs.
  • I built the Odyssey side of the BABIS integration: the client, company mirroring queued after commit, analysis requests, and API endpoints for company reports, events, articles and sentiment.
  • I split the application containers from the stateful services, so PostgreSQL, Keycloak, RabbitMQ and Redis are managed by Ansible and app releases change only the app.
  • I standardised structured logging across HTTP, Celery and WebSockets, added self-service notification preferences and multiple facilities per company, and enforced Ruff through pre-commit.

The interesting parts

Releases from two repositories

The API and the frontend build in separate pipelines, but deploy as one stack whose versions live in a single .env.versions file. The deploy pipeline reads Build.TriggeredBy.DefinitionId to know which service triggered it, takes that service’s new image tag from its build, and reads the other service’s tag from the active file on the host. If that file is missing or invalid, the deploy stops instead of guessing. A finished build on next deploys to dev, demo and QA in parallel, while main deploys to production behind an approval gate. Either repository can ship on its own without rolling the other one back.

A deploy that puts the old release back

My Python deploy runner works with three files: the candidate versions, the active ones, and the previous ones. The candidate is checked on the build agent and again on the host: only the expected keys, the expected registry, and tags in the GitVersion form MAJOR.MINOR.PATCH plus a commit hash, so latest is never deployable. The runner then validates the Compose config, pulls, runs migrations, starts the services and waits for health: the API healthcheck, the frontend and worker running, and the scheduler not crash-looping, with restarts counted from a baseline taken before the deploy. Only then does the candidate become active. If anything fails after the new containers start, it prints bounded diagnostics and starts the previous images again. Migrations are forward-only, so the runner says plainly that it restored images, not the schema.

One model for every company

Companies and contractors lived in separate legacy models. Most of the work of unifying them into a single Entity domain was mine, which meant changing tables, writing the migrations, and moving every query, API and notification onto the new model. Visibility moved from broker-of-record rules to rules based on how a company interacts with an entity through proposals, facilities and brokers of record. I also added CreditSafe candidate matching, so an entity can be linked to the right CreditSafe company.

Keeping test environments away from real clients

Non-production environments sit next to real integrations: email, and the document share the legacy platform reads. Email goes through Microsoft Graph, and in QA only allowlisted recipients ever receive a message. Writes to the shared document storage run in dry-run mode in QA and demo: the sync logs what it would move and register, but touches neither the share nor the legacy API. A test run can exercise the whole flow without a client seeing an email or a file it should not.

Documents that arrive before the legacy record exists

A document can be uploaded for a company the legacy platform does not know yet, so there is no legacy folder to put it in. Those uploads are parked in a fallback folder. A Celery job, queued with transaction.on_commit so it only runs once the upload is committed, moves them to the legacy path and registers them, and it runs again as soon as the company’s legacy mapping is created. The job only picks up documents still in the fallback folder, so running it twice is safe, and if a move fails the file stays where it is instead of being lost.

How it runs

  • Four environments: dev, demo, QA and production, deployed through Azure DevOps.
  • Releases are shipped over SSH and run by the deploy runner on each host. A separate manual production pipeline handles hotfixes and pinned rollbacks, and asks for a reason and a typed confirmation.
  • Application containers (migration, api, fe, celery and celery-beat) run under Docker Compose; runtime configuration lives in an Ansible Vault-encrypted file, separate from the release versions.
  • Sign-in uses Keycloak over OIDC, with RS256 tokens checked against its JWKS.
  • Versions follow GitVersion SemVer on next, main and hotfix branches, and logs are shipped by Grafana Alloy to the central log stack.