# gabilang/swiftship-logistics architecture

> Architecture diagram of the GitHub repository gabilang/swiftship-logistics, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gabilang/swiftship-logistics
- Repository: https://github.com/gabilang/swiftship-logistics

## Overview

SwiftShip is a Ballerina logistics integration workspace centered on shipments_api as the parcel system of record. Merchants book through its REST API; manifest_intake books CSV rows from FTP, while carrier_events forwards Kafka scans. The API also supports scheduled SLA checks and MCP-facing tools for operations and customer care; agents connect through their respective MCP servers. The README documents these integration boundaries, but no source excerpts were provided, so internal call details beyond those documented are omitted.

Main entry points: [`shipments_api/service.bal`](https://github.com/gabilang/swiftship-logistics/blob/main/shipments_api/service.bal) (Shipments API), [`operations_agent/agent.bal`](https://github.com/gabilang/swiftship-logistics/blob/main/operations_agent/agent.bal) (Operations agent), [`customer_care_agent/agent.bal`](https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_agent/agent.bal) (Customer care agent), [`tracking_mcp/main.bal`](https://github.com/gabilang/swiftship-logistics/blob/main/tracking_mcp/main.bal) (Tracking MCP)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_domain["Shared domain"]
  node_business_rules["Business rules<br/>[rules.bal]"]
  node_shared_types["Shared types<br/>[types.bal]"]
end

subgraph group_ingestion["Shipment intake"]
  node_manifest_intake["Manifest intake<br/>[main.bal]"]
  node_carrier_events["Carrier scan intake<br/>[main.bal]"]
end

subgraph group_record["Shipment record"]
  node_shipments_api[("Shipments API<br/>[service.bal]")]
  node_shipment_seed["Demo shipment seed<br/>[seed.bal]"]
end

subgraph group_access["MCP and agents"]
  node_tracking_mcp["Tracking MCP<br/>[main.bal]"]
  node_operations_agent["Operations agent<br/>[agent.bal]"]
  node_operations_tools["Operations MCP tools<br/>[mcptools.bal]"]
  node_customer_care_mcp["Customer care MCP<br/>[main.bal]"]
  node_customer_care_agent["Customer care agent<br/>[agent.bal]"]
  node_customer_care_tools["Customer care MCP tools<br/>[mcptools.bal]"]
end

subgraph group_automation["SLA automation"]
  node_sla_watchdog["SLA watchdog<br/>[main.bal]"]
end

node_merchants(("Merchants"))
node_manifest_source[("Manifest FTP")]
node_carriers["Carrier Kafka"]
node_ops_staff(("Ops staff"))
node_ops_ai_clients(("Ops AI clients"))
node_customers(("Customers"))
node_slack_teams["Slack or Teams"]

node_merchants -->|"books parcels"| node_shipments_api
node_manifest_source -->|"provides CSV"| node_manifest_intake
node_manifest_intake -->|"books rows"| node_shipments_api
node_carriers -->|"streams scans"| node_carrier_events
node_carrier_events -->|"records scans"| node_shipments_api
node_shipment_seed -->|"seeds parcels"| node_shipments_api
node_tracking_mcp -->|"reads shipments"| node_shipments_api
node_operations_agent -->|"uses tools"| node_tracking_mcp
node_ops_ai_clients -->|"uses tools"| node_tracking_mcp
node_ops_staff -->|"asks questions"| node_operations_agent
node_operations_agent -.->|"uses tools"| node_operations_tools
node_customers -->|"chats"| node_customer_care_agent
node_customer_care_agent -->|"uses tools"| node_customer_care_mcp
node_customer_care_mcp -->|"checks ownership"| node_shipments_api
node_customer_care_agent -.->|"uses tools"| node_customer_care_tools
node_sla_watchdog -->|"checks promises"| node_shipments_api
node_sla_watchdog -->|"posts digest"| node_slack_teams

click node_business_rules "https://github.com/gabilang/swiftship-logistics/blob/main/logistics_commons/rules.bal"
click node_shared_types "https://github.com/gabilang/swiftship-logistics/blob/main/logistics_commons/types.bal"
click node_manifest_intake "https://github.com/gabilang/swiftship-logistics/blob/main/manifest_intake/main.bal"
click node_carrier_events "https://github.com/gabilang/swiftship-logistics/blob/main/carrier_events/main.bal"
click node_shipments_api "https://github.com/gabilang/swiftship-logistics/blob/main/shipments_api/service.bal"
click node_shipment_seed "https://github.com/gabilang/swiftship-logistics/blob/main/shipments_api/seed.bal"
click node_tracking_mcp "https://github.com/gabilang/swiftship-logistics/blob/main/tracking_mcp/main.bal"
click node_operations_agent "https://github.com/gabilang/swiftship-logistics/blob/main/operations_agent/agent.bal"
click node_operations_tools "https://github.com/gabilang/swiftship-logistics/blob/main/operations_agent/modules/mcptools/mcptools.bal"
click node_customer_care_mcp "https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_mcp/main.bal"
click node_customer_care_agent "https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_agent/agent.bal"
click node_customer_care_tools "https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_agent/modules/mcptools/mcptools.bal"
click node_sla_watchdog "https://github.com/gabilang/swiftship-logistics/blob/main/sla_watchdog/main.bal"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_business_rules,node_shared_types,node_ops_ai_clients toneBlue
class node_manifest_intake,node_carrier_events,node_manifest_source toneAmber
class node_shipments_api,node_shipment_seed toneMint
class node_tracking_mcp,node_operations_agent,node_operations_tools,node_customer_care_mcp,node_customer_care_agent,node_customer_care_tools toneRose
class node_sla_watchdog,node_merchants,node_carriers,node_ops_staff,node_customers,node_slack_teams toneIndigo
```

## Components

### Shared domain

- [Business rules](https://github.com/gabilang/swiftship-logistics/blob/main/logistics_commons/rules.bal): `logistics_commons/rules.bal`
- [Shared types](https://github.com/gabilang/swiftship-logistics/blob/main/logistics_commons/types.bal): `logistics_commons/types.bal`

### Shipment intake

- [Manifest intake](https://github.com/gabilang/swiftship-logistics/blob/main/manifest_intake/main.bal): `manifest_intake/main.bal`
- [Carrier scan intake](https://github.com/gabilang/swiftship-logistics/blob/main/carrier_events/main.bal): `carrier_events/main.bal`

### Shipment record

- [Shipments API](https://github.com/gabilang/swiftship-logistics/blob/main/shipments_api/service.bal): `shipments_api/service.bal`
- [Demo shipment seed](https://github.com/gabilang/swiftship-logistics/blob/main/shipments_api/seed.bal): `shipments_api/seed.bal`

### MCP and agents

- [Tracking MCP](https://github.com/gabilang/swiftship-logistics/blob/main/tracking_mcp/main.bal): `tracking_mcp/main.bal`
- [Operations agent](https://github.com/gabilang/swiftship-logistics/blob/main/operations_agent/agent.bal): `operations_agent/agent.bal`
- [Operations MCP tools](https://github.com/gabilang/swiftship-logistics/blob/main/operations_agent/modules/mcptools/mcptools.bal): `operations_agent/modules/mcptools/mcptools.bal`
- [Customer care MCP](https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_mcp/main.bal): `customer_care_mcp/main.bal`
- [Customer care agent](https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_agent/agent.bal): `customer_care_agent/agent.bal`
- [Customer care MCP tools](https://github.com/gabilang/swiftship-logistics/blob/main/customer_care_agent/modules/mcptools/mcptools.bal): `customer_care_agent/modules/mcptools/mcptools.bal`

### SLA automation

- [SLA watchdog](https://github.com/gabilang/swiftship-logistics/blob/main/sla_watchdog/main.bal): `sla_watchdog/main.bal`

### Other components

- **Merchants**
- **Manifest FTP**
- **Carrier Kafka**
- **Ops staff**
- **Ops AI clients**
- **Customers**
- **Slack or Teams**

## Connections

- Merchants → Shipments API: books parcels (evidence: `README.md`)
- Manifest FTP → Manifest intake: provides CSV (evidence: `README.md`)
- Manifest intake → Shipments API: books rows (evidence: `README.md`)
- Carrier Kafka → Carrier scan intake: streams scans (evidence: `README.md`)
- Carrier scan intake → Shipments API: records scans (evidence: `README.md`)
- Demo shipment seed → Shipments API: seeds parcels (evidence: `README.md`)
- Tracking MCP → Shipments API: reads shipments (evidence: `README.md`)
- Operations agent → Tracking MCP: uses tools (evidence: `README.md`)
- Ops AI clients → Tracking MCP: uses tools (evidence: `README.md`)
- Ops staff → Operations agent: asks questions (evidence: `README.md`)
- Operations agent → Operations MCP tools: uses tools
- Customers → Customer care agent: chats (evidence: `README.md`)
- Customer care agent → Customer care MCP: uses tools (evidence: `README.md`)
- Customer care MCP → Shipments API: checks ownership (evidence: `README.md`)
- Customer care agent → Customer care MCP tools: uses tools
- SLA watchdog → Shipments API: checks promises (evidence: `README.md`)
- SLA watchdog → Slack or Teams: posts digest (evidence: `README.md`)
