Upgrading
What this covers: every release that can change what an app or a deployment does, newest first, with what to check for each. A release that only adds things is not listed; the changelog has those. Read from the version you run up to the one you are installing.
Before 1.0 a minor version could break an app, and each breaking change is listed here with its fix. From 1.0 on, API stability says what a minor version may not do.
The four artifacts — the Go module, borgo-framework, create-borgo and borgogen — carry one version and are upgraded together:
go get github.com/LuigiDavideMicca/borgo@latest && go mod tidy
bun add borgo-framework@latest
bun run build
Both halves at the same version: a scaffold from 1.0 on pins the Go module in go.mod to the version of borgo-framework in package.json, and an older one left it to go mod tidy.
bun run build regenerates .borgo/api-types.d.ts; commit it. A type error after an upgrade is usually the upgrade telling you something, and the sections below say what.
1.1#
A minor under the stability policy: what 1.0 marked stable is unchanged, and everything this release adds is marked provisional in the API reference. No file an app is made of changes, and no environment variable an app already sets changes meaning.
Most of the release is additive and does nothing until asked for: /readyz and borgo.Ready, BORGO_SHUTDOWN_DELAY, the access log and BORGO_LOG_FORMAT, borgo.RequestID and borgo.Log, SESSION_SECRET_PREVIOUS, borgo.WithSession, links in a page's head, the test helpers borgotest and borgo-framework/testing, borgo.Limit, borgo.OnPanic, Auth.OnEvent and Auth.Rehash, borgo.RenewSession, borgo.NewCounter and the new series on /metrics, borgo.BindValid and borgo.Invalid, ApiError.fields(), Uploads.ServePreview, once on a loader's context, the second argument of a head function and head.lang, the ErrorBoundary export, onClientError and onServerError, BORGO_SOURCEMAP, BORGO_HOST, BORGO_HSTS, BORGO_PERMISSIONS_POLICY, BORGO_MAX_INFLIGHT, BORGO_HANDLER_TIMEOUT, borgo.FanOut and borgo.Deliver. An app that uses none of them is not touched by them.
The rest can be noticed without asking. In order of how likely each is:
Code that may stop compiling#
A LoaderContext built by hand needs once. The context a loader is handed gained a field. A loader is untouched; a test that calls one with an object literal typed LoaderContext no longer compiles until the literal has it:
import type { LoaderContext } from "borgo-framework";
declare const rest: Omit<LoaderContext, "once">;
// a stand-in that shares nothing, which is all a single loader under test needs
const context: LoaderContext = { ...rest, once: async (_key, load) => load() };
Nothing else in the release narrows a type or removes a name.
Behaviour a deployment can run into#
/metrics answers 404 to a request that came through a trusted proxy. With BORGO_METRICS=1, what a proxy forwarded came from outside, and is told there is no such page. With BORGO_TRUSTED_PROXIES set, that is every request from a peer the list names; unset, every request from a loopback or private peer that carries a header a proxy adds, X-Forwarded-For among them. A scraper that reaches the port itself, carrying none, is answered as before. If yours goes through the reverse proxy, or scrapes from an address the list you set names, it now gets a 404: set BORGO_METRICS_TOKEN and send it as Authorization: Bearer, after which the token is the only rule. See health and metrics.
The sign-in limit counts an IPv6 address by its /64. Ten failed sign-ins a minute used to be per address, and one IPv6 customer line holds a /64 of them. Now the whole /64 shares one count, as an IPv4 address always did. Visitors on one IPv6 network — an office, a mobile carrier that hands a /64 to many — share an allowance they did not share before; BORGO_LOGIN_ATTEMPTS is the number to raise if that is your audience.
Every response carries Cross-Origin-Opener-Policy: same-origin-allow-popups. A page from another origin that opens a page of your app no longer shares a window handle with it: window.opener is null on your side. Windows your own pages open are unaffected, which is why the value is not same-origin. An app that is meant to be opened as a popup by other sites, and answers them through window.opener, sets the header itself on that route — unsafe-none — since a header already on the response is left alone. See security.
An inbound X-Request-Id is replaced unless a trusted proxy sent it. Every request on the public port now has an id, on the response and on the request your handler reads. A handler that read a client's own X-Request-Id header now reads borgo's, unless the peer is a proxy borgo trusts — one BORGO_TRUSTED_PROXIES names or, with it unset, any loopback or private address — and the value is a plain id.
/readyz is the front's. The path is answered before any page, as /healthz is. A page at pages/readyz.tsx is no longer reachable.
borgo.Push refuses the event name __count. It is the relay's own event, sent when a topic's subscribers change, and a browser's publish of it was already dropped. A Push of it now returns an error where it used to be delivered.
Behaviour a page can run into#
Every page is rendered inside an error boundary. A page that throws while rendering in the browser used to leave an empty document; it now shows a notice with a reload button, or the page's own ErrorBoundary export, and the layouts stay. Two consequences. A boundary of your own placed in a layout no longer sees a page's rendering error, because borgo's boundary is nearer to the page: export ErrorBoundary from the page for what is shown, and register onClientError for what is reported. And an end-to-end test that waited for a blank page after a crash waits for [data-borgo-error] instead. See a page that throws in the browser.
Focus moves to the heading after a client navigation. The first <h1> in the rendered tree — or the first <main> — is focused once the new page is on screen, and the title is announced to screen readers. What may be visible: the browser's focus ring on that heading, a tabindex="-1" attribute on it that a DOM snapshot will now contain, and a visually hidden #borgo-announcer element at the end of <body>. Code that moved focus itself after a navigation runs beside this and should be removed or checked; there is no switch. A page in which an input already holds the focus is left alone. See client navigation.
A tab open across a deploy loads its next page whole. The props a client navigation fetches now carry the name of the build that made them, and a tab running another build hands the address to the browser instead of rendering new data with old components. The visitor sees one full page load, and state held in memory by a layout is lost with it, where before they saw a client transition that might have rendered wrongly. The ?__borgo=props answer gained a build field for this; it is internal, and nothing should have been reading it.
Templates#
Nothing to take from a fresh scaffold. The generated .borgo/client.tsx changed — it hands React's Component to the runtime, for the boundary — and bun run build regenerates it.
Checklist#
-
bun run build, and give any hand-builtLoaderContextin tests aonce - the Prometheus scraper reaches
/metricsdirectly and from an address that is not a named proxy, or sendsBORGO_METRICS_TOKEN - no page of yours is opened by another origin and reads
window.opener - no handler relies on an
X-Request-Idthe client chose - no page lives at
/readyz - error reporting that relied on a boundary in a layout moved to
onClientError - the heading's focus ring after a navigation looks intended
- behind a load balancer: its health check moved to
/readyz, andBORGO_SHUTDOWN_DELAYcovers its probe interval
1.0#
The first release under the stability policy. What the API reference marks stable does not break within 1.x; what it marks provisional is new in this release and may still change in a minor, and each such change will be listed here.
Nothing here changes the topology or the files an app is made of. Most apps upgrade with no edit. The changes, in order of how likely each is to be noticed:
Code that may stop compiling#
The login, register and signup routes have types. api("POST /api/login", ...) and the routes mounted on RegisterHandler and borgo.Signup returned unknown and accepted any body. They now answer with what your Auth.Principal returns and take borgo.Credentials (or your signup form). A caller that passed something that is not a string compiled before and does not now — typically a form field read without a conversion, passed as the body:
declare const form: FormData;
// before: compiled, and sent a File if the field was one
const before = { username: form.get("username"), password: form.get("password") };
// after
const after = { username: String(form.get("username") ?? ""), password: String(form.get("password") ?? "") };
A cast you wrote around the answer (as Me) is now redundant and can go. See auth and sessions for when the type is read and when it stays unknown.
Two exports moved off the root entry. CSRF_COOKIE and browserEnv were exported from borgo-framework and are generated code's business, not an app's. They are now on borgo-framework/internal. An app that imported either was reaching into the framework; CSRF_FIELD and csrfCookieValue, which an app may need, stay where they were.
borgo.WriteJSON is deprecated. It still works. borgo.JSON is the typed writer the bridge reads, and borgo.Error writes a refusal; staticcheck will point at the remaining calls.
Behaviour a deployment can run into#
Sign-in attempts are limited. LoginHandler answers 429 with Retry-After to an address that has failed too often: 10 failed sign-ins a minute by default, BORGO_LOGIN_ATTEMPTS to change it, 0 to turn it off. The address is the peer, or what a proxy you trust forwarded — set BORGO_TRUSTED_PROXIES if yours is not on loopback or a private range, or every visitor behind it shares one count. A login form should show the 429 as "try again in a minute", not as wrong credentials.
Open connections are counted. WebSockets and SSE streams are capped per process, 10 000 each by default (BORGO_MAX_SOCKETS, BORGO_MAX_STREAMS). Past the cap a new one is answered 503 with Retry-After and the client's own reconnect tries again. A deployment that legitimately holds more raises the number; one that never came near it sees nothing.
Strict-Transport-Security is sent when SESSION_SECURE says the site is HTTPS: max-age=31536000, without includeSubDomains. If part of the same host must still answer plain HTTP, know that browsers will stop requesting it over HTTP.
A cached page has a size limit. A page with revalidate whose document is larger than 8 MiB is rendered for each request and not kept, and the response carries X-Borgo-Shared-Too-Large.
An Auth without Lookup used to answer a sign-in by panicking. It now answers 500 and says what is missing.
Behaviour a page can run into#
A handler passed to subscribe that throws is no longer swallowed. The exception reaches the page — the console, your error reporting — where before the event was dropped in silence. Code that relied on that silence has a bug it can now see.
subscribe keeps the last 100 publishes made while the socket is down, not all of them. A tab that was offline for an hour no longer replays the hour.
subscribe reconnects with jitter. Each wait is between half of its step and the whole of it (0.5–1 s, 1–2 s, … up to 30 s), so the clients a restart dropped do not come back in one wave. A test that pinned the exact delays pins a range now.
A bare <a href="#"> is left to the browser. It used to refetch the page's props.
A page reached through a rewrite hydrates as the page that was rendered, not the one its address matches. If you worked around a hydration mismatch after a middleware.ts rewrite, the workaround can go.
Templates#
A project scaffolded before 1.0 keeps its own Dockerfile, which copies a fixed list of directories into the image. If your app has a directory besides components/, islands/ and lib/ that pages import from, the image builds and the page fails on its first request: take the copy step from a fresh bunx create-borgo@latest, which copies everything except Go's sources and the build's own files.
Checklist#
-
bun run build, and fix whattscnow says about the login and signup calls - no import of
CSRF_COOKIEorbrowserEnvfromborgo-framework - the login form shows a 429 as a wait, not as a wrong password
-
BORGO_TRUSTED_PROXIESnames your proxy if it is not on loopback or a private range -
BORGO_MAX_SOCKETS/BORGO_MAX_STREAMSraised if you hold more than 10 000 of either - no part of the host needs plain HTTP, now that HSTS is sent
0.30#
The topology changed: the Go binary answers the public port and the Bun process renders behind it. An app's code is untouched; a deployment has five places to check. The release has a guide of its own.
Before 0.30#
Versions before 0.30 are not supported and have no upgrade path other than through 0.30: follow its guide first, then this page.