Case study · Backend · platform
Kadans
I turn ERP discounts into spoken promotions that a branch can keep playing when its link to headquarters drops.
A branch has to keep its schedule when headquarters is unreachable, and every price customers hear has to come from the grocery chain’s ERP.
- branches in the customer’s chain
- 20+
- completed announcement plays reported by one player
- 500+
- from first commit to first customer
- Under three months
- engineer for design, rollout and operations
- Sole
Stack: Python · FastAPI · PostgreSQL · Go · MQTT 5 · React · TypeScript · Raspberry Pi · Linux · Windows · PowerShell · CaddyModels: Claude · ElevenLabs
What a branch needs to keep playing
I built Kadans around a Windows server at headquarters and a Raspberry Pi player in each participating branch. The server reads eligible discounts from the chain’s SQL Server ERP. Each player fetches a versioned plan over the branch VPN and decides when the speaker can play.
The plan includes opening hours, music, prayer-time quiet periods and a window for starting each announcement. The player caches the audio and checks its hash. During an outage it follows the last verified plan and uploads its proof of play when it reconnects.
Scroll sideways for the full diagram →
From a discount to a spoken price
Kadans sends the offer facts to Tellal, the gateway I built for copy and speech. Claude drafts a Turkish sentence around placeholders. Tellal rejects stray digits or broken placeholders before code inserts the supplied prices and dates. ElevenLabs reads the finished text.
Tellal checks the installation key, prepaid credit and spend limits before a paid call. If copy is rejected or its budget runs out, Kadans can request speech for its standard sentence instead. Either way, new audio exists only once speech synthesis succeeds.
Scroll sideways for the full diagram →
What happens when a step fails
| When… | What happens next |
|---|---|
| A player misses an MQTT revision hint | It also polls every twenty seconds. HTTPS carries the current plan, audio and proof of play. |
| A player restarts during speech | If its saved claim survives, the player drops that occurrence. A later scheduled occurrence can still play. |
| An ERP read fails | Existing offers keep their original start windows. Withdrawing an offer requires a successful read. |
| Claude returns an invalid template | Tellal allows up to two budget-checked rewrites per admitted run. |
| A restarted player fails its ninety-second check | The Pi updater attempts rollback. |
| Headquarters needs a replacement disk | A sealed off-site backup includes the certificate authority, so players can trust the restored server at the same address. |
The office installs each release first
I sign each release once the Windows checks pass. By default, a customer server is offered only a version the office canary has installed successfully. The server checks the signature, installs overnight and reports the outcome. That gives the office a night to catch an installation problem before any customer receives the update.
Two days after the first customer went live, its server completed that overnight self-update. I can update the branches in stages because the server still serves the plan format that older players understand.
Scroll sideways for the full diagram →
Decisions behind the schedule
| What I chose | What that buys or costs |
|---|---|
| Publish the whole plan at each revision | A single fetch brings a disconnected branch up to date. Replaying a stream of missed commands would make recovery depend on its history. |
| Save a claim before lowering the music | A restart can cost the branch the rest of an announcement. It avoids starting the same occurrence again when the claim survives. |
| Budget speech against the next twenty-four hours of branch opening time | I spend the speech budget on offers the branches have time to play. Voicing every incoming discount would spend it on unused audio too. |
| Store a digest of each device credential | I can revoke or rotate one branch device independently. If its credential is lost, I have to issue a new one. |
What one branch reported
During the November 2026 measurement window, one registered branch was active. Its player reported 500+ completed announcement plays along with music hours and prayer silences. The field evidence gives the window and distinguishes published occurrences from completed plays.
To check that the playback protections really protect anything, I removed the pre-play claim and the hash checks one at a time and watched their tests fail.

