KosmoJS - the composable meta-framework
KosmoJS is a full-stack meta-framework for building several apps in one codebase. Each gets its own backend and frontend framework and its own routes; they all share one install, one set of types, one build.
You write features - KosmoJS handles the wiring.
src/
├─ shop/ / React + Hono
├─ admin/ /admin Solid + Koa
├─ webhooks/ /hooks Hono, no UI
├─ docs/ /docs MDX, no API
└─ status/ /status Vue + Honocomposable by nature
New surfaces keep appearing - each wants its own routing, auth, and deploy story. The usual ways of splitting them apart all add maintenance overhead.
Separate repos, separate pipelines, separate deploy configs. Shared types drift. A schema change turns into a cross-repo negotiation, and you spend more time on infrastructure than features.
One repo, but now you maintain workspaces, package boundaries, internal dependency graphs, and build caches. The packages/shared folder slowly becomes a junk drawer. The tooling becomes its own project.
Hand-wired scripts and a homegrown dev server that stitches the apps together. Cheap to build. Then a second developer joins and asks why start-all.sh passes --legacy-peer-deps - and nobody remembers.
built on Vite
One folder per concern. A source folder is whatever you need it to be - a public site, an internal tool, a backend-only webhook handler, a docs site - each with its own backend and frontend framework, base URL, and build output. None of them are separate packages.
connected apps, provisioned
You no longer manage repos or wrestle configs - you write business logic. Define a route, and request validation, type-safe fetch clients, and an OpenAPI spec are generated from it. Cascading middleware removes the import-and-wire busywork; nested layouts and anything your chosen framework supports stay available. KosmoJS adds no proprietary abstractions to fight - you keep direct, full access to the frameworks underneath.
import { defineRoute } from "_/api";
export default defineRoute<"users">(({ POST }) => [
POST<{
json: {
name: string;
email: VRefine<string, { format: "email" }>;
};
}>(async (ctx) => {
const { name, email } = ctx.validated.json; // validated, typed
ctx.body = await createUser(name, email);
}),
]);// import generated clients
import fetchClients from "_/fetch";
const { POST } = fetchClients["users"];
export default function Page() {
const form = useForm({ name: "", email: "" });
// fully typed and validated client-side
const submit = () => POST([], { json: form.values });
return <UserForm form={form} onSubmit={submit} />;
}[id] required · {id} optional · {...path} splat — identical syntax for API routes and pages. Solid, Vue and MDX pages follow the same shape.
what you get
With all features enabled out of the box, you forget about the tedious parts of a full-stack project. Multiple sub-projects merge into one coherent, scalable structure - which you don't have to maintain.
Your folder tree is the route map, for API and pages alike. Nothing to keep in sync.
Write the type once. Runtime validation, a typed client, and OpenAPI all derive from it.
Every route gets a typed client. Invalid requests fail in the browser, before a round trip.
A spec falls out of the same definitions - no annotation layer, no hand-authored schema.
Drop a use.ts in any folder; it wraps everything beneath it. No imports, no wiring.
Override one piece of global middleware per route or subtree. Inherit everything else.
Compose shared shells - nav, sidebars, auth - at any depth. The file system is the hierarchy.
No proprietary runtime, no custom bundler. Every layer is something you can debug and swap.
how it differs
Most meta-frameworks pick your frontend for you and own your deploy model. Monorepo tools hand you flexibility and a configuration tax. Microservices give independence and a fragmented codebase. KosmoJS keeps the part that is tedious to set up and easy to let erode - routing conventions, the validation pipeline, middleware composition, build orchestration - and leaves the rest to you: frontend, state, styling, database, deploy target.
Structure that scales. Choices that stay yours.
Scaffold a project, add a source folder, pick your stack. The dev server does the rest.