Blog
Notes on building with KosmoJS.
v0.6.4: lib/ relocated into var/
v0.6.4 moves derived code out of the project root, and seeds new source folders with a default page and a default API route.
Three backends, one route spec
Hono, H3 and Koa all work in KosmoJS. They share no context, no response shape and no error model, and that's on purpose. How "support" slowly came to mean something narrower and more useful.
Five frontends, one contract
KosmoJS started as a Solid template and went public with two frontends. Today it runs five, each keeping its own idioms.
Config: from wiring to describing
A source folder's config went through three shapes, a Vite config, a list of generators, a declarative description. Each one took a decision away from the developer, and none of them was planned.
Fetch clients: typed, validated, isomorphic
A generated client that started as just types, and grew one bug at a time into one that validates like the server, runs anywhere, and fails loudly.
Validation: TS at runtime
You write a type. Then you write the same shape again in Zod. Then the client needs its own copy. Making the type the source took a search for a library that did not exist, and shaped more than validation.
Middleware: step by step
Middleware in KosmoJS did not start with slots, cascading or edge. It started as all or nothing, and every step after it was a fix for one specific annoyance.
Params syntax, three attempts
Every routing framework has its own way of writing `[id]`. KosmoJS uses one syntax everywhere. Getting there took three attempts, and I'm glad I don't like the first one anymore.
A year of silence
KosmoJS has been on GitHub for a year with no blog posts. This is the series that should have been written monthly. It arrives now because the API finally stopped moving.
v0.6.2: tests, built in
Vitest integration lands. A test file next to every route, backend tests through the real stack with no network, and frontend tests driving a real browser against a real server.
v0.5.2: sidecars and edge middleware
Two additions with little in common, except that both started as annoyances. A folder that builds a process instead of serving routes, and middleware that runs before validation.