Repository navigation
Releases
v1.1
v1.1 — the release for the day after launch
1.0 was about writing an app. 1.1 is about running one: behind a load balancer, with a log a machine can read, a key that can be rotated, a scraper that needs numbers, a second instance, and something to tell whoever is on call when a page throws.
It is a minor release under the stability policy. What 1.0 marked stable is unchanged. Everything new is marked provisional in the API reference, and almost all of it does nothing until you ask for it. Every one of the few things you can notice without asking is listed under Upgrading from 1.0, at the end of these notes.
go get github.com/LuigiDavideMicca/borgo@v1.1.0 && go mod tidy
bun add borgo-framework@1.1.0
bun run buildA new app: bunx create-borgo@latest my-app.
At a glance
| Operate | /readyz and borgo.Ready, a stop that drains, a request id on everything, an access log, JSON logs, metrics you can alert on |
| Protect | session key rotation, borgo.Limit, auth events, password rehash on sign-in, an in-flight cap, a handler timeout, BORGO_HOST, an opener policy, HSTS and Permissions-Policy as settings |
| Scale out | borgo.FanOut and borgo.Deliver, so Push reaches every instance |
| Forms and APIs | BindValid and Invalid, ApiError.fields(), WithSession, Uploads.ServePreview |
| Pages | an error boundary around every page, onClientError and onServerError, production source maps, once() for loaders, head.links and head.lang, focus and an announcement after a client navigation, a safe next page after a deploy |
| Test | borgotest for handlers, borgo-framework/testing for loaders and actions |
| Verify | an independent verifier, mutation tests on the core, every page of the docs read against the code, a new benchmark campaign |
Operate it
/readyz, borgo.Ready, and a stop that drains
/healthz says the process is alive, and says so with a 200 whatever else is true. A load balancer needs a status it can act on, and had none; and on a stop signal the listeners closed at once, while the balancer was still sending.
/readyz answers 200 when the render service is reachable and every check the app registered passes, and 503 otherwise:
borgo.Ready("database", func(ctx context.Context) error {
return db.PingContext(ctx)
})It names what failed and never why: the reason goes to the log, once when a failure begins and once when it ends. A check runs on every probe and has two seconds to finish. One that hangs or panics is a failure, not a held probe, and the probes that arrive while a check runs share that one run.
BORGO_SHUTDOWN_DELAY is how long the process goes on serving after a stop signal, with /readyz already at 503 — the time a balancer takes to stop sending. Unset, a stop is what it was in 1.0. Behind a balancer, point its health check at /readyz and set the delay to cover its probe interval.
A request id, an access log, logs a machine can read
Every request on the public port has an id now: on the response as X-Request-Id, on the request your handler and the render service see, in borgo.RequestID(r), and on every record borgo.Log(r) writes. A loader's API call carries the id of the page's request, so one page view is one id across both processes.
A proxy borgo trusts may name the request, so the id is the one already in the proxy's log. From anybody else an inbound id is replaced: a caller who chooses the id can write another request's name into your log.
BORGO_ACCESS_LOG=1writes one record per request when it ends: method, path without the query, route, status, bytes, duration, client.BORGO_LOG_FORMAT=jsonmakes every line the Go process writes a JSON object — borgo's and the app's, throughlogorslog. The render service's own output is not reformatted;onServerError, below, is how that reaches a collector.
Both are refused at boot when the value cannot be read.
Metrics you can alert on
/metrics, which exists when BORGO_METRICS=1, used to say how many requests there had been and how long they took, and nothing about how close the process was to its limits. It now carries the requests in flight, the sockets and streams held against their caps, the handlers that panicked, the sign-ins the limit turned away, the requests the in-flight cap refused, the handlers that ran out of time, the goroutines and the heap — and counters of your own:
var signups = borgo.NewCounter("app_signups_total", "accounts created")
signups.Inc()It also lists every route of the app, and it used to answer anyone: behind the generated proxy config, that meant the whole internet. A request that came through a trusted proxy now gets a 404, while a scraper that reaches the port itself reads the page as before. BORGO_METRICS_TOKEN asks for a bearer token instead, wherever the request comes from.
Protect it
SESSION_SECRET can be rotated without signing everybody out
One key signed and verified, so a new key invalidated every cookie, and a rotation policy meant a mass logout on a schedule. SESSION_SECRET_PREVIOUS names the keys that signed before, comma-separated. A cookie one of them signed is still read; nothing is signed with them again. Move the current key there, set a new one, and take the old one out when the longest session it signed has run out — or at once, when the key leaked and signing everybody out is the point. A previous key too short to be a key is refused at boot.
borgo.Limit, for your own routes
The docs had a recipe where there was no function:
limited := borgo.Limit(30, time.Minute, borgo.ByClient)
mux.HandleFunc("POST /api/invites", limited(SendInvite))Past the count, a key gets 429 with Retry-After until its window ends. ByClient counts an IPv6 address by its /64, and so does the built-in sign-in limit now: counted per address, one customer line held as many allowances as it had addresses. The sign-in limit also counts an attempt when it is let in, not after the password has been checked, so a burst of guesses sent together can no longer all be checked.
Hooks for sign-in, sign-out and panics
Auth.OnEventis told of every sign-in, failure, refusal, sign-out and new account: the audit log, the "new sign-in" mail, a lockout of your own.Auth.Rehash: a password hash made with fewer rounds than today's is replaced at sign-in, the one moment the password is known. The default hasher supports it.borgo.OnPanichands a handler's panic to whatever pages somebody, besides the log line and the500.borgo.RenewSessionwrites a session again once it is old enough: a session that lasts while it is used and ends after it is not.
A cap on requests in flight, and a time for a handler to finish in
Both off unless asked for.
BORGO_MAX_INFLIGHTis how many API requests are served at once. Past it, a request is answered503withRetry-Afterimmediately, instead of joining a queue that makes every request slow and the process large.BORGO_HANDLER_TIMEOUTis how long a handler has. When it passes, the request's context ends with a cause that says why, and a request whose handler wrote nothing is answered503. A handler that answers late keeps its own answer. One that ignores its context is not stopped, because nothing in Go can stop it.
An event stream is neither counted nor timed, /ws does not come through either, and /healthz and /readyz are outside the cap, so a full server can still say it is alive.
Headers and interfaces
BORGO_HOSTnames the interface the public port listens on.127.0.0.1keeps an app that sits behind a proxy on the same machine from also answering on its own port. A value that is not an IP address refuses to start. Unset, nothing changes.Cross-Origin-Opener-Policy: same-origin-allow-popupsis on every response. A page opened by another origin gets no handle on your window (window.openerisnull), and the popup an OAuth sign-in opens still reaches the page waiting for it.BORGO_HSTSsetsStrict-Transport-Securityindependently ofSESSION_SECURE:0behind a proxy that sends its own,1to send it even thoughSESSION_SECUREis unset, or the whole value when you can promiseincludeSubDomainsorpreload.BORGO_PERMISSIONS_POLICYis sent as written. There is no default on purpose: a guess would turn a camera or a map off in somebody's product.
Scale it out
FanOut and Deliver: Push with more than one instance
The realtime relay lives in the process, so Push reached the sockets of that process and no others. With two instances behind a balancer, half the room heard nothing, and nothing in borgo could be done about it.
borgo.FanOut sets where Push sends an event instead — a bus every instance listens on — and borgo.Deliver is what the listening end calls to hand an event to the sockets of its own process. With a FanOut set, Push delivers nothing itself: the bus brings the event back to every instance, the sender among them. borgo chooses no bus: Redis, NATS, Postgres LISTEN, whatever you already run. An event no socket could carry is refused before it crosses, and a bus that cannot be reached fails the Push instead of telling half the room.
The new guide, more than one instance, covers the rest of what a second instance changes.
Forms and APIs
BindValid and Invalid: one shape for a form that is wrong
Every app with more...
v1.0
borgo 1.0 — a promise, in writing
Every release so far has said the same thing in small print: this may change. It was the honest thing to say. A framework that has not yet been leaned on does not know which of its walls are load-bearing, and promising otherwise is how you end up maintaining your mistakes forever.
1.0 is the release where the small print comes off. Not because the work is finished — it is not, and these notes say further down what is missing — but because the surface has now been used hard enough for us to know which parts of it we would defend. So we went through it one entry at a time and decided.
What the number means now
The API reference lists every Go and TypeScript export, environment variable, CLI flag and file convention, each with a marker.
41 entries that said provisional now say stable, which brings the stable total to 186. Stable means what the stability policy says it means: it does not break inside 1.x. Not renamed, not given a different type, not quietly given a new default.
The small print stays on eighteen entries: the things this release adds, which nobody outside the framework's own tests and example app has built on yet. They are supported and documented, but a minor version may still change them, with a migration note. We would rather say that than pretend.
To get there, the open questions in the reference each got an answer instead of a footnote. WriteJSON is deprecated in favour of the writer the typed bridge can read. Two exports that only generated code ever needed have moved from the root entry point to borgo-framework/internal. One helper that existed twice exists once.
We built the app again, and it asked for a frame
The chat app that found eighteen things wrong with 0.22 was rebuilt on 0.30, and its friction log is where most of this release comes from. The loudest entry was about layouts.
A _layout.tsx received children and nothing else. That was deliberate — no waterfall — and it was wrong for any app whose frame is data: which workspace, which rooms, who is here. Every page fetched the same sidebar and wrapped itself in it, so moving from a room to the people list unmounted the frame: two WebSockets closed and reopened, presence restarted, the sidebar lost its scroll position.
A layout can now have a loader.
export async function loader({ api, params }: LoaderContext) {
const { rooms } = await api("GET /api/w/{slug}/rooms", { params });
return { rooms };
}
export default function Frame({ children, rooms }: LayoutProps<typeof loader>) {
return <div><Sidebar rooms={rooms} />{children}</div>;
}The loaders of a route — every layout's and the page's — start together, so another level of layout does not add a round trip. The layout stays mounted from page to page. And a layout that redirects signed-out visitors does so for every page beneath it and for their form actions.
That last clause was not in the first version. An independent reviewer, handed the guarantees and not the code, found that a layout could refuse a visitor and the page's action would already have run. The same review also found that a page loader could overwrite the layouts' props by returning the right key, and that the error page disappeared when the frame around it was the thing that had failed. All three are tests now. The feature is the better for having been broken first.
The rest of what the app asked for
api()in the browser, the same typed client a loader gets, CSRF header attached.navigate()andrevalidate(), for the navigation no link expresses.borgo.Disconnect, for the sockets a removed or demoted user still holds open, withborgo.Subscribersandborgo.OnPublishbeside it.- The login, register and signup routes are typed. They were the three routes every app has and the only ones the bridge returned
unknownfor.borgogennow reads what yourAuth.Principalreturns — and leaves the typeunknownwhenever your code could have changed it after the declaration, because a wrong type is worse than none. borgo.Error,Uploads.SaveReader,ApiError.json(): three helpers the app had written for itself.
What a server gets without asking
A sign-in endpoint that stops listening to an address that keeps failing. A ceiling on open WebSockets and event streams, answered with 503 and Retry-After instead of with memory. Strict-Transport-Security wherever you have told borgo the site is HTTPS. A page cache that will not hold an 8 MiB document for everyone.
None of it needs configuring. All of it can be configured.
Things that were simply broken
A page's server code could reach the client bundle if the app directory was opened through a symlink or with the drive letter in a different case. A tab that had been offline for an hour replayed the hour. A bare <a href="#"> refetched the page. Every scaffolded Dockerfile copied a fixed list of directories, so an app with one more built its image and failed on the first request. A scaffold pinned its Bun half to a version and left its Go half to chance.
The fuzz targets, it turned out, had never been fuzzing in CI: go test runs them on their seeds and stops. They run for real now, on every push — and the first thing real fuzzing found was a test of ours whose property was too strict.
What is not in 1.0
Request IDs, an access log and structured logging. Test helpers for people writing apps. Benchmarks on the new topology, which the 0.30 notes promised and which we still owe. They are the plan for 1.1, and none of them needs a breaking change to arrive.
Upgrading
- Bump
borgo-frameworkand the Go module together, as always, and runbun run build. - If
tscnow objects to your login or signup call, it has found a form field you were sending without converting it to a string. It is right. - Show a
429from the login route as "try again in a minute", not as a wrong password. - Read the upgrade guide: it has the full list and a six-line checklist.
Most apps will not need to change a line.
A version number is a promise a framework cannot take back. It took us all of 0.x to be ready to make this one.
— Luigi
create-borgo: v1.1.0
v0.30
borgo 0.30 — changing of the guard
Since the first release, the process standing at borgo's gate was the wrong one.
Bun answered the public port. It served the files, rendered the pages, and every time a request wanted data it walked over to the Go binary in the back, knocked, waited, and walked the answer back out. It worked. It was also a guard with no authority: the sessions, the permissions, the data — everything that decides who may come in — lived in Go, one process away from the post where the decision had to be made.
0.30 changes the guard. The Go binary now stands at the gate and owns the public port: static files, the page cache, /api, /ws, the security headers, CSRF, the body limit. Bun steps back to do the one thing it is superb at — rendering React — as a service on loopback that answers only requests carrying a key the front minted for this boot.
0.2x browser -> bun :3000 -> go :3501
0.30 browser -> go :3000 -> bun (a free loopback port)
`-> /api/* answered in this same process
The version jumps from 0.22 to 0.30 so that nobody mistakes this for a patch. Your app's code does not change — pages, loaders, actions, handlers, the typed client, sessions, all as they were. What changes is the shape of a deployment, and the upgrade guide walks through the five places it can bite, ending in a ten-line checklist.
Why we turned the house around
It would have been easier not to. 0.22 was fast, tested and published with its benchmarks. But three things kept pointing at the same wall.
Every API call crossed a process boundary. A loader asking for data went browser → Bun → Go → Bun → browser. Around that hop grew machinery nobody wants to own: a proxy, a retry buffer, forwarded-header bookkeeping, keep-warm pings, a separate timeout for "waiting for the API", a fetch pool that had to be raised before the process started. None of it was the product. All of it was the price of standing in the wrong place.
Security decisions were made far from the facts. The app's authority lives in Go. A guard written in front of it, in another language, in another process, has to either re-ask or guess. The worst bug 0.22.1 owned up to — a WebSocket topic anyone could read — lived precisely there: in a relay that held the sockets but knew nothing about who was on the other end.
The edge belonged to the process least suited to it. Serving bytes from memory, terminating thousands of idle connections, holding a page cache under contention, enforcing limits before a body is read — that is what net/http was built for, and what we were re-implementing in JavaScript.
So we inverted it: the authority stands at the gate, and the renderer renders. One process decides; one process draws. Moving the edge let us delete about three thousand lines from the Bun side in a single step — the proxy, the keep-warm, the forwarded-header plumbing, the API timeout, the metrics duplicate — because the thing they existed to bridge was gone.
How much work that was
This release took six weeks and eight phases, and every phase followed the same discipline: design written before code, one step per commit, a test that fails without the fix, a mutation that proves the test would notice, and a separate adversarial reviewer who did not write the code and was asked to break it.
- Phase 1 moved the edge: static files, security headers, limits, the page cache with its doctrine intact,
/healthzand/metrics, then the orchestration ofdev,startandexport, then the deletions. - Phase 2 put guards on both sides of the wall —
api/middleware.go,middleware.ts— and built the typed bridge from TypeScript to Go. - Phase 3 rewrote realtime in Go, from the WebSocket protocol up: handshake, frame reader, close codes, the relay, per-topic authorization. The protocol code was fuzzed with over four million inputs and every function went through mutation testing before a socket was opened in anger.
- Phases 4 to 7 measured the new topology, added what an app with users needs on day one, and rewrote the docs — including a getting-started guide rebuilt from scratch and run end to end.
- Phase 8 sent four hunters at the finished tree and rebuilt a real application on it.
By the end: 1,555 TypeScript tests, 590 Go tests, 87 real-browser end-to-end runs, well over five hundred mutations killed across the release, and the environment parser held to its JavaScript twin across more than a hundred thousand fuzzed values — Go is never allowed to accept a value the render service would refuse.
The hole 0.22.1 warned about is closed
0.22.1 opened with a warning we did not enjoy writing: a WebSocket topic was a public broadcast channel. From a client with no cookie, no account and no membership, we guessed channel:3 and read a private room.
In 0.30 the relay lives in the Go process, behind api/middleware.go and the same session verification as every page, and every topic a socket asks for is put to your app first:
borgo.CanSubscribe(func(r *http.Request, topic string) bool {
return userMayRead(r, topic) // the session is already verified here
})Once per topic, at the handshake. A refused topic closes the socket with 4403 and its name. And the default is the safe one: under borgo start, with no rule registered, every subscription is refused, and the banner says why until you write one. borgo.Push is now a function call into that relay rather than a request across processes — there is no push key left to leak, and the two variables that used to hold one refuse the boot by name.
The app that found the hole, run against 0.30: the owner's socket hears the private channel, a stranger's socket is closed with 4403, a forged publish reaches nobody.
Guards on both sides of the wall
api/middleware.go stands in front of everything the app serves — pages, files, cache, /api, /ws — and borgogen finds it by name. What it learns travels to the page through borgo.With, borgo.Value and borgo.Forward, and arrives as ctx.locals.
middleware.ts guards a page on all three of its doors at once: the document, the props a client-side navigation fetches, and the form action. That last sentence is where most hand-written guards fail — the document redirects politely while the JSON door stands open.
//borgo:export is the bridge the other way. Mark a Go function and it becomes a typed TypeScript call, so the page middleware can ask Go does this visitor belong to this workspace? without a hand-written endpoint. It runs over loopback with the boot key; the spike that preceded it measured a median call of 0.089 ms.
Sessions can be revoked. They record when they were issued, and borgo.CheckSession lets the app refuse one — "sign out everywhere" in a single function, proved in the end-to-end suite with two browsers.
What an app with users needs on day one
borgo.Signup— a register handler for a form of your own shape, with an email, a display name, whatever you need. It asks the form'sValidate()before it pays for a password hash, and answersborgo.Refuse(409, ...)in your words rather than ours.borgo.BindMultipartandborgo.Uploads— an upload the typed client can express, stored under a name the client did not choose, sniffed rather than trusted, served back withnosniff, and shown inline only when a browser cannot execute it.- A database page, and a migration runner in the
fulltemplate — embedded.sqlfiles, one transaction each, a checksum that refuses a migration edited after it ran, and a refusal of any file that would end the runner's transaction halfway. - The typed environment, from Go too —
env/env.gen.gois written fromenv.ts, so the Go half refuses a malformed variable by name, in the same words the render service uses.
We built the app again
0.22.1 came out of an afternoon spent building a workspace chat app on borgo — Postgres, four permission levels, private channels, attachments, realtime, a container deploy — which produced eighteen findings. For 0.30 we rebuilt that same app on the new release, one finding at a time, and counted what it lost.
1,510 lines of code down to 1,433, while adding a page middleware, a Go export and a validator. The hand-maintained WebSocket types, a re-implemented hash semaphore, three copies of the same 401 redirect and most of the upload code are gone, replaced by what borgo now ships. Then the whole stack from nothing, in a container: migrations ran once, the probes for identity, attachments and realtime all held, and a restart kept every file.
The app found two more things in borgo along the way, both fixed before this release. A fix had renamed an app type to dodge a clash with one of borgo's own — we now keep your name and reach it through an alias. And Signup had answered every refusal with a 500, which is where borgo.Refuse was born.
The third hunt
Four independent hunters went at the 0.30 tree with a single instruction: break it. They came back with about forty-five findings. Each was fixed in its own commit with a test that fails without it, and every group of fixes was handed to a fresh verifier — five verification rounds in all, the last of which still found one serious bug (a table named trigger made the migration runner skip every COMMIT after it) and watched it close. The ones worth knowing about:
- An encoded slash could walk around a guard.
/api/admin/x%2F..%2F..%2Fpublicwas/api/publicto the middleware and/api/admin/{id}to the router. A segment whose escapes decode to..is now a400on every port, and a page path holding%2Fis refused before the cache can file one page's render under...
v0.22.1
borgo 0.22.1 — we went and built something with it
0.22.0 shipped this morning, on the back of two hunting waves, 43 killed mutations and a release gate of zero open findings.
Then we spent the afternoon building a real application on it: a workspace chat app — Postgres with migrations, four permission levels per workspace, public and private channels, direct messages, file attachments, realtime, and the three rendering modes in one tree. Not a demo. Something with a schema, an authorization model and a container deploy.
Eighteen findings in an afternoon. This is the patch for the ones that were broken. The ones that are missing need new API and are the backbone of 0.23.
The most important line in this release is a warning
A WebSocket topic is a public broadcast channel. Anyone who can reach your server can subscribe to any topic name and receive everything published there — no session required, and the Origin check binds browsers only, which a curl-class client is not.
We built private channels on borgo.Push, exactly as the docs demonstrate. Then, from a client with no cookie, no account and no membership, we guessed a small integer:
ws://host/ws?topics=channel%3A3
→ {"event":"__count","data":1}
→ {"event":"message","data":{"username":"luigi",
"body":"CONFIDENTIAL: the salary bands for next year are attached"}}
The same channel answers 404 no such channel over HTTP, because the app's own authorization is airtight. It is also completely irrelevant: the realtime path walks straight past it. And __count throws in the number of people in the private room for free.
docs/realtime.md has always said this — in its honest limits section, a hundred lines below where the feature is sold. That is not good enough for a sentence with this consequence, so the warning now opens the section, states what it costs you, and says the fix is the first item of the next release. The README says it too, next to the claim it qualifies.
If you are shipping borgo realtime today: publish only what every visitor may read. Keep private data behind an authenticated route or a per-user event stream until per-topic authorization lands.
Three things that were broken
A second borgo dev no longer corrupts the first. Two sessions in one directory share public/assets and rename each other's chunks mid-build; the loser reports ENOENT on a file that existed a millisecond earlier, which reads exactly like a bundler bug. A lock in .borgo carries the pid and both ports, a second session names the holder and refuses, and a lock whose process is gone is taken over in silence. The liveness check goes through the reading parent-watch already hardened rather than a bare kill probe — a signal refused with EPERM is a live process, and reading it as dead is how you take a directory somebody else is building in.
The file watcher honours .gitignore. An app that writes uploads, a SQLite file or a cache inside its own directory overflows the watcher's event queue — measured at twenty uploads — and an overflow forces a full rebuild that restarts the front server with requests in flight. The grammar read is deliberately literal (a plain name, a bare *.ext, nothing else): a watcher that half-understands gitignore would silently stop watching a directory you are editing in, which is worse than a noisy rebuild.
borgo.WithHashSlot is exported. borgo bounds the password hashes in flight so a login flood cannot pin every core in 600,000 rounds of PBKDF2 — and kept that guard private. Meanwhile Credentials is fixed at username and password, so every app whose sign-up form carries an email must write its own register handler, and every one of them was dropping the protection without being told. Now:
if !borgo.WithHashSlot(w, r, func() {
hash, err = borgo.DefaultHasher().Hash(password)
}) {
return
}And one deploy note the scaffolded compose files now carry: mount a volume at /data, never below it. The Dockerfile creates /data owned by the image user; a volume mounted at a path the image does not contain arrives root-owned, and the app cannot write there.
The part worth reading: three of the eighteen were ours
Findings are cheap when nobody checks them. Three of ours did not survive contact with a reproduction:
- "
borgo devcannot boot from a clean checkout." It boots fine. What we actually had was five of our own orphaned dev servers, accumulated over an afternoon of killing sessions by their ports — which kills the two servers and leaves the watcher above them alive — all rebuilding into one directory and renaming each other's chunks. A framework bug that was our own process hygiene, and the guard above is what it turned into. - "The ISR cache is lost on a container restart." It survives:
hiton the first request afterdocker compose restart. We had measured an empty cache on a container that had never served the page. - "A session issued by the API carries no CSRF cookie, invisibly." It is documented, twice, and deliberate.
All three died the same way: by being reproduced before being fixed. They stay struck through in the log rather than deleted, because a friction log that only shows the hits is a marketing document.
The pattern underneath them is the one this release acts on. borgo's documentation is unusually complete — every warning we needed was already written somewhere. It was just never where the decision gets made. Moving the realtime warning to the top of its own section is the first repair of that; the 0.23 documentation pass is the rest.
What 0.23 is now
The afternoon wrote its own roadmap. Per-topic authorization — a canSubscribe(session, topic) hook answered in Go, where the app's authorization already lives. Middleware, Next-style, which is also the only sane home for per-request authorization: today a role cannot live in the session (nothing revokes it) and cannot live outside it either (nothing runs before your handler). A register handler that accepts an email. Typed realtime payloads for computed topic names — borgo.Push("channel:" + id, ...) generates nothing today, so the one place a real app needs the typed bridge is the one place it does not reach. The environment schema covering the Go half. An upload story. A page about migrations. Plus the performance round: the proxy hop on /api, and 65 kiB per held SSE connection — the two numbers we published against ourselves on the benchmark page, which is a much better motivator than a roadmap.
Shipped in the morning, used in the afternoon, patched in the evening. The village keeps better notes than it used to.
— Luigi
v0.22
borgo 0.22 — the village square
0.20 laid siege to our own walls. 0.21 dragged every claim in front of a hostile second opinion. 0.22 is what a village does once the walls hold: it opens the square.
Two things now live in public. A page rendered once and shared with every visitor — cached, invalidated from Go, and served under a strict CSP that everyone else uses as the excuse not to cache. And borgo's own benchmarks, published on a live page with seven frameworks in the same charts and our biases printed above the numbers.
56 commits. The test suite now counts just under two thousand: 1,558 TypeScript, 288 Go, 75 real-browser end-to-end, 69 holding the benchmark page to its own JSON. Every fix in here was verified by a separate adversary that mutated it and demanded red — 43 mutations across two waves, all killed.
Cached pages, finally — and under a real CSP
The feature every meta-framework calls ISR, built the way this project builds things: guard first, feature second.
export const revalidate = 300; // rendered once, shared for five minutes...
export const tags = ["notes"]; // ...unless Go drops it firstborgo.RevalidateTag("notes") // from the handler that changed the dataOne line per side. Bursts collapse into a single render. A stale copy is served instantly while the new one bakes behind it. Copies persist across restarts under the build id — deploy sweeps, restart comes back warm. And "manual" means your invalidation is the only clock.
The part nobody else ships: borgo puts a nonced Content-Security-Policy on every document, and a nonce is the textbook reason a page "cannot" be cached — one visitor's nonce in everyone's HTML is a broken policy. borgo's stored copy keeps its render's nonce as a substitution key that is never sent, and every replay mints a fresh nonce into body and header together. Two replays, two nonces, one render. You keep the strict CSP and the shared page.
And the guard is paranoid on your behalf: a render that sets a cookie, carries a CSRF token, or errors inside a Suspense boundary is never stored — that visitor gets their own page, and curl can see why. Nothing personal is ever shared. We attacked this with race conditions, torn disk writes, hostile percent-encodings and query floods; the findings section below says what we caught.
Your environment, typed — with a wall the bundle cannot leak through
export const env = defineEnv({
server: { DATABASE_URL: { type: "url" } },
client: { BORGO_PUBLIC_APP_NAME: { default: "tasks" } },
});Declared once. Validated before the server binds — every broken variable refused together, by name, at boot, not discovered one undefined at a time in production. Typed at every read. Client values need the BORGO_PUBLIC_ prefix and reach the browser as one explicit allowlisted object.
Here is the wow, and it is a war story: while hunting we bundled an app and found the entire schema sitting in the served JavaScript — server defaults (read: fallback credentials), validator closures, the full inventory of your server variable names. Build green, secrets shipped. So now client bundles replace env.ts wholesale with a schema-less shim: the wall holds by construction, and CI greps every build for a planted server variable to prove it keeps holding.
Babel left the village
Dev fast refresh now rides Bun's own native transform — the single heaviest dependency in the tree, gone. Edit a component: state survives. Change its hooks: it remounts alone, Next-style. The option is undocumented in Bun, so a test suite pins exactly what the pass must emit; if an upgrade renames it, tests go red by name instead of hot-reload dying mute. Two Bun 1.4.0 emit defects are patched behind invariants that cannot break working code — and each patch's test states its own deletion criterion: the day Bun stops emitting the bug, the test goes green at zero removals and the shim gets deleted.
Also new while we're in quality-of-life: @/ imports are the default (import { db } from "@/db", stop counting ../), and borgo doctor grew its sixteenth check after a mystery worth telling — a dev crash that eight instrumented probes could not reproduce, because the machine had a second, older Bun in ~/.bun that every npm bin shim executed while every probe used the Bun on PATH. Doctor now catches exactly that.
The numbers moved to the square
luigidavidemicca.github.io/borgo — the benchmark page is live, republished by CI on every push, and it is itself a borgo app: exported static, zero JavaScript, charts baked as inline SVG from the committed JSON, with a test suite holding every number on the page byte-equal to the data. The page cannot exaggerate.
Seven frameworks, five contract-pinned scenarios, correctness checked before any load — a fast wrong answer is not a result. And the honesty rules cost us on purpose: every bar is the app's worse of two sweeps, and the run's own failed idle-check renders as a banner above the charts.
What the conservative numbers still say:
- SSR, the scenario a meta-framework exists for: borgo 4,468 req/s — 2× Astro, 7× Next.js self-hosted, at p50 13.5ms against Next's 102ms.
- Ready in 107ms at 54 MiB — for both processes, Bun front and Go api. Next idles at ~86 MiB, Astro at 74.
- Cold start, measured not estimated: 330ms from
docker runto a healthy/healthzin the shipped Dockerfile — scale-to-zero container platforms are officially not scary. - And where we lose, it's printed: Elysia posts 37k req/s on hello-world to our 14k, because every borgo API request crosses a real proxy to a real second process. The pure routers are in the table as the declared floor. We published the chart where we lose. That's the point of the square.
The hunt, round two — the whole village this time
Six adversarial fronts, run blind: the new code and every corner of the legacy — router, SSR, proxy, static serving, dev loop, borgogen, CLI, the Go runtime. Attack the intention, not the code; test the event that never happens.
| Front | Found | Highest |
|---|---|---|
| ISR & request path | 10 | 2 P1 |
| Build, transform, env | 11 | 3 P1 |
| Security perimeter & client runtime | 5 | P3 — everything else held |
| Legacy core (router/SSR/proxy/static) | 2 | P2 — the rest held |
| CLI, scaffolder, Go runtime | 14 | 5 medium |
| Dev loop, borgogen, client libs | 10 | 2 high |
Every single one is fixed. Zero left open — not "documented", fixed; the owner's rule for this release. The trophies:
- The proxy was following redirects server-side. A Go 302 to an external URL came back to your browser as a 200 with the external body — and a 307 POST re-sent the request body and your CSRF token to the target. SSRF plus token disclosure, from Bun's fetch default. One word fixes it (
redirect: "manual"); a hunt finds it. - A client abort during gzip backpressure leaked the compression coroutine forever — measured at 100 aborts out of 100, and backpressure is zlib's normal state. A busy server bled heap on every impatient visitor. Now it provably cannot: the fix exports a pump counter, and the test kills the mutation.
- One spelling per path.
/ne%77s,/news/,/news//— all aliases of/newsper RFC and per borgo's own router, and each was its own cached copy, including one your invalidation would miss. An unauthenticated flood could mint unlimited stored renders of one page. Now the whole alias family collapses at the door with a 308. - The dev loop swallowed its own advice. Api dies → "save a .go file to restart it" → your editor saves identical bytes → the content-hash dedup drops the save → nothing, forever. The exact instructed gesture was the one gesture that couldn't work. Fixed, along with its sibling: the front server dying was 28 seconds of silence under a "ready" banner.
- A Suspense boundary erroring during regeneration produced a 200 of the fallback — which got cached for everyone. A torn disk write served 12 bytes as the whole page after restart.
create-borgo nulscaffolded a directory Windows cannot delete. All of it: found by attack, fixed, pinned by a mutation.
Faster where you feel it
- Production React actually loads in production (the launch environment owns
NODE_ENVnow): +36% on SSR. - The static path stopped holding the event loop hostage per stat: +14%.
- Documents share a pool of gzip streams — native init/teardown was 18% of the SSR profile: +7% at 50 connections, +20% at 10.
- A route no longer pays a disk probe to beat a file that isn't there.
The docs were executed, not proofread
Every command in every doc ran under a separate verifier with its expected exit — 28 commands, and the README pass found the shipped template Dockerfile built green and died on boot (the runtime stage predated two 0.22 files). Only running things finds that. New pages carry decisions with bills attached: why no React Server Components (with the concrete criterion that reopens it), why no serverless (with the measured cold start that softens it), and what the 0.22 transform actually does.
Upgrade notes
- Floors: Bun ≥ 1.4, Go ≥ 1.27. One requirements change, both proven by CI columns that actually run them.
bunx borgo doctornames versions and one-line upgrades. - A route now beats an extension-less file at the same path (
public/aboutno longer shadows the About page). Files with extensions behave exactly as before. borgo startsetsNODE_ENV=productionwhen nothing else did. Set it yourself and borgo doesn't touch it.- Alias URLs 308-redirect to the canonical spelling (
/news/→/news). If something in front of borgo treated thos...
v0.21.0
borgo 0.21.0 — the second opinion
135 commits since 0.20.1. Thirteen of them break something you may be relying on; they are grouped into the eleven changes below, each with the line to change. Nothing here came from a bug report: it came from three weeks of treating borgo's own claims as suspects and executing them.
Read this first: what will break when you upgrade
Each line is the symptom you will see, then the fix.
- Generated request types are renamed and every field is optional.
TaskCreateis nowTaskCreate$Request, andtitle: stringis nowtitle?: string | null— becauseencoding/jsonrequires no field and readsnullinto a non-pointer as the zero value, so the old type rejected bodies the server accepts. Code that builds the object with every field set still compiles; code that names the old type does not. Rungo tool borgogen. - A file referenced beside its own source now fails the build.
import pic from "./pic.svg"next to a page, ornew URL("./pic.svg", import.meta.url), never worked — the bundler emitted a file the browser could not reach, and on the server the document carried your machine's absolute path. Put the file inpublic/and reference it by absolute URL. The error names the file and the line. BORGO_MAX_BODYcounts the bytes that arrive, not a declaredContent-Length. A body that declared nothing used to pass unbounded, and one that lied is now bounded by the smaller of what it declares and what it sends. Default is still33554432(32 MB);0means no limit; anything that is not a whole number stops the boot.- Boolean switches read the
strconv.ParseBoolgrammar and refuse anything else at boot.BORGO_DEV=0used to turn dev mode on;BORGO_CSRF=trueused to turn the check off. Now1/true/tand0/false/f;yesandonstop the boot with the variable named. METRICSandDEVareBORGO_METRICSandBORGO_DEV. No alias.SESSION_SECRETshorter than 32 bytes is refused. A short key is searchable offline from one cookie.openssl rand -base64 48.BORGO_PUSH_KEYdoes not leave the process in clear. A push to aFRONT_URLon plainhttp://to another host now fails with the reason, unless you setBORGO_PUSH_INSECURE=1on purpose. Localhost andhttps://are unaffected. A redirect is never followed: it would hand the key to a host this side never checked.- borgo's own errors on
/apicarry borgo's headers. A 413 or a CSRF refusal now arrives with the security headers and theX-Borgomarker like every other response, so a client that reads the marker to decide whether to reload gets the right answer. - The TypeScript root export is frozen for 1.0.
registerCsrf,registerIslandsandwithCsrfmoved toborgo-framework/internal, router helpers toborgo-framework/router;cookieValueand the/serversubpath are gone. - Go:
Pushis generic andPushTis gone,DefaultHasheris a function,ServeContextexists.Push[any]("topic", "event", nil)replaces the old untyped form. The SSE stream flushes its headers on open, so a client sees the connection when it is accepted instead of at the first event. - The session cookie's three forgeries are closed. An unsigned cookie never authenticates, the two halves of the framework agree on what a valid cookie is, and a misspelled
SESSION_SECUREis refused rather than read as false.
What you get
A build that refuses to ship what will not work. Besides the asset channel above: a reference whose spelling only a case-insensitive filesystem forgives (/logo.png for Logo.png on disk) is named at build time with the file and the spelling on disk — it was a 404 on Linux and nothing else. Same for a relative import. A build interrupted halfway leaves a mark, and the next borgo start rebuilds instead of serving half a tree.
borgo doctor. Fifteen checks over the toolchain, the machine and the project — the bun on your PATH against the floor your package.json declares, a shim shadowing it, both ports with the pid holding a taken one, a stale api process, generated-types freshness, write access to the build directories. Each failure prints its one-line fix; checks that do not apply are skipped.
A deploy that does not open an ACME order in your name. borgo deploy init caddy writes tls internal by default; the systemd unit reads EnvironmentFile= and ships hardened (ProtectSystem=strict, NoNewPrivileges); the compose file requires SESSION_SECRET from your .env instead of inventing one.
Nothing outlives the session, on every platform. Every process borgo starts watches the one that started it and exits with it — including the case that used to slip through on Linux and macOS, a parent that exited but was never reaped. The front server probes its parent before it opens the port, not two seconds after. The one gap that stays, and why, is in the dev-experience guide.
A websocket refused for its origin says so once. The client gets close code 4403 with the reason and stops redialling; subscribe() takes onRefused. A topic that is empty, padded, or carries a comma is refused at the call site, before any socket exists. Every other close still reconnects, because a channel that gives up on the wrong guess is worse than one that retries.
Responses that reach the client whole. A second Content-Length no longer destroys the response for the identity client; a header the handler wrote under a non-canonical key is read and written under every spelling, so a browser that asked for gzip no longer sees the page source as text/plain; an event stream declared under a second Content-Type is no longer compressed; a Content-Encoding whose first value is empty no longer gets an already-coded body recompressed.
Caches that never store a personalised page. A response carrying Set-Cookie is made private whichever order the handler set the two headers in, and under every spelling of the key. Asset validators are weak, which is what they always were, and a range request against one is refused instead of honoured.
Dotfiles and dot-directories are not served. .DS_Store, .env, .git/config under public/ answer 404 on both the indexed and the live path, and borgo export leaves them out of dist/site by the same rule. .well-known/ is exempt as the first segment only.
No document carries this machine's path. The absolute path of the server that rendered a page cannot reach the HTML, the hydration props or the ?__borgo=props answer — redacted at the edge with this process's own root as the needle, so a page that legitimately shows a path as content is untouched.
The oversized submit shows an overlay, not a reload. A 413 on an enhanced form keeps what was typed and says why. Proved in a real browser now, not a DOM shim.
Go toolchains
Verified on 1.25.14, 1.26.4 and 1.27.0. Decoding is identical across all three — a missing field, null into a non-pointer, case folding, duplicate keys, a string where a number belongs — so the request types above mean the same thing whichever you build with.
Encoding changed once, in 1.27, and only for map keys: map[float32] and map[float64] now reach the wire as quoted numbers where every earlier toolchain refused the whole response, and map[any] encodes when the dynamic key happens to be a string. borgogen keeps typing a float-keyed map unknown, because that is the only type true on both sides of that change — Record<string, number> would promise a response a 1.26 server never sends. Bool, struct and array keys still fail on every toolchain, with a different message since 1.27.
Platform coverage
Linux and Windows are exercised on every push. macOS has its own CI job for the watchdog's darwin branch, and this is the first release where that job runs — the branch is written so that a reading it cannot trust answers "alive", which is 0.20's behaviour, never a refused boot or a killed session. FreeBSD and OpenBSD are covered with struct layouts recomputed from the system headers and have not yet run on a real kernel. DragonFly and Solaris keep 0.20's behaviour.
What is left open, on purpose
Every remaining limit is written next to the code that has it, with the measurement that justifies leaving it. The two worth knowing:
- On Windows,
borgo devwatches its launcher — the shell above it, which borgo did not start — by pid alone, and Windows reuses pids. Measured, a freed pid returns after 740 spawns at the soonest while one poll window sees about 180, so it takes a machine spawning several hundred processes a second to reach. Closing it means reading a creation time through a native call, where a wrong answer kills a healthy dev session: the opposite direction, and the more expensive one. Every process borgo itself starts sits in a job object and is unaffected. identityinContent-Encodingblocks compression. That matches the standard library, and it costs bytes, never correctness.
Method
None of the 135 commits is a refactor for its own sake. Each repair was written with its failure direction stated first, then handed to a separate verifier that executed the property instead of reading the diff, mutated the fix and required the test to go red, and refused the commit below 100% — five repairs sat unmerged at once under that rule rather than land at 90%.
The interesting part is what the method caught in itself. Four limits this project had declared as unfixable turned out to rest on reasons that were simply false, and were closed. Five separate false greens were found inside the verification tools — a mutation run filtered to one test name, which makes a cold process and disarms every timed test; a helper built from the very constant it was meant to check; a shell that never started and reported success; and, last, a comment stripper whose own bug was quietly emptying the proof that the...
v0.20.1
borgo 0.20.1 — the key was in our pocket
One hour ago we shipped 0.20.0, a release built on twenty-odd blind audit waves, four fuzzers, eighty mutants and a convergence curve we were rather proud of. We had laid siege to our own walls for days.
Sixty minutes later, someone scaffolded the full template, clicked register, and got a stack trace.
The walls held beautifully. The front gate was the problem. Here is what happened, because the failure is more interesting than the fix.
The bug
The full template exists to demonstrate authentication. It signs session cookies, which requires SESSION_SECRET. It did not set one, and nothing stopped it from starting anyway — so the app booted happily, served its pages, and then panicked the moment anybody tried to log in.
Three different ways, as it turns out:
- Register created the account, then panicked issuing the session. You got a 500, no session, and a username that answered "already taken" forever after. A ghost account you could neither use nor reclaim.
- Login verified your password correctly and panicked while handing you the session. The authentication worked perfectly; the result was thrown in the bin.
- Guarded routes took the same path for anyone still holding an old cookie.
All three reached the browser as an anonymous 500 internal server error while the server printed a goroutine stack.
Why the siege missed it
This is the part worth writing down.
Every smoke test we ran against the auth template looked like this:
PORT=3470 API_PORT=3970 SESSION_SECRET=some-long-secret bun run startWe supplied the secret. Every single time. Because we knew it was needed — the kind of knowledge you accumulate building the thing and then forget you have. So we proved, very rigorously, that authentication works when it is configured correctly. Nobody ever proved that a fresh scaffold works at all.
Twenty audit waves examined the framework. Not one of them examined the experience of using it, because the people running them all had the key in their pocket and kept letting themselves in without noticing the lock.
The other two fixes in here have the same shape. The scaffolder hung after printing its summary — the tests couldn't catch it because a piped stdin closes and a real terminal never does, so the bug lived exactly in the gap between the test harness and a human. And a chunk was landing on disk called literally [name]-abc123.js, which our own server happily served and an S3 bucket would not have.
What's fixed
- The
fulltemplate sets a development secret, with a comment telling you to replace it. Login works the moment you scaffold. - A missing
SESSION_SECRETis now an error, not a panic. The process is already serving traffic; a login that answers 500 is recoverable, a handler that dies is not. - Register refuses before writing to your user store, so a failure can no longer leave a ghost account behind.
create-borgoreleases the terminal when it is done asking questions, instead of sitting there until you interrupt it.- Chunks that Bun cannot name get a URL-safe filename, and the imports pointing at them are rewritten to match.
- New:
borgo pwa initwrites a workingmanifest.webmanifestand service worker, because the PWA page previously told you to create two files and left you to assemble them from snippets. Fair criticism, promptly received. - The docs now say that your Go API is a normal Go module —
go getwhatever you like. The zero-dependency rule is the framework's, not yours.
What we changed about ourselves
Every release from now on gets an end-user smoke test in a clean shell: no environment variables we know about and a newcomer doesn't, no suppressed output, and the complete journey through the full template — register, logout, login, protected page — before anything is called verified. It is the one thing that would have caught all three.
The convergence curve was real, and the walls really are thicker. It just turns out that testing whether your fortress can be breached is a different exercise from checking whether the residents can get in.
Days besieging the walls. One hour to fall over on the doormat. Onwards.
— Luigi
v0.20.0
borgo 0.20 — assaulting the walls
0.11 hardened the walls. 0.20 is what came after: we laid siege to our own village.
Independent audit waves over every area of the framework — each one starting blind, with no knowledge of what the previous waves had found, so it had to re-derive everything from scratch. Race detectors, fuzzing, mutation testing, adversaries pointed at our own runtime, and a lot of raw sockets. A deliberately unreasonable attempt to break borgo before anyone else got the chance.
Everything we found, we fixed. 156 commits. The test suite went from 133 to 461. The walls held; where they didn't, they're thicker now.
The version jump is the message: this isn't 0.12, it's a different league of ready. From here to 1.0 it's the 0.2x series.
The convergence curve
The point of blind waves isn't thoroughness theatre — it's measurement. If the last wave still finds serious problems, you are not done. If it comes back nearly dry, you have evidence instead of hope:
| Area | W1 | W2 | W3 | W4 | W5 | W6 | Final |
|---|---|---|---|---|---|---|---|
| Client runtime | 16 | 7 | 2 | 0 | |||
| Go core | 12 | 5 | 0 high | 1 | |||
| Front server | ~15 | 4 | 6 | 3 | 1 | 1 | 1 |
| borgogen | 13 | 6 | |||||
| Dev loop & CLI | 18 | 4 |
The last column is a final verification pass run across all five areas at once, after every area had already declared itself converged. It found eight things. That is what "nearly dry" looks like honestly reported — and it is why the pass was worth running.
The front server took six waves and earned every one. Waves four through six stopped reading the code and started extracting and running it: serve() went from 822 lines to 494, its proxy, asset path, CSRF gate, renderer and action branch pulled out into pure functions with tests behind them. Every bug found from that point on lived in the seam between two mechanisms that were each correct alone — a Content-Security-Policy that composed badly with an uppercase media type; a nosniff that composed badly with a stale If-Range; a gzip wrapper that quietly cancelled the backpressure the SSR renderer had been carefully written to provide. None of those is visible by reading one file, which is exactly why three earlier waves had read those files and passed.
Where new tests were written, the tests themselves were tested: 80+ deliberate mutations injected into the implementations, every one caught. A test that passes a broken implementation is worse than no test.
The siege diary
Ninety-seven fixes. The ones worth telling:
Security. A javascript: redirect could reach location.assign and execute in the app's own origin — any server redirect derived from user input was exploitable. Cookie tossing let a sibling subdomain plant a duplicate borgo_session or borgo_csrf and silently run the victim inside the attacker's account, or defeat CSRF entirely; Go, the front server and the browser now agree that an ambiguous duplicate is no cookie at all. /ws accepted cross-origin handshakes. /__borgo/publish trusted anything arriving through a local reverse proxy. CSRF now covers anonymous posts, so login-CSRF is closed. A crafted stored password hash could demand 32 KB of PBKDF2 key material — 106 seconds of CPU per verification, measured — while holding a hashing slot.
Things that lied. borgo doctor reported a port as free while borgo's own API was listening on it, because the probe bound to loopback and the API binds to the wildcard. The PWA precache stamp did not change when client.js changed, while the docs promised it did — a cache-first worker would have pinned users to stale JavaScript indefinitely. Page[A] and Page[B] collapsed into one generated TypeScript interface. And six more generator bugs of the worst kind: types that compile but misdescribe the wire, including one where the same Go type reaches the wire in two different shapes within a single response depending on addressability.
Reliability. A vanished SSE client could park a goroutine and its file descriptor forever. A panicking handler dropped the connection, or worse shipped a truncated 200 that no longer matched its Content-Length — and the recovery 500 inherited the abandoned response's headers, so a Cache-Control from borgo.Cache would have had a CDN hold the error for everyone for an hour. borgo build exited 0 when codegen failed. borgo start silently served development assets. Dev and start processes outlived their parent on Windows, holding ports and binaries until you hunted them in the task manager — the whole tree now dies with its launcher.
Performance, measured. gzip responses: 828 KB allocated → 15 KB (−98%). SSE broadcast to 100 subscribers: 100 µs → 0.85 µs. Push under concurrency: 2.3 s → 0.13 s (it was exhausting the ephemeral port range). borgogen: 3521 ms → 592 ms, and it reruns on every api/*.go save. The SSR hot path had its per-request string work hoisted to boot; static assets are indexed once and answer with ETags and 304s.
What's new
Forms that behave. Actions submit over fetch and re-render in place, keeping your scroll position and surfacing real errors — and still work with JavaScript off. No API change: your existing forms just got nicer.
Three templates. create-borgo asks what you want: base (the guided tour), minimal (one page, one route, silence), full (notes CRUD, register/login/logout with sessions and CSRF, a protected page, SSE, a typed WebSocket channel). It asks about Tailwind too — and the scaffolder now has a test suite of its own.
Tailwind, if you ask. v4 behind --tailwind: a flag, never autodetection, because your CSS pipeline should not change because a package appeared in node_modules. Scaffolds arrive wired; existing apps add three lines. SCSS stays the default.
Security by default. Security headers and a strict Content-Security-Policy on every document, with the server-rendered props script nonced so production needs no 'unsafe-inline'. Overridable with BORGO_CSP and BORGO_SECURITY_HEADERS.
Graceful shutdown. SIGTERM drains in-flight requests and ends SSE streams immediately through a shutdown hook, so a rolling restart does not wait out the grace period. BORGO_SHUTDOWN_TIMEOUT tunes it.
PWA mechanics. precache.json with a content stamp, sw.js served no-cache, and a registerServiceWorker() that refuses to run in dev — because a caching service worker attached to a dev server is how you lose an afternoon.
A sharper typed bridge. borgogen follows helper functions across packages in your module, reads json.NewEncoder(w).Encode(v), types multi-shape handlers as unions while keeping error envelopes out of them, and got precise about the wire: MarshalText types, []byte as base64, omitzero, embedded-field shadowing, quoted keys for tags that are not TypeScript identifiers.
The docs were rewritten
Twelve pages, two of them new. Getting started is a build-along that takes you from bunx create-borgo to a working feature — including a step where you break the code on purpose to watch a typo become a compile error. Security states the whole default posture and, just as carefully, what borgo deliberately leaves to you: no rate limiting, no WAF, no TLS, no OAuth, no session revocation.
Every page now ends with its honest limits, where the reader will hit them rather than in a footnote. And every TypeScript and Go example on those pages is compiled by CI against the real framework types. If a snippet appears in the docs, it builds.
Upgrade notes
- Enhanced form submits are automatic. A form that must post natively — a file download, an exotic response — takes
data-borgo-native. Bindrejects declared non-JSON content types with415. Requests without aContent-Typestill bind, so your curl habits are safe.- The API refuses to boot with a missing
SESSION_SECRETwhen sessions are used, and warns under 32 bytes. borgo.Handleafterborgo.Servenow panics instead of silently registering a route nobody would ever serve.- CSRF applies to any browser holding the token cookie, not just logged-in sessions. Forms with
<CsrfField />are unaffected — which should be all of them. - A strict CSP now ships by default. If you load third-party scripts, widen it with
BORGO_CSP(keep{nonce}inscript-src) and check the console once.
Next up: 0.21, benchmarks and stability — the siege engines get pointed outward, with the full methodology and sources published alongside the numbers.
Built in the evenings. Besieged by twenty-odd merciless auditors, four fuzzers, eighty mutants, an unreasonable amount of curl, and one very stubborn human. The village is small; the walls held.
— Luigi
v0.11.0
borgo 0.11.0 — the hardening release. This is our "internal beta" bar: after two days of merciless road-testing, everything a production adopter would call missing is now either built, or a documented choice. Mostly built.
Auth, finally systematic
borgo.Auth[U]— wire your user store (any database, any schema, or a map if you're prototyping — we don't judge) into ready-madeLoginHandler/LogoutHandler/RegisterHandlerover signed-cookie sessions- Password hashing via stdlib PBKDF2-SHA256 — OWASP parameters, self-describing hashes, a swappable
PasswordHasherinterface, and still zero dependencies in the Go runtime. The standard library kept its promise so we kept ours - Timing-safe dummy hashing kills username enumeration; CSRF double-submit protection for form actions, on by default in production
borgo.Authed(next)for Go routes; the loaderredirect()guard is now the documented pattern for pages
Server hardening
borgo.Serveruns a properly configuredhttp.Server: ReadHeaderTimeout 5s (slowloris tested, not just feared), IdleTimeout 2m, streaming-safe write strategy — SSE clears its own deadlines. Everything overridable via envborgo.Bindcaps request bodies at 1 MB → clean JSON 413 end-to-end through the proxy.BindMaxwhen you genuinely expect more than a megabyte of JSON (are you sure?)
Operability
borgo doctor— 8 environment checks with the fix printed next to the failure. Born from real incidents: every trap the author walked into during road-testing is now a ✓ or a ✗ with instructions/healthzon both servers; opt-in Prometheus/metricswith bounded cardinalityborgo export— prerender static routes (your_404included) into a folder any nginx from any decade can serve. Zero-JS pages stay zero-JSborgo deploy init caddy|nginx|systemd|compose— the blessed configs, generated into your project instead of copy-pasted from docs
Typed realtime
borgo.PushT[T]feeds a generated event map:subscribeandpublishare type-checked end-to-end from your Go structs. A wrong payload failstsc— and CI proves it stays that way
Reliability
We found and fixed a bug where a client closing a tab mid-download of a compressed page could take down the whole server. We found it before you did — that's what betas are for. Alongside it: zero-500 API restarts in dev, deterministic fast refresh (hook edits included), no more double reloads, navigation races, encoded-path handling, HEAD support, and about twenty more from the road-test list.
Docs, rebuilt
README is now a digest; the deep dives live in docs/ — 7 pages, an index with reading paths, and every single code example compiles, enforced in CI. Documentation that lies is worse than no documentation; ours is now mechanically prevented from lying.
Upgrade notes: apps using sessions + form actions must render <CsrfField /> inside forms (or use the documented escape hatch). Bodies over 1 MB now get 413 — reach for BindMax where you expect more.
Numbers: ~5k-line core you can read in an evening (a long one, now) · zero Go runtime deps · Go tests + 126 bun tests + 55 e2e + 3 deliberate tsc failures in CI · one version, three artifacts: npm borgo-framework + create-borgo 0.11.0, Go module v0.11.0.
Built in the evenings with stubbornness and an unreasonable amount of curl. If borgo saves your weekend, tell a friend — if it ruins one, open an issue: I read everything.
— Luigi