Most team invite flows start as a table with three columns: email, token, team_id. It works in the demo. Then someone leaves a company, an invite goes to the wrong address, a hiring freeze cancels an onboarding, and you find out that "delete the row" was never a real revocation.
Here is the design we ended up with, and the parts that are easy to get wrong.
The state machine comes first
An invitation is not a boolean. It has at least four states:
pending: created, email sent, nothing confirmed
verified: the invited address proved it can receive mail
accepted: the invitation was consumed and the user joined the team
revoked: an owner killed it before it was accepted
Two rules make the rest of the design fall out of that list.
First, accepted and revoked are terminal. Nothing transitions out of them. Second, only a pending or verified invitation can be accepted, and acceptance is a single atomic step: mark accepted, create the membership, done.…