Runs anywhere. A web framework.
Take a Request, return a Response. That is all it takes for the same code to run on Bun, Node.js, Deno, Cloudflare Workers and browsers.
Take a Request, return a Response. That is all it takes for the same code to run on Bun, Node.js, Deno, Cloudflare Workers and browsers.
GET /users/42. A web-standard Request goes straight into Senri.
GET /users/42. A web-standard Request goes straight into Senri.
Through a branching tree of routes, straight to /users/:id. The id comes typed.
requestId, cors, auth. Layer by layer, like peeling an onion.
Return what you want to return. An object becomes JSON.
The Response travels back the way it came. The dashboard shows where every millisecond went.
GET /users/42
host: example.com
accept: application/json
authorization: Bearer ••••You can edit the code. When you send an edited version, the real Senri loads and runs in your browser (about 130 KB).
Press Send or pick a path belowWith the original code, you see what the real Senri returned at build time.
Write serve(app) and it starts on Bun.
The same serve(app) runs on Node.js.
The same serve(app) runs as is with deno run.
Write export default app and it runs on Cloudflare Workers.
Inside a Service Worker, the same app answers.
import { serve } from "@senrijs/senri/serve"; import { app } from "./app.ts"; serve(app);
import { serve } from "@senrijs/senri/serve"; import { app } from "./app.ts"; serve(app);
import { serve } from "@senrijs/senri/serve"; import { app } from "./app.ts"; serve(app);
import { app } from "./app.ts"; export default app;
import { app } from "./app.ts"; self.addEventListener("fetch", (e) => e.respondWith(app.fetch(e.request)));
Your routes, then every request as it arrives. Mistype a path and it asks: did you mean?
Bun, Node.js, Deno, Workers and browsers all speak the web-standard Request and Response.
Senri is a layer that takes a Request and returns a Response. It absorbs the differences between runtimes.
Through requestId, cors and auth in order, and finally the handler answers.
On top of that, Ippo, a meta-framework for React and Vue, is planned.
GET /users/42 has arrived. Now to find which route it is.
Routes are kept as a tree. They are not compared one by one.
The first segment, users, narrows it to one branch.
The rest, 42, fits :id. It is a GET, so this is the route.
The handler gets { id: "42" }, and id has a TypeScript type.
A journey of a thousand miles begins with a single step.