← All posts

launch week, release 05

· the primitive team

an address on primitive was already a dispatch pattern, not a mailbox. but a verified domain still routed bluntly: every email fanned out to every endpoint that matched. you couldn't say one address goes here and the rest go there, and you couldn't see where a message would land until it already had.

today that changes. custom routes let you send each address exactly where it belongs, and check where any email will go before it gets there.

bind an address to a destination

a route points a recipient pattern at one endpoint. give it an exact address and a function, and primitive mints the endpoint and binds it in the same step:

primitive routes create-route --match-type exact \
  --pattern billing@acme.dev --function-id <function-id>

from now on, mail to billing@acme.dev goes to that handler, and nothing else does.

catch everything else

send the rest of the domain somewhere with a wildcard. give it a lower priority, so the exact rule is checked first and the specific address always wins:

primitive routes create-route --match-type wildcard \
  --pattern '*@acme.dev' --priority 200 --endpoint-id <endpoint-id>

matching is deterministic. routes are checked by priority, then by how specific they are (exact before wildcard before regex), then by age to break a tie. the first one that matches wins, and every email resolves to a single endpoint. nothing fans out anymore. regex is there too, for the patterns a glob can't express.

see where mail goes, and why

this is the part that changes how inbound feels to run. ask primitive where a recipient would land, and it replays your rules and answers one rule at a time, before you've sent anything:

primitive routes simulate-route --recipient sales@acme.dev
{
  "outcome": "matched",
  "matched_tier": "wildcard",
  "matched_pattern": "*@acme.dev",
  "evaluated": [
    { "tier": "exact", "pattern": "billing@acme.dev", "result": "miss",
      "reason": "recipient 'sales@acme.dev' is not 'billing@acme.dev'" },
    { "tier": "wildcard", "pattern": "*@acme.dev", "result": "hit" }
  ]
}

billing@ hits the exact route. everything else falls through to the wildcard. you're not guessing, because this is the same evaluation the delivery path runs, recorded for every email, so you can always answer where a message went and why.

try it

npm i -g primitive
primitive routes simulate-route --recipient <you@your-domain>

routes are live in the api, the cli, and the dashboard. the full reference is at primitive.dev/docs/routing. there's nothing new to adopt. it's email, routed the way agents actually need it.