Run a real Nifra app in your browser.

The real @nifrajs/core runs in this tab. Nothing is installed and nothing is sent to a server.

  1. Write the app

    server() declares routes and t declares what each one accepts. The code returns the app.

  2. Send requests

    Each entry in requests.json becomes a real Request passed to app.fetch, the same call Bun, Node, and Deno make.

  3. Read the responses

    The status and body each request got back, exactly as a client would see them.

Each .get() adds a route. A :name segment arrives on c.params, and a returned object is sent as JSON.

TryChange /hello/world in requests.json to your own name.

Responses

Loading the playground…

What each piece does

server()
Creates an app. Chain .get, .post, .put, .patch, and .delete to add routes.
c.params
The values of :name segments in the route path.
c.query, c.body
The query string and the parsed JSON body. Declare a t schema on the route and they arrive validated and typed.
t
The schema builder: t.object, t.string, t.number, t.boolean, t.array, t.optional, and t.query for query strings. Input that fails gets a 422.
status(code, body)
Responds with any status code and a JSON body.
.derive(fn)
Runs before every route. Whatever it returns is merged into c.
return app
The playground calls app.fetch on the app you return. In a project you export it: export default { fetch: app.fetch }.
requests.json
An array of { method?, path, headers?, body?, label? }, sent in order. A label is shown above its response.

Same code, on your machine: bun create nifra my-app

Read the docs