Envo

Orders and deliveries with a team of couriers, over Telegram and WhatsApp.

Live demo at envo-demo.tech · 23 screens

  • Operations dashboard
  • Courier app on Telegram
  • Ordering page

The code is private; I can walk you through it on a call.

The problem

A delivery operation with several couriers takes orders over Telegram and WhatsApp, gets paid in pesos, dollars and euros, and notifies every party at every step of an order. If a notification gets lost, the order gets stuck; if a payment is recorded twice, the cash doesn't balance. Envo centralizes that operation, tracks the delivery of every notification and prevents a payment from being recorded twice.

Overview of the Envo operations dashboard, showing the Almacén del Parque demo

Screens by role

23 screens across three interfaces: the operations dashboard, the courier Mini App and the customer ordering page. The interface is in Spanish.

Operations, in the dashboard

The dashboard has 12 modules. Orders is where couriers are assigned, receipts are reviewed, and edits and incidents are logged.

It also manages customers with balances and referrals, products, inventory by location, zones with rain, night and holiday surcharges, and courier cash with settlements.

Settings cover delivery windows, priority delivery, payment accounts and the exchange rate, which is pulled from DolarApi with validity rules.

  • Order with receipt
  • Courier cash
  • Zones and surcharges
  • Inventory by location
An open Envo order with its payment receipt, ready for review

Control and security, in the dashboard

Overview, help and support; alerts and system health; results with CSV export; staff with granular permissions; and an audit log. Accounts support TOTP, recovery codes and session management.

  • Alerts and health
  • Results
  • Staff permissions
Alerts and system health in the Envo dashboard

Courier and customer

Courier

A Telegram Mini App. The courier sets their availability, takes orders, moves through the delivery steps, gets notifications and keeps track of their own stock and cash by currency.

Customer

On /pedido the customer builds a cart from the catalog, picks a zone and a delivery window or priority delivery, and pays in ARS, USD or EUR, with split payments or their account balance. They can change or cancel the order and report a problem with a photo.

Architecture

Next.js API and dashboard on PostgreSQL, a worker that drains the outbox to n8n, and live dashboard updates through NOTIFY and SSE.

Technical decisions

How notification delivery is tracked and duplicate payment records are prevented.

  • Transactional outbox with a circuit breaker

    Every notification goes into an outbox that the worker claims with FOR UPDATE SKIP LOCKED, with ten attempts and backoff. If n8n is down, the circuit breaker defers sending without using up attempts, for up to six hours, because after that the notification is no longer useful. Those that can't be delivered end up in a dead letter queue that opens an alert.

  • Idempotent commands with a single lock order

    Repeating a command doesn't duplicate its effect, and every command takes its locks in the same order. That rules out deadlocks between operations competing for the same rows.

  • Append-only courier cash ledger

    The cash ledger only adds entries, never edits them, and each entry carries a deduplication key. A retry doesn't duplicate amounts.

  • Nightly invariant checks

    Stock, reservations and cash are verified every night. Any difference opens a critical alert, and the same check closes it once it is corrected.

  • SQL migrations with checksums

    All 86 migrations are written in SQL, with no ORM, and each one stores its checksum, which reveals any change to a migration that has already been applied.

  • Authentication, signatures and rate limiting

    Passwords hashed with argon2id, TOTP with replay protection and re-authentication for sensitive actions. Events sent to n8n are signed with HMAC and a timestamp, rate limiting runs in PostgreSQL and private files are re-encoded to WebP.

Quality and evidence

Results from npm test and the e2e suites, with the numbers from the repository.

  • Integration tests against PGlite and against real PostgreSQL, with contracts shared between the two engines.

  • 70 of the 87 e2e suites include accessibility checks with axe.

  • Strict TypeScript, including the worker's .mjs files.

  • OpenAPI documents 73 of the 150 API routes.

3,065

tests passing in npm test as of Nov 25, 2026

87

e2e suites, 70 with axe

150

API routes

86

SQL migrations, no ORM

Tech summary

My role
Full design and development
When
November 2026
Status
Based on a system that handles real orders. The demo uses fictional data and only the Telegram channel.
Components
Operations dashboard · Courier app on Telegram · Ordering page
Architecture
Next.js API and dashboard on PostgreSQL, a worker that drains the outbox to n8n, and live dashboard updates through NOTIFY and SSE.
Practices
  • Test pyramid: unit tests, integration tests against PGlite and real PostgreSQL, contract tests shared by both engines, and e2e tests with accessibility checks
  • Strict TypeScript, worker included
  • Versioned SQL migrations with checksums
  • API documented in OpenAPI
Focus areas
  • Reliability: transactional outbox and circuit breaker
  • Authentication: TOTP, re-authentication and granular permissions
  • Database: 64 tables and 86 SQL migrations with checksums
Patterns
  • Transactional Outbox
  • Circuit Breaker
  • Dead Letter Queue
  • Idempotency
  • Append-only ledger
  • Pessimistic locking (FOR UPDATE SKIP LOCKED)
  • HMAC with timestamp
  • LISTEN/NOTIFY and SSE
Stack
  • Next.js
  • TypeScript
  • PostgreSQL
  • n8n
  • Telegram Mini App
  • WhatsApp
  • DolarApi
  • OpenAPI