Creating a project
A Hono project is created with the official npm create hono command. It asks which platform the project is for and lays out ready-made files: the entry point, the TypeScript settings and the start scripts.
What you need
You need Node.js 22 or newer. Check the version in a terminal:
node -vCreating the project
npm create hono@latest blog-apiThe command asks a few questions:
- Which template do you want to use? — choose
nodejs. - Do you want to install project dependencies? — answer yes.
- Which package manager do you want to use? — choose
npm.
Then go to the project folder and start the development server:
cd blog-api
npm run devThe terminal shows Server is running on http://localhost:3000. Open that address and the browser shows the text "Hello Hono!".
Project structure
blog-api/
├── src/
│ └── index.ts entry point: the app and the server start
├── node_modules/ installed packages
├── package.json dependencies and scripts
├── tsconfig.json TypeScript settings
└── .gitignoreThe project is deliberately small: Hono does not impose a folder structure. You will split routes, middleware and database code into files yourself as the app grows.
Scripts
package.json already has three scripts:
| Command | What it does |
|---|---|
npm run dev | runs src/index.ts through tsx and restarts the server when a file is saved |
npm run build | compiles TypeScript to JavaScript into the dist/ folder |
npm start | runs the built dist/index.js with plain Node.js |
tsx is a small program that runs TypeScript files without a separate compile step. It is only needed during development.
Dependencies
{
"dependencies": {
"@hono/node-server": "^1.14.0",
"hono": "^4.7.0"
}
}hono is the framework itself, and @hono/node-server is the adapter that runs the app on Node.js. Your version numbers may differ; that is fine.
TypeScript settings
tsconfig.json turns on strict mode (strict) and contains JSX settings, which you will need in the lesson on HTML pages. Modules are set to NodeNext, so when you import your own files you write the .js extension, even though the file is named .ts:
// src/index.ts
import { posts } from './routes/posts.js'Common mistake
Pick the template for the platform where the server will run. If you choose cloudflare-workers or bun, the files and start commands are different, and the course examples with @hono/node-server will not run. For this course choose nodejs. If you picked the wrong one, it is easier to create the project again.