camelon

Install & bootstrap

camelon is consumed as a workspace package today; npm publish is in progress. An app is a Node project with a src/routes/ tree, a src/document.tsx wrapper, and a server entry.

Server entry

src/server.ts is the whole bootstrap:

import express from 'express';
import { createHandler } from 'camelon';
import { toExpress } from 'camelon/express';
import { manifest } from './gen/manifest.generated';

const app = express();
app.use(toExpress(await createHandler({ routes: manifest })));
app.listen(3000);

createHandler returns a web-standard (request: Request) => Promise<Response>. It runs on any runtime. On Node, toExpress mounts it as Express middleware.

const handler = await createHandler({ routes: manifest });

Deno.serve(handler);                 // Deno
Bun.serve({ fetch: handler });       // Bun
export default { fetch: handler };   // Workers

See runtime targets for the full list.

camelon/express also exports listen(app), a dev helper that finds a free port (start from 3333, or pin with PORT). Plain app.listen is enough.

Commands

camelon dev        # watch: regen manifest, rebuild, restart on change
camelon build      # bundle → dist/server.mjs
node dist/server.mjs   # run the production bundle
camelon validate   # check routes: naming, collisions, contracts
camelon openapi    # write openapi.json + route-contracts.json

dev and build both use esbuild. There is no tsx or tsc at runtime.