Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Worker Backed Models

A Model backed by no environment binding is referred to as a “Worker Backed Model”, or sometimes “a backing-less Model”.

Their fields are sourced from route parameters in a request URL.

For example:

model Gnat {
    route {
        id: int
        buzzing: bool
    }
}

The Gnat Model sources all data from an incoming request URL, and then disappears after the request is complete. It has no backing store, and no persistence.

Tip

Worker Backed Models can have any number of KV or R2 fields, using the route parameters to hydrate those fields. You can even have navigation fields!