StartXKit docs
Frameworks

Hono

Generate lightweight Hono APIs with composable route objects and a small runtime footprint.

Hono is a small, fast web framework with a clean router model. StartXKit uses Hono with the Node.js adapter, so generated projects run like a normal Node backend.

Choose Hono When

  • You want a lightweight API framework
  • You prefer compact route definitions
  • You want a small dependency footprint
  • You may later explore edge-style runtimes

Generated Entry Point

Hono projects generate src/server.ts. It creates a Hono app, registers optional middleware, mounts route objects, and starts the Node server.

src/
  server.ts
  routes/ or modules/
  config/
  shared/

Route Example

import { Hono } from "hono";
import { UsersController } from "./users.controller";

export const usersRoutes = new Hono();

usersRoutes.get("/", UsersController.getAll);
usersRoutes.post("/", UsersController.create);
usersRoutes.get("/:id", UsersController.getById);
usersRoutes.patch("/:id", UsersController.update);
usersRoutes.delete("/:id", UsersController.remove);

The server mounts the route object:

app.route("/api/v1/users", usersRoutes);

Request Flow

request
  |
  v
Hono app
  |
  v
mounted route object
  |
  v
controller
  |
  v
optional service/repository

Optional Features

FeatureWhat it adds
CORShono/cors middleware and src/config/cors.ts
Env configdotenv and src/config/env.ts
Error handlerapp.onError(...) and shared error files
Pino loggerpino dependency
Zod validationzod dependency and validator-ready module files
Vitesttest script and vitest dependency

Architecture Notes

  • Minimal Hono projects use route files with inline handlers.
  • Modular Hono projects use src/modules/{feature}.
  • Layered Hono projects use top-level route, controller, service, repository, interface, and validator folders.