├── templates ├── bun │ ├── .gitignore │ ├── tsconfig.json │ ├── README.md │ ├── src │ │ └── index.ts │ └── package.json ├── x-basic │ ├── public │ │ ├── .assetsignore │ │ └── favicon.ico │ ├── app │ │ ├── style.css │ │ ├── client.ts │ │ ├── global.d.ts │ │ ├── server.ts │ │ ├── routes │ │ │ ├── _404.tsx │ │ │ ├── _error.tsx │ │ │ ├── index.tsx │ │ │ └── _renderer.tsx │ │ └── islands │ │ │ └── counter.tsx │ ├── vite.config.ts │ ├── tsconfig.json │ ├── .gitignore │ ├── package.json │ └── wrangler.jsonc ├── cloudflare-workers+vite │ ├── public │ │ ├── .assetsignore │ │ └── favicon.ico │ ├── src │ │ ├── style.css │ │ ├── index.tsx │ │ └── renderer.tsx │ ├── wrangler.jsonc │ ├── vite.config.ts │ ├── tsconfig.json │ ├── README.md │ ├── .gitignore │ └── package.json ├── deno │ ├── README.md │ ├── .vscode │ │ ├── extensions.json │ │ └── settings.json │ ├── main.ts │ └── deno.json ├── nextjs │ ├── README.md │ ├── next.config.ts │ ├── next-env.d.ts │ ├── app │ │ ├── api │ │ │ └── [...route] │ │ │ │ └── route.ts │ │ ├── layout.tsx │ │ └── page.tsx │ ├── eslint.config.mjs │ ├── package.json │ ├── .gitignore │ └── tsconfig.json ├── aws-lambda │ ├── README.md │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ ├── .gitignore │ └── package.json ├── lambda-edge │ ├── README.md │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ ├── .gitignore │ └── package.json ├── netlify │ ├── netlify.toml │ ├── .vscode │ │ ├── extensions.json │ │ └── settings.json │ ├── netlify │ │ └── edge-functions │ │ │ └── index.ts │ └── .gitignore ├── cloudflare-pages │ ├── public │ │ └── static │ │ │ └── style.css │ ├── src │ │ ├── index.tsx │ │ └── renderer.tsx │ ├── tsconfig.json │ ├── vite.config.ts │ ├── README.md │ ├── .gitignore │ ├── package.json │ └── wrangler.jsonc ├── nodejs │ ├── README.md │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ ├── package.json │ └── .gitignore ├── cloudflare-workers │ ├── src │ │ └── index.ts │ ├── tsconfig.json │ ├── package.json │ ├── README.md │ ├── .gitignore │ └── wrangler.jsonc ├── fastly │ ├── src │ │ └── index.ts │ ├── fastly.toml │ ├── tsconfig.json │ ├── package.json │ └── README.md └── vercel │ ├── package.json │ ├── tsconfig.json │ ├── src │ └── index.ts │ ├── README.md │ └── .gitignore ├── .yarnrc.yml ├── .vscode └── settings.json ├── .prettierrc ├── .gitignore ├── package.json ├── README.md └── .github └── workflows └── sync-branch.yml /templates/bun/.gitignore: -------------------------------------------------------------------------------- 1 | # deps 2 | node_modules/ 3 | -------------------------------------------------------------------------------- /templates/x-basic/public/.assetsignore: -------------------------------------------------------------------------------- 1 | index.js 2 | .vite/ -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/public/.assetsignore: -------------------------------------------------------------------------------- 1 | .vite -------------------------------------------------------------------------------- /templates/deno/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | deno task start 3 | ``` 4 | -------------------------------------------------------------------------------- /templates/nextjs/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | npm install 3 | npm run dev 4 | ``` 5 | -------------------------------------------------------------------------------- /templates/x-basic/app/style.css: -------------------------------------------------------------------------------- 1 | @import 'tailwindcss' source('../app'); 2 | -------------------------------------------------------------------------------- /templates/aws-lambda/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | npm install 3 | npm run deploy 4 | ``` 5 | -------------------------------------------------------------------------------- /templates/lambda-edge/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | npm install 3 | npm run deploy 4 | ``` 5 | -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | yarnPath: .yarn/releases/yarn-3.4.1.cjs 2 | nodeLinker: node-modules 3 | -------------------------------------------------------------------------------- /templates/netlify/netlify.toml: -------------------------------------------------------------------------------- 1 | [[edge_functions]] 2 | function = "index" 3 | path = "/*" -------------------------------------------------------------------------------- /templates/cloudflare-pages/public/static/style.css: -------------------------------------------------------------------------------- 1 | h1 { font-family: Arial, Helvetica, sans-serif; } -------------------------------------------------------------------------------- /templates/x-basic/app/client.ts: -------------------------------------------------------------------------------- 1 | import { createClient } from 'honox/client' 2 | 3 | createClient() 4 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/src/style.css: -------------------------------------------------------------------------------- 1 | h1 { 2 | font-family: Arial, Helvetica, sans-serif; 3 | } 4 | -------------------------------------------------------------------------------- /templates/deno/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "denoland.vscode-deno" 4 | ] 5 | } -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "editor.codeActionsOnSave": { 3 | "source.organizeImports": "explicit" 4 | } 5 | } -------------------------------------------------------------------------------- /templates/netlify/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "denoland.vscode-deno" 4 | ] 5 | } -------------------------------------------------------------------------------- /templates/x-basic/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/honojs/starter/HEAD/templates/x-basic/public/favicon.ico -------------------------------------------------------------------------------- /templates/nodejs/README.md: -------------------------------------------------------------------------------- 1 | ``` 2 | npm install 3 | npm run dev 4 | ``` 5 | 6 | ``` 7 | open http://localhost:3000 8 | ``` 9 | -------------------------------------------------------------------------------- /templates/deno/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enablePaths": [ 3 | "./" 4 | ], 5 | "editor.inlayHints.enabled": "off" 6 | } -------------------------------------------------------------------------------- /templates/netlify/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "deno.enablePaths": [ 3 | "./" 4 | ], 5 | "editor.inlayHints.enabled": "off" 6 | } -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/honojs/starter/HEAD/templates/cloudflare-workers+vite/public/favicon.ico -------------------------------------------------------------------------------- /templates/bun/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "strict": true, 4 | "jsx": "react-jsx", 5 | "jsxImportSource": "hono/jsx" 6 | } 7 | } -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 100, 3 | "trailingComma": "none", 4 | "tabWidth": 2, 5 | "semi": false, 6 | "singleQuote": true, 7 | "endOfLine": "lf" 8 | } 9 | -------------------------------------------------------------------------------- /templates/x-basic/app/global.d.ts: -------------------------------------------------------------------------------- 1 | import type {} from 'hono' 2 | 3 | declare module 'hono' { 4 | interface Env { 5 | Variables: {} 6 | Bindings: {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /templates/bun/README.md: -------------------------------------------------------------------------------- 1 | To install dependencies: 2 | ```sh 3 | bun install 4 | ``` 5 | 6 | To run: 7 | ```sh 8 | bun run dev 9 | ``` 10 | 11 | open http://localhost:3000 12 | -------------------------------------------------------------------------------- /templates/nextjs/next.config.ts: -------------------------------------------------------------------------------- 1 | import type { NextConfig } from 'next' 2 | 3 | const nextConfig: NextConfig = { 4 | /* config options here */ 5 | } 6 | 7 | export default nextConfig 8 | -------------------------------------------------------------------------------- /templates/bun/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | 3 | const app = new Hono() 4 | 5 | app.get('/', (c) => { 6 | return c.text('Hello Hono!') 7 | }) 8 | 9 | export default app 10 | -------------------------------------------------------------------------------- /templates/deno/main.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | 3 | const app = new Hono() 4 | 5 | app.get('/', (c) => { 6 | return c.text('Hello Hono!') 7 | }) 8 | 9 | Deno.serve(app.fetch) 10 | -------------------------------------------------------------------------------- /templates/x-basic/app/server.ts: -------------------------------------------------------------------------------- 1 | import { showRoutes } from 'hono/dev' 2 | import { createApp } from 'honox/server' 3 | 4 | const app = createApp() 5 | 6 | showRoutes(app) 7 | 8 | export default app 9 | -------------------------------------------------------------------------------- /templates/cloudflare-workers/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | 3 | const app = new Hono() 4 | 5 | app.get('/', (c) => { 6 | return c.text('Hello Hono!') 7 | }) 8 | 9 | export default app 10 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/wrangler.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "node_modules/wrangler/config-schema.json", 3 | "name": "%%PROJECT_NAME%%", 4 | "compatibility_date": "2025-08-03", 5 | "main": "./src/index.tsx" 6 | } -------------------------------------------------------------------------------- /templates/x-basic/app/routes/_404.tsx: -------------------------------------------------------------------------------- 1 | import type { NotFoundHandler } from 'hono' 2 | 3 | const handler: NotFoundHandler = (c) => { 4 | c.status(404) 5 | return c.render('404 Not Found') 6 | } 7 | 8 | export default handler 9 | -------------------------------------------------------------------------------- /templates/bun/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "scripts": { 3 | "dev": "bun run --hot src/index.ts" 4 | }, 5 | "dependencies": { 6 | "hono": "^4.11.1" 7 | }, 8 | "devDependencies": { 9 | "@types/bun": "latest" 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /templates/fastly/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | import { fire } from '@fastly/hono-fastly-compute' 3 | 4 | const app = new Hono() 5 | 6 | app.get('/', (c) => { 7 | return c.text('Hello Hono!') 8 | }) 9 | 10 | fire(app) 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | yarn.lock 3 | yarn-error.log 4 | package-lock.json 5 | bin 6 | pkg 7 | .next 8 | deno.lock 9 | 10 | # yarn 11 | .yarn/* 12 | !.yarn/patches 13 | !.yarn/plugins 14 | !.yarn/releases 15 | !.yarn/sdks 16 | !.yarn/versions 17 | -------------------------------------------------------------------------------- /templates/aws-lambda/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | import { handle } from 'hono/aws-lambda' 3 | 4 | const app = new Hono() 5 | 6 | app.get('/', (c) => { 7 | return c.text('Hello Hono!') 8 | }) 9 | 10 | export const handler = handle(app) 11 | -------------------------------------------------------------------------------- /templates/lambda-edge/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | import { handle } from 'hono/lambda-edge' 3 | 4 | const app = new Hono() 5 | 6 | app.get('/', (c) => { 7 | return c.text('Hello Hono!') 8 | }) 9 | 10 | export const handler = handle(app) 11 | -------------------------------------------------------------------------------- /templates/vercel/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hono", 3 | "type": "module", 4 | "dependencies": { 5 | "hono": "^4.11.1" 6 | }, 7 | "devDependencies": { 8 | "@types/node": "^20.11.17", 9 | "tsx": "^4.7.1", 10 | "typescript": "^5.8.3" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /templates/cloudflare-pages/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | import { renderer } from './renderer' 3 | 4 | const app = new Hono() 5 | 6 | app.use(renderer) 7 | 8 | app.get('/', (c) => { 9 | return c.render(

