Skip to content
nooh
Esc
↑↓navigate↵open⌘Jpreview
On this page

Quickstart

Build your first type-safe Hono API with Nooh in under five minutes.

This guide takes you from an empty directory to a running Hono server with a file-based route and a dependency-injected service.

Create the project

Start from the official template — it handles the scaffolding for you:

pnpm create @nooh-ts/template my-api
cd my-api
pnpm install

Or follow the manual installation if you’re adding Nooh to an existing project.

Write a route

Create src/routes/index.get.ts. The filename encodes both the HTTP method (get) and the path (/):

// src/routes/index.get.ts
import { get } from "@router/index";

export default get((c) => c.text("Hello, Nooh!"));

The @router/index import is generated by Nooh. It exports a typed get factory that matches this exact route.

Build

Run the compiler to generate the Hono application:

npx nooh build

Nooh reads src/routes/index.get.ts, generates .nooh/router/index.ts with a fully typed get factory, and assembles a .nooh/app.ts that wires everything into a Hono instance.

Start the server

Create your entry point and start the server. This example uses Bun, but any Hono-compatible runtime works:

// src/index.ts
import app from "../.nooh/app";

export default app;
bun src/index.ts

Visit http://localhost:3000 — you should see Hello, Nooh!.

Add a dynamic route

Add src/routes/users/[id].get.ts — square brackets create a URL parameter:

// src/routes/users/[id].get.ts
import { get } from "@router/users/[id]";

export default get((c) => {
  const id = c.req.param("id");
  return c.json({ id });
});

Rebuild and the new route is live at GET /users/:id. The id parameter is typed through Hono’s c.req.param.

What’s next?

Was this page helpful?