Skip to main content
Get your first Hono application up and running in minutes. Hono is an ultrafast web framework built on Web Standards that works on any JavaScript runtime.

Create a New Project

The fastest way to get started is using the create-hono scaffolding tool:
1

Create your project

Run the scaffolding command to create a new Hono project:
npm create hono@latest
You’ll be prompted to:
  • Enter a project name
  • Choose a template (cloudflare-workers, deno, bun, nodejs, etc.)
  • Select whether to install dependencies
2

Navigate to your project

cd my-app
3

Start the development server

The start command depends on your chosen runtime:
npm run dev
4

Open your browser

Navigate to http://localhost:8787 (or the port shown in your terminal) to see your app running.

Your First Hono App

Here’s a simple “Hello World” example that demonstrates the core concepts:
index.ts
import { Hono } from 'hono'

const app = new Hono()

app.get('/', (c) => c.text('Hono!'))

export default app
This minimal example shows:
  • Import: Bring in the Hono class from the hono package
  • Create: Instantiate a new Hono application
  • Route: Define a GET route at the root path
  • Handler: Return a text response using the context object c
  • Export: Make the app available to the runtime

Add More Routes

Expand your app with different HTTP methods and dynamic routes:
import { Hono } from 'hono'

const app = new Hono()

// Simple GET route
app.get('/', (c) => c.text('Hono!'))

// Dynamic route with parameters
app.get('/hello/:name', (c) => {
  const name = c.req.param('name')
  return c.text(`Hello, ${name}!`)
})

// POST route with JSON response
app.post('/api/users', (c) => {
  return c.json({ message: 'User created' }, 201)
})

// Wildcard route
app.get('/posts/*', (c) => {
  return c.text('Blog posts')
})

export default app

Working with Different Runtimes

One of Hono’s superpowers is that the same code runs on multiple platforms. Here’s how to run your app on different runtimes:
import { Hono } from 'hono'

const app = new Hono()
app.get('/', (c) => c.text('Hono!'))

export default app
Run with:
npm run dev

Response Types

Hono’s context object provides convenient methods for different response types:
import { Hono } from 'hono'

const app = new Hono()

// Text response
app.get('/text', (c) => c.text('Hello!'))

// JSON response
app.get('/json', (c) => c.json({ message: 'Hello!' }))

// HTML response
app.get('/html', (c) => c.html('<h1>Hello!</h1>'))

// Custom response
app.get('/custom', (c) => {
  return new Response('Custom', {
    status: 200,
    headers: { 'X-Custom': 'Header' }
  })
})

export default app

Next Steps

Now that you have a basic Hono app running, explore more features:

Routing

Learn about path parameters, wildcards, and route grouping

Middleware

Add authentication, CORS, logging, and more

Context

Master the request and response handling

Validation

Validate request data with type safety

Build docs developers (and LLMs) love