Hello!

) 10 | }) 11 | 12 | export default app 13 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/vite.config.ts: -------------------------------------------------------------------------------- 1 | import { cloudflare } from '@cloudflare/vite-plugin' 2 | import { defineConfig } from 'vite' 3 | import ssrPlugin from 'vite-ssr-components/plugin' 4 | 5 | export default defineConfig({ 6 | plugins: [cloudflare(), ssrPlugin()] 7 | }) 8 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/src/index.tsx: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | import { renderer } from './renderer' 3 | 4 | const app = new Hono() 5 | 6 | app.use(renderer) 7 | 8 | app.get('/', (c) => { 9 | return c.render(

Hello!

) 10 | }) 11 | 12 | export default app 13 | -------------------------------------------------------------------------------- /templates/deno/deno.json: -------------------------------------------------------------------------------- 1 | { 2 | "imports": { 3 | "hono": "jsr:@hono/hono@^4.11.1" 4 | }, 5 | "tasks": { 6 | "start": "deno run --allow-net main.ts" 7 | }, 8 | "compilerOptions": { 9 | "jsx": "precompile", 10 | "jsxImportSource": "hono/jsx" 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /templates/netlify/netlify/edge-functions/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'jsr:@hono/hono' 2 | import { handle } from 'jsr:@hono/hono/netlify' 3 | 4 | const app = new Hono() 5 | 6 | app.get('/', (c) => { 7 | return c.text('Hello Hono!') 8 | }) 9 | 10 | export default handle(app) 11 | -------------------------------------------------------------------------------- /templates/nextjs/next-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | 5 | // NOTE: This file should not be edited 6 | // see https://nextjs.org/docs/app/api-reference/config/typescript for more information. 7 | -------------------------------------------------------------------------------- /templates/nextjs/app/api/[...route]/route.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | import { handle } from 'hono/vercel' 3 | 4 | const app = new Hono().basePath('/api') 5 | 6 | app.get('/hello', (c) => { 7 | return c.json({ 8 | message: 'Hello from Hono!' 9 | }) 10 | }) 11 | 12 | export const GET = handle(app) 13 | -------------------------------------------------------------------------------- /templates/aws-lambda/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "types": [ 9 | "node" 10 | ], 11 | "jsx": "react-jsx", 12 | "jsxImportSource": "hono/jsx", 13 | } 14 | } -------------------------------------------------------------------------------- /templates/lambda-edge/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "types": [ 9 | "node" 10 | ], 11 | "jsx": "react-jsx", 12 | "jsxImportSource": "hono/jsx", 13 | } 14 | } -------------------------------------------------------------------------------- /templates/x-basic/app/routes/_error.tsx: -------------------------------------------------------------------------------- 1 | import type { ErrorHandler } from 'hono' 2 | 3 | const handler: ErrorHandler = (e, c) => { 4 | if ('getResponse' in e) { 5 | return e.getResponse() 6 | } 7 | console.error(e.message) 8 | c.status(500) 9 | return c.render('Internal Server Error') 10 | } 11 | 12 | export default handler 13 | -------------------------------------------------------------------------------- /templates/cloudflare-workers/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "lib": [ 9 | "ESNext" 10 | ], 11 | "jsx": "react-jsx", 12 | "jsxImportSource": "hono/jsx" 13 | }, 14 | } -------------------------------------------------------------------------------- /templates/vercel/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "NodeNext", 5 | "strict": true, 6 | "skipLibCheck": true, 7 | "types": ["node"], 8 | "jsx": "react-jsx", 9 | "jsxImportSource": "hono/jsx", 10 | "outDir": "./dist" 11 | }, 12 | "exclude": ["node_modules"] 13 | } 14 | -------------------------------------------------------------------------------- /templates/cloudflare-pages/src/renderer.tsx: -------------------------------------------------------------------------------- 1 | import { jsxRenderer } from 'hono/jsx-renderer' 2 | 3 | export const renderer = jsxRenderer(({ children }) => { 4 | return ( 5 | 6 | 7 | 8 | 9 | {children} 10 | 11 | ) 12 | }) 13 | -------------------------------------------------------------------------------- /templates/vercel/src/index.ts: -------------------------------------------------------------------------------- 1 | import { Hono } from 'hono' 2 | 3 | const app = new Hono() 4 | 5 | const welcomeStrings = [ 6 | 'Hello Hono!', 7 | 'To learn more about Hono on Vercel, visit https://vercel.com/docs/frameworks/backend/hono' 8 | ] 9 | 10 | app.get('/', (c) => { 11 | return c.text(welcomeStrings.join('\n\n')) 12 | }) 13 | 14 | export default app 15 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "starters", 3 | "version": "0.0.0", 4 | "private": true, 5 | "workspaces": [ 6 | "templates/*" 7 | ], 8 | "scripts": { 9 | "format": "prettier 'templates/**/*.{ts,tsx}' --write" 10 | }, 11 | "license": "MIT", 12 | "packageManager": "yarn@3.4.1", 13 | "devDependencies": { 14 | "prettier": "^3.3.3" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /templates/nodejs/src/index.ts: -------------------------------------------------------------------------------- 1 | import { serve } from '@hono/node-server' 2 | import { Hono } from 'hono' 3 | 4 | const app = new Hono() 5 | 6 | app.get('/', (c) => { 7 | return c.text('Hello Hono!') 8 | }) 9 | 10 | serve({ 11 | fetch: app.fetch, 12 | port: 3000 13 | }, (info) => { 14 | console.log(`Server is running on http://localhost:${info.port}`) 15 | }) 16 | -------------------------------------------------------------------------------- /templates/cloudflare-pages/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "lib": [ 9 | "ESNext" 10 | ], 11 | "types": ["vite/client"], 12 | "jsx": "react-jsx", 13 | "jsxImportSource": "hono/jsx" 14 | }, 15 | } -------------------------------------------------------------------------------- /templates/cloudflare-workers/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "dev": "wrangler dev", 5 | "deploy": "wrangler deploy --minify", 6 | "cf-typegen": "wrangler types --env-interface CloudflareBindings" 7 | }, 8 | "dependencies": { 9 | "hono": "^4.11.1" 10 | }, 11 | "devDependencies": { 12 | "wrangler": "^4.4.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "lib": [ 9 | "ESNext" 10 | ], 11 | "types": ["vite/client"], 12 | "jsx": "react-jsx", 13 | "jsxImportSource": "hono/jsx" 14 | }, 15 | } -------------------------------------------------------------------------------- /templates/fastly/fastly.toml: -------------------------------------------------------------------------------- 1 | # This file describes a Fastly Compute@Edge package. To learn more visit: 2 | # https://developer.fastly.com/reference/fastly-toml/ 3 | 4 | name = "Hono" 5 | authors = [""] 6 | description = "Starter for Hono" 7 | language = "javascript" 8 | manifest_version = 3 9 | service_id = "" 10 | 11 | [scripts] 12 | build = "npm run build" 13 | post_init = "npm install" 14 | -------------------------------------------------------------------------------- /templates/nodejs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "NodeNext", 5 | "strict": true, 6 | "verbatimModuleSyntax": true, 7 | "skipLibCheck": true, 8 | "types": [ 9 | "node" 10 | ], 11 | "jsx": "react-jsx", 12 | "jsxImportSource": "hono/jsx", 13 | "outDir": "./dist" 14 | }, 15 | "exclude": ["node_modules"] 16 | } 17 | -------------------------------------------------------------------------------- /templates/vercel/README.md: -------------------------------------------------------------------------------- 1 | Prerequisites: 2 | 3 | - [Vercel CLI](https://vercel.com/docs/cli) installed globally 4 | 5 | To develop locally: 6 | 7 | ``` 8 | npm install 9 | vc dev 10 | ``` 11 | 12 | ``` 13 | open http://localhost:3000 14 | ``` 15 | 16 | To build locally: 17 | 18 | ``` 19 | npm install 20 | vc build 21 | ``` 22 | 23 | To deploy: 24 | 25 | ``` 26 | npm install 27 | vc deploy 28 | ``` 29 | -------------------------------------------------------------------------------- /templates/fastly/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es2022", 4 | "module": "ESNext", 5 | "moduleResolution": "bundler", 6 | "skipLibCheck": true, 7 | "lib": ["es2022"], 8 | "esModuleInterop": true, 9 | "isolatedModules": true, 10 | "erasableSyntaxOnly": true, 11 | "customConditions": [ "fastly" ], 12 | "types": [ "@fastly/js-compute" ], 13 | } 14 | } -------------------------------------------------------------------------------- /templates/cloudflare-pages/vite.config.ts: -------------------------------------------------------------------------------- 1 | import build from '@hono/vite-build/cloudflare-pages' 2 | import devServer from '@hono/vite-dev-server' 3 | import adapter from '@hono/vite-dev-server/cloudflare' 4 | import { defineConfig } from 'vite' 5 | 6 | export default defineConfig({ 7 | plugins: [ 8 | build(), 9 | devServer({ 10 | adapter, 11 | entry: 'src/index.tsx' 12 | }) 13 | ] 14 | }) 15 | -------------------------------------------------------------------------------- /templates/nextjs/app/layout.tsx: -------------------------------------------------------------------------------- 1 | import type { Metadata } from 'next' 2 | 3 | export const metadata: Metadata = { 4 | title: 'Hono | nextjs', 5 | description: 'Generated by hono' 6 | } 7 | 8 | export default function RootLayout({ 9 | children 10 | }: Readonly<{ 11 | children: React.ReactNode 12 | }>) { 13 | return ( 14 | 15 | {children} 16 | 17 | ) 18 | } 19 | -------------------------------------------------------------------------------- /templates/nodejs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "dev": "tsx watch src/index.ts", 5 | "build": "tsc", 6 | "start": "node dist/index.js" 7 | }, 8 | "dependencies": { 9 | "@hono/node-server": "^1.19.6", 10 | "hono": "^4.11.1" 11 | }, 12 | "devDependencies": { 13 | "@types/node": "^20.11.17", 14 | "tsx": "^4.7.1", 15 | "typescript": "^5.8.3" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /templates/x-basic/app/routes/index.tsx: -------------------------------------------------------------------------------- 1 | import { createRoute } from 'honox/factory' 2 | import Counter from '../islands/counter' 3 | 4 | export default createRoute((c) => { 5 | const name = c.req.query('name') ?? 'Hono' 6 | return c.render( 7 |
8 | {name} 9 |

Hello, {name}!

10 | 11 |
12 | ) 13 | }) 14 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/src/renderer.tsx: -------------------------------------------------------------------------------- 1 | import { jsxRenderer } from 'hono/jsx-renderer' 2 | import { Link, ViteClient } from 'vite-ssr-components/hono' 3 | 4 | export const renderer = jsxRenderer(({ children }) => { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | {children} 12 | 13 | ) 14 | }) 15 | -------------------------------------------------------------------------------- /templates/fastly/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "build": "js-compute-runtime ./src/index.ts ./bin/main.wasm", 5 | "start": "fastly compute serve", 6 | "deploy": "fastly compute publish" 7 | }, 8 | "dependencies": { 9 | "@fastly/hono-fastly-compute": "^0.3.6", 10 | "@fastly/js-compute": "^3.35.1", 11 | "hono": "^4.11.1" 12 | }, 13 | "devDependencies": { 14 | "@fastly/cli": "^12.0.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /templates/nodejs/.gitignore: -------------------------------------------------------------------------------- 1 | # dev 2 | .yarn/ 3 | !.yarn/releases 4 | .vscode/* 5 | !.vscode/launch.json 6 | !.vscode/*.code-snippets 7 | .idea/workspace.xml 8 | .idea/usage.statistics.xml 9 | .idea/shelf 10 | 11 | # deps 12 | node_modules/ 13 | 14 | # env 15 | .env 16 | .env.production 17 | 18 | # logs 19 | logs/ 20 | *.log 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | pnpm-debug.log* 25 | lerna-debug.log* 26 | 27 | # misc 28 | .DS_Store 29 | -------------------------------------------------------------------------------- /templates/vercel/.gitignore: -------------------------------------------------------------------------------- 1 | # dev 2 | .yarn/ 3 | !.yarn/releases 4 | .vscode/* 5 | !.vscode/launch.json 6 | !.vscode/*.code-snippets 7 | .idea/workspace.xml 8 | .idea/usage.statistics.xml 9 | .idea/shelf 10 | 11 | # deps 12 | node_modules/ 13 | 14 | # env 15 | .env 16 | .env.production 17 | 18 | # logs 19 | logs/ 20 | *.log 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | pnpm-debug.log* 25 | lerna-debug.log* 26 | 27 | # misc 28 | .DS_Store 29 | .vercel 30 | -------------------------------------------------------------------------------- /templates/x-basic/app/islands/counter.tsx: -------------------------------------------------------------------------------- 1 | import { useState } from 'hono/jsx' 2 | 3 | export default function Counter() { 4 | const [count, setCount] = useState(0) 5 | return ( 6 |
7 |

{count}

8 | 14 |
15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /templates/netlify/.gitignore: -------------------------------------------------------------------------------- 1 | # dev 2 | .netlify/ 3 | .yarn/ 4 | !.yarn/releases 5 | .vscode/* 6 | !.vscode/launch.json 7 | !.vscode/*.code-snippets 8 | .idea/workspace.xml 9 | .idea/usage.statistics.xml 10 | .idea/shelf 11 | 12 | # deps 13 | node_modules/ 14 | 15 | # env 16 | .env 17 | .env.production 18 | 19 | # logs 20 | logs/ 21 | *.log 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | pnpm-debug.log* 26 | lerna-debug.log* 27 | 28 | # misc 29 | .DS_Store 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hono Starter Templates 2 | 3 | You can start to build a Hono application with `create hono` command: 4 | 5 | ```bash 6 | # npm 7 | npm create hono@latest 8 | 9 | # yarn 10 | yarn create hono 11 | 12 | # pnpm 13 | pnpm create hono@latest 14 | 15 | # bun 16 | bun create hono@latest 17 | 18 | # deno 19 | deno run -A npm:create-hono@latest 20 | ``` 21 | 22 | ## Author 23 | 24 | Yusuke Wada 25 | 26 | and Hono contributors 27 | 28 | ## License 29 | 30 | MIT 31 | -------------------------------------------------------------------------------- /templates/aws-lambda/.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | lambda.zip 4 | 5 | # dev 6 | .yarn/ 7 | !.yarn/releases 8 | .vscode/* 9 | !.vscode/launch.json 10 | !.vscode/*.code-snippets 11 | .idea/workspace.xml 12 | .idea/usage.statistics.xml 13 | .idea/shelf 14 | 15 | # deps 16 | node_modules/ 17 | 18 | # env 19 | .env 20 | .env.production 21 | 22 | # logs 23 | logs/ 24 | *.log 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | pnpm-debug.log* 29 | lerna-debug.log* 30 | 31 | # misc 32 | .DS_Store 33 | -------------------------------------------------------------------------------- /templates/lambda-edge/.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | lambda.zip 4 | 5 | # dev 6 | .yarn/ 7 | !.yarn/releases 8 | .vscode/* 9 | !.vscode/launch.json 10 | !.vscode/*.code-snippets 11 | .idea/workspace.xml 12 | .idea/usage.statistics.xml 13 | .idea/shelf 14 | 15 | # deps 16 | node_modules/ 17 | 18 | # env 19 | .env 20 | .env.production 21 | 22 | # logs 23 | logs/ 24 | *.log 25 | npm-debug.log* 26 | yarn-debug.log* 27 | yarn-error.log* 28 | pnpm-debug.log* 29 | lerna-debug.log* 30 | 31 | # misc 32 | .DS_Store 33 | -------------------------------------------------------------------------------- /templates/nextjs/app/page.tsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | import { useEffect, useState } from 'react' 3 | 4 | export default function Home() { 5 | const [message, setMessage] = useState() 6 | 7 | useEffect(() => { 8 | const fetchData = async () => { 9 | const res = await fetch('/api/hello') 10 | const { message } = await res.json() 11 | setMessage(message) 12 | } 13 | fetchData() 14 | }, []) 15 | 16 | if (!message) return

Loading...

17 | 18 | return

{message}

19 | } 20 | -------------------------------------------------------------------------------- /templates/x-basic/vite.config.ts: -------------------------------------------------------------------------------- 1 | import build from '@hono/vite-build/cloudflare-workers' 2 | import adapter from '@hono/vite-dev-server/cloudflare' 3 | import tailwindcss from '@tailwindcss/vite' 4 | import honox from 'honox/vite' 5 | import { defineConfig } from 'vite' 6 | 7 | export default defineConfig({ 8 | plugins: [ 9 | honox({ 10 | devServer: { adapter }, 11 | client: { input: ['/app/client.ts', '/app/style.css'] } 12 | }), 13 | tailwindcss(), 14 | build() 15 | ] 16 | }) 17 | -------------------------------------------------------------------------------- /templates/cloudflare-pages/README.md: -------------------------------------------------------------------------------- 1 | ```txt 2 | npm install 3 | npm run dev 4 | ``` 5 | 6 | ```txt 7 | npm run deploy 8 | ``` 9 | 10 | [For generating/synchronizing types based on your Worker configuration run](https://developers.cloudflare.com/workers/wrangler/commands/#types): 11 | 12 | ```txt 13 | npm run cf-typegen 14 | ``` 15 | 16 | Pass the `CloudflareBindings` as generics when instantiation `Hono`: 17 | 18 | ```ts 19 | // src/index.ts 20 | const app = new Hono<{ Bindings: CloudflareBindings }>() 21 | ``` 22 | -------------------------------------------------------------------------------- /templates/cloudflare-workers/README.md: -------------------------------------------------------------------------------- 1 | ```txt 2 | npm install 3 | npm run dev 4 | ``` 5 | 6 | ```txt 7 | npm run deploy 8 | ``` 9 | 10 | [For generating/synchronizing types based on your Worker configuration run](https://developers.cloudflare.com/workers/wrangler/commands/#types): 11 | 12 | ```txt 13 | npm run cf-typegen 14 | ``` 15 | 16 | Pass the `CloudflareBindings` as generics when instantiation `Hono`: 17 | 18 | ```ts 19 | // src/index.ts 20 | const app = new Hono<{ Bindings: CloudflareBindings }>() 21 | ``` 22 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/README.md: -------------------------------------------------------------------------------- 1 | ```txt 2 | npm install 3 | npm run dev 4 | ``` 5 | 6 | ```txt 7 | npm run deploy 8 | ``` 9 | 10 | [For generating/synchronizing types based on your Worker configuration run](https://developers.cloudflare.com/workers/wrangler/commands/#types): 11 | 12 | ```txt 13 | npm run cf-typegen 14 | ``` 15 | 16 | Pass the `CloudflareBindings` as generics when instantiation `Hono`: 17 | 18 | ```ts 19 | // src/index.ts 20 | const app = new Hono<{ Bindings: CloudflareBindings }>() 21 | ``` 22 | -------------------------------------------------------------------------------- /templates/x-basic/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "module": "ESNext", 5 | "moduleResolution": "Bundler", 6 | "strict": true, 7 | "skipLibCheck": true, 8 | "lib": [ 9 | "ESNext", 10 | "DOM" 11 | ], 12 | "types": [ 13 | "vite/client", 14 | "@cloudflare/workers-types/2023-07-01" 15 | ], 16 | "jsx": "react-jsx", 17 | "jsxImportSource": "hono/jsx" 18 | }, 19 | "include": [ 20 | "**/*.ts", 21 | "**/*.tsx" 22 | ] 23 | } -------------------------------------------------------------------------------- /templates/cloudflare-pages/.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | 4 | # dev 5 | .yarn/ 6 | !.yarn/releases 7 | .vscode/* 8 | !.vscode/launch.json 9 | !.vscode/*.code-snippets 10 | .idea/workspace.xml 11 | .idea/usage.statistics.xml 12 | .idea/shelf 13 | 14 | # deps 15 | node_modules/ 16 | .wrangler 17 | 18 | # env 19 | .env 20 | .env.production 21 | .dev.vars 22 | 23 | # logs 24 | logs/ 25 | *.log 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | pnpm-debug.log* 30 | lerna-debug.log* 31 | 32 | # misc 33 | .DS_Store 34 | -------------------------------------------------------------------------------- /templates/cloudflare-workers/.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | 4 | # dev 5 | .yarn/ 6 | !.yarn/releases 7 | .vscode/* 8 | !.vscode/launch.json 9 | !.vscode/*.code-snippets 10 | .idea/workspace.xml 11 | .idea/usage.statistics.xml 12 | .idea/shelf 13 | 14 | # deps 15 | node_modules/ 16 | .wrangler 17 | 18 | # env 19 | .env 20 | .env.production 21 | .dev.vars 22 | 23 | # logs 24 | logs/ 25 | *.log 26 | npm-debug.log* 27 | yarn-debug.log* 28 | yarn-error.log* 29 | pnpm-debug.log* 30 | lerna-debug.log* 31 | 32 | # misc 33 | .DS_Store 34 | -------------------------------------------------------------------------------- /templates/x-basic/.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | 4 | # dev 5 | .hono/ 6 | .wrangler/ 7 | .yarn/ 8 | !.yarn/releases 9 | .vscode/* 10 | !.vscode/launch.json 11 | !.vscode/*.code-snippets 12 | .idea/workspace.xml 13 | .idea/usage.statistics.xml 14 | .idea/shelf 15 | 16 | # deps 17 | node_modules/ 18 | 19 | # env 20 | .env 21 | .env.production 22 | .dev.vars 23 | 24 | # logs 25 | logs/ 26 | *.log 27 | npm-debug.log* 28 | yarn-debug.log* 29 | yarn-error.log* 30 | pnpm-debug.log* 31 | lerna-debug.log* 32 | 33 | # misc 34 | .DS_Store 35 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/.gitignore: -------------------------------------------------------------------------------- 1 | # prod 2 | dist/ 3 | dist-server/ 4 | 5 | # dev 6 | .yarn/ 7 | !.yarn/releases 8 | .vscode/* 9 | !.vscode/launch.json 10 | !.vscode/*.code-snippets 11 | .idea/workspace.xml 12 | .idea/usage.statistics.xml 13 | .idea/shelf 14 | 15 | # deps 16 | node_modules/ 17 | .wrangler 18 | 19 | # env 20 | .env 21 | .env.production 22 | .dev.vars 23 | 24 | # logs 25 | logs/ 26 | *.log 27 | npm-debug.log* 28 | yarn-debug.log* 29 | yarn-error.log* 30 | pnpm-debug.log* 31 | lerna-debug.log* 32 | 33 | # misc 34 | .DS_Store 35 | -------------------------------------------------------------------------------- /templates/aws-lambda/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "build": "esbuild --bundle --outfile=./dist/index.js --platform=node --target=node20 ./src/index.ts", 5 | "zip": "zip -j lambda.zip dist/index.js", 6 | "update": "aws lambda update-function-code --zip-file fileb://lambda.zip --function-name hello", 7 | "deploy": "run-s build zip update" 8 | }, 9 | "devDependencies": { 10 | "esbuild": "^0.21.4", 11 | "npm-run-all2": "^6.2.0" 12 | }, 13 | "dependencies": { 14 | "hono": "^4.11.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /templates/cloudflare-pages/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build", 6 | "preview": "wrangler pages dev", 7 | "deploy": "$npm_execpath run build && wrangler pages deploy", 8 | "cf-typegen": "wrangler types --env-interface CloudflareBindings" 9 | }, 10 | "dependencies": { 11 | "hono": "^4.11.1" 12 | }, 13 | "devDependencies": { 14 | "@hono/vite-build": "^1.2.0", 15 | "@hono/vite-dev-server": "^0.18.2", 16 | "vite": "^6.3.5", 17 | "wrangler": "^4.4.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /templates/nextjs/eslint.config.mjs: -------------------------------------------------------------------------------- 1 | import { dirname } from 'path' 2 | import { fileURLToPath } from 'url' 3 | import { FlatCompat } from '@eslint/eslintrc' 4 | 5 | const __filename = fileURLToPath(import.meta.url) 6 | const __dirname = dirname(__filename) 7 | 8 | const compat = new FlatCompat({ 9 | baseDirectory: __dirname 10 | }) 11 | 12 | const eslintConfig = [ 13 | ...compat.extends('next/core-web-vitals', 'next/typescript'), 14 | { 15 | ignores: ['node_modules/**', '.next/**', 'out/**', 'build/**', 'next-env.d.ts'] 16 | } 17 | ] 18 | 19 | export default eslintConfig 20 | -------------------------------------------------------------------------------- /templates/cloudflare-workers+vite/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build", 6 | "preview": "$npm_execpath run build && vite preview", 7 | "deploy": "$npm_execpath run build && wrangler deploy", 8 | "cf-typegen": "wrangler types --env-interface CloudflareBindings" 9 | }, 10 | "dependencies": { 11 | "hono": "^4.11.1" 12 | }, 13 | "devDependencies": { 14 | "@cloudflare/vite-plugin": "^1.2.3", 15 | "vite": "^6.3.5", 16 | "vite-ssr-components": "^0.5.1", 17 | "wrangler": "^4.17.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /templates/nextjs/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "type": "module", 3 | "scripts": { 4 | "dev": "next dev", 5 | "build": "next build", 6 | "start": "next start", 7 | "lint": "eslint" 8 | }, 9 | "dependencies": { 10 | "hono": "^4.11.1", 11 | "next": "15.5.2", 12 | "react": "19.1.0", 13 | "react-dom": "19.1.0" 14 | }, 15 | "devDependencies": { 16 | "@eslint/eslintrc": "^3", 17 | "@types/node": "^20", 18 | "@types/react": "^19", 19 | "@types/react-dom": "^19", 20 | "eslint": "^9", 21 | "eslint-config-next": "15.5.2", 22 | "typescript": "^5" 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /templates/x-basic/app/routes/_renderer.tsx: -------------------------------------------------------------------------------- 1 | import { jsxRenderer } from 'hono/jsx-renderer' 2 | import { Link, Script } from 'honox/server' 3 | 4 | export default jsxRenderer(({ children }) => { 5 | return ( 6 | 7 | 8 | 9 | 10 | 11 | 12 |