Hono API Starter for Node.js

A Hono 4 REST API starter for Node.js 22, written as plain JavaScript ES modules and served by @hono/node-server. It is for developers who want a small fetch-handler API with a /health check, JSON 404 and 500 responses and node:test tests, and no database or TypeScript build.

by Light CloudREST APIs

Features

  • GET / lists the endpoints and GET /health returns status, an ISO timestamp and process uptime
  • Route groups as Hono sub-apps in src/routes/, mounted in src/app.js with app.route()
  • app.notFound answers { "error": "Not found" } with a 404; app.onError logs and answers a JSON 500
  • ES modules with "type": "module", run straight from source with no compile step
  • Tests call app.request() on the Hono app, so no server or port is involved
  • Graceful shutdown on SIGTERM and SIGINT lets in-flight requests finish before the process exits
  • Two runtime dependencies, hono and @hono/node-server; listens on PORT, defaulting to 3000

Tech stack

What you need

  • Free plan: it runs as a server app, and the Free plan includes 3 server apps
  • To run it locally: Node.js 22 or newer and npm
  • No API keys: it starts with nothing to configure

About

@hono/node-server turns each Node.js request into a Web Standards Request and hands it to app.fetch, so src/app.js is an ordinary fetch handler and only src/server.js knows it is running on Node. That keeps the route code portable: moving to another runtime means swapping the server file and the one process.uptime() call in /health. Most people start by adding a sub-app such as things.js and the cors middleware from hono/cors. On Light Cloud it runs npm start in a container on the PORT the platform sets, and every push to your copy redeploys it.

FAQ

How do I add a new route in Hono?

Create a sub-app in src/routes/ like root.js, with const things = new Hono() and things.get(...), then mount it in src/app.js with app.route('/things', things).

How do I enable CORS in a Hono app?

CORS is off in this starter. Import cors from 'hono/cors' and add app.use('*', cors({ origin: 'https://example.com' })) in src/app.js before the routes.

Can this Hono app run on Bun, Deno or Cloudflare Workers?

The app in src/app.js is a standard fetch handler; only src/server.js is Node.js specific. Replace that file with the other runtime's entry point and change the process.uptime() call in /health.

Is there a Hono starter with a PostgreSQL database?

This one has no database. The hono-postgresql-crud-api template adds PostgreSQL and a full CRUD resource on the same layout.

Can I host this Hono API without Light Cloud?

Yes. It has no Light Cloud code: any host with Node.js 22 runs it with npm ci --omit=dev and npm start, with PORT set.

Price
Free
Framework
Hono · JavaScript
Plan
Free
Updated

Related templates

All rest api starters