PersonalDistributed Systems2026
ParcelFlow
A shipment workflow built around recoverable events
A simulated logistics platform with Go services, a transactional outbox, idempotent projections, distributed tracing, and verified local Kubernetes recovery.

Overview
ParcelFlow models the operational journey of a parcel: create a shipment, schedule pickup, move it through origin and destination hubs, dispatch it, and record delivery. Users browse shipments, take the next allowed action, and inspect persisted tracking history and simulated notifications.
Its purpose is an engineering one: demonstrate how independent services preserve correct effects when messages repeat, consumers stop, or processes restart. All shipments are synthetic, notifications send no external messages, and deployments and measurements run locally.
From Creation to Delivery
The creation form collects sender, recipient, route, and service level. Shipment detail then pairs the current authoritative state with the next legal action. A parcel in transit can be received at its destination hub; it cannot jump directly to delivered.

Tracking records all eight lifecycle revisions, ordered by revision rather than wall-clock time. The UI polls the independent projections within a bounded window and never fills in missing history from the current status. Notification records only creation, out-for-delivery, and delivery effects.

Service Boundaries
Gateway handles HTTP transport without owning business rules or a database. Shipment owns authoritative state and legal transitions. Tracking owns the event-driven historical projection; Notification owns simulated effects. Each data service owns its PostgreSQL database, credentials, and migrations. One local PostgreSQL process hosts these databases, with no cross-service table access.

Commit State and Publication Intent Together
A synchronous call from Shipment to both downstream services would leave partial work when a dependency fails. Instead, each shipment mutation and its serialized outbox event commit in one database transaction. A committed change therefore retains a durable publication intent even while the broker is unavailable.
Three publishers claim eligible rows with FOR UPDATE SKIP LOCKED. Later revisions remain ineligible while an earlier revision for the same shipment is unpublished, allowing unrelated shipments to progress concurrently. A publisher marks an event published only after broker acknowledgement.
Delivery is at-least-once. A crash after broker acknowledgement but before the database mark can publish the same event ID again. Consumers prevent duplicate business effects; the transport does not promise exactly-once delivery.
Each consumer inserts the processed event ID and its business effect in the same transaction, then commits its broker offset. A crash after that transaction can replay the event safely. Shipment UUID message keys keep each shipment on one of the topic's three partitions; there is no total order across shipments.
Concurrency, Retries, and Repair
Creation accepts a persisted idempotency key: the same key and normalized payload replay the original creation response, while a changed payload conflicts. Lifecycle updates use row locking and a required expectedVersion, so two requests based on the same revision cannot both advance it.
Consumers try transient effects at most four times with bounded operation timeouts and backoff. Permanent errors or exhausted retries retain original bytes and source coordinates in a service-owned rejection record. The source offset advances only after that evidence is durable and the dead-letter queue publication is acknowledged. Failure to retain either leaves the offset uncommitted.
Tracking rejects revision gaps instead of inventing missing history. An operator must restore the original prerequisite event, wait for it to project, then replay one retained rejection through normal validation and deduplication. Malformed retained payloads are not edited into valid events. This is bounded, operator-driven recovery; broker retention and deduplication-marker retention still constrain replay.
Follow One Event Across Services
OpenTelemetry carries W3C context through Gateway HTTP, Shipment SQL, the committed outbox, publication, and both consumers. Structured logs retain trace and span IDs. Prometheus metrics use bounded labels rather than shipment IDs; SQL spans omit arguments and contact data.


Measure Throughput and Recovery Separately
A separate Go simulator exercises six controlled scenarios: normal traffic, duplicate publication, stopped Tracking, a real Notification lock/timeout/retry, malformed-event rejection, and revision-gap repair/replay. Failure controls remain operator-side. k6 provides bounded HTTP workloads, followed by event-ID-set audits rather than relying on request success or row counts alone.
The normal run separately counted 1,000 expected pending Tracking 404 responses while projections caught up. All shipments reached delivered at revision eight, with matching sets of 8,000 outbox/Tracking event IDs and 3,000 notification effect IDs.
In the separate stopped-Tracking run, the backlog reached 8,000 events. After restart, observed recovery took 31.898 seconds, with no missing or duplicate business effects in the final ID-set audit. The deliberate outage produced 1,000 expected temporary HTTP 502 responses; zero unexpected failures does not mean uninterrupted availability.
These are local observations on Windows 11 Pro with a Ryzen 5 9600X and approximately 31.1 GiB host RAM; Docker had 12 CPUs and approximately 15.17 GiB RAM. Warm caches, retained development data, full trace sampling, workload shape, and polling affect the results. They do not establish production capacity or internet-facing latency guarantees. See the repository's verification summary and measurement methodology.
Local Kubernetes, Verified Functionally
One Helm chart deploys the Go services, PostgreSQL, Redpanda, and observability tools into kind. Probes separate process liveness from database readiness; graceful termination drains work. Secrets supply credentials, resource budgets bound local usage, and PostgreSQL/Redpanda use retained PVCs. These volumes survive pod replacement, not deletion of the kind cluster.

Scaling Tracking to two replicas verified that both consumers participated in the existing three-partition group and reached zero final lag. Throughput improvement was not benchmarked. A single node, one broker, replication factor one, and local storage provide no production high-availability guarantee.
Engineering Lessons and Limits
Correctness depends on the boundaries between commits, publication, effects, and acknowledgements. Exact ID-set audits make recovery claims stronger than a healthy dashboard alone. Measurement also directed publisher improvements toward lower database work and faster convergence, without implying faster API throughput.
The workflow intentionally excludes cancellations, returns, delivery failures, and real courier integrations. APIs lack production authentication; notifications remain simulated. Observability storage is ephemeral, migration and runtime roles are not separated, and retention, backups, and gap repair require operational policies. ParcelFlow demonstrates local distributed-systems behavior, with those limits visible.