tantr

One envelope

Every message between a tantr app and a server has the same shape. That one decision is what lets a server drive an app without a release.

4 min read

A tantr app and its server exchange one thing: envelopes. A form definition coming down is an envelope. The filled form going up is an envelope. A chat message, a notification, a card, a read receipt: all envelopes. There is no second kind of message.

What is on the envelope

FieldWhat it is for
An identityUnique to this message. A receiver that has seen it before drops the copy.
A typeProfile and kind, such as collect.submission. It names the shape of the contents.
A versionThe version of the contract the contents follow.
A time and a directionWhen it was made, and whether it is going up to the server or down to the app.
Where it came fromApp or server, and for an app: the device, the session, the app's version and the language.
The contentsChecked against the schema the type names.

Two optional fields tie messages together: one says which message this one answers, and one groups messages into an ordered conversation.

Sixteen types

The whole contract is sixteen types of envelope. Each profile has two or three: a definition and a submission for collect, a card and a refresh for insight, a request and a response for act. A few belong to no profile: the first message of a session, a change of configuration, an acknowledgement.

Each type has a schema that says exactly what its contents may hold, and a set of example messages that are known to be valid. The schemas do not allow extra fields. A server that needs something the contract lacks proposes a change to the contract. It does not send the field and hope.

Delivered once, eventually

A phone loses its connection constantly. A tantr app does not send a message and wait. It puts the envelope in a queue on the device, and the queue sends it when there is a road, and sends it again if no acknowledgement comes back. Because every envelope has its own identity, the server can receive the same one three times and store it once.

So a user on a train fills a form, the screen says it is saved, and it is. It leaves the phone when the tunnel ends.

The road is not part of the contract

The envelope does not care how it travels. The same envelopes move over ordinary web requests, over a held-open connection for chat, over a push notification, or inside one process in a test. A product chooses its roads. Nothing above the queue changes.

This is also how the rule "the screen never breaks" is kept. With no server at all, an app runs from example envelopes bundled with it. A founder can see their own words in a working app before any server exists.

Changing it

The contract has a version with two numbers. Adding an optional field or a new type moves the second. Removing or renaming anything moves the first. An app ignores fields it does not know, so a newer server does not break an older app.

The order of work is fixed and written down: the contract's document changes first, then the schemas and examples, then the code. The reverse order, code first and the contract catching up, is how two sides of a system drift apart.

Why one shape

Because everything is an envelope, everything that handles envelopes is written once: the queue, the retry, the duplicate check, the log line, the test that replays a conversation. And any server, in any language, that passes the conformance tests can drive any tantr app. The contract is the product. The apps are evidence that it works.

How a new product is made from all this is the next article.

Request access

What is collected, and why