Tunnels
A tunnel is a journey cut into steps — a sign-up, a checkout, a renewal — whose road can change with what the visitor answers. The package remembers where each visitor stands, lets them through the steps they may see, and sends them back where they belong when they try to skip ahead.
A tree of cursors
A tunnel is built as a tree, not a list. A step reached from two places is two cursors, each with its own hash and its own stored values: that is what lets a branch grow steps another one does not have, and what the way you came, shown at the end of each tunnel, is read from.
A session in the database
Opening a tunnel creates a session, which the browser session only knows by its id. It holds the values the steps store, and expires a day after the last step shown — or sooner, when that step asks for it. Expired sessions are dropped by the scheduler, every 15 minutes; completed and pending ones are kept.
Where the visitor may go
Every step decides whether it can be shown and where to send the visitor otherwise. Links and buttons are drawn with the same rules, so a link never leads to a redirect back: no next button where the road parts, no way back past a payment, nothing to go back to in a closed session.