Website and account portal
Understand static routing, email sign-in, account sessions, downloads, and bounded request handling.
Routing#
The website Worker routes Try requests first, handles its explicit account and checkout endpoints, and then delegates ordinary pages to the static asset binding. Documentation pages are static assets under /docs/; they do not need access to account session data.
Mutating browser requests are checked against the configured public origin. JSON parsing uses a bounded request reader, including when a content-length header is absent. Errors return a controlled message rather than a stack trace to the browser.
Email sign-in#
A sign-in request normalizes the email address, applies rate limits, and gives a generic response. For an eligible customer, the service generates a one-use token, stores its hash, and sends a link. The inspected source gives the link a 15-minute lifetime.
Verification atomically consumes an unused, unexpired link. The service then creates a session whose hash is stored in D1 and returns a Secure, HttpOnly, SameSite=Lax host-only cookie. The source uses a 30-day session lifetime. Logout removes the stored session and expires the cookie.
Account data#
An authenticated account response selects licenses associated with the session's normalized email address, their active sites, plan labels, and available package downloads. Private account responses use no-store headers. The download bundle comes from the update service through its separately authorized portal integration.
A customer account response can contain its license keys and signed downloads. Keep those values out of public screenshots, documentation examples, analytics, and shared caches.
Email transport#
The website supports its configured transactional email provider. Delivery runs as a background operation after the request has passed validation. A generic success response is not proof of inbox receipt. Delivery errors are recorded without logging the full sign-in token.
Files#
src/index.js owns routing and account operations. src/request.js supplies bounded body parsing. src/stripe.js owns sandbox billing reconciliation. src/try.js owns the Try it redirect and the release blueprint and packages that the hosted demo installs. Static account UI assets call these endpoints with the current session.