Hono Starter Templates

repository·main·Indexed 41 days ago

https://github.com/honojs/starter

A collection of pre-configured starter templates for Hono, providing environments for various runtimes and platforms including Bun, Cloudflare Workers, Cloudflare Pages, AWS Lambda, AWS Lambda@Edge, Node.js, Deno, Fastly, Vercel, and Next.js. Includes instructions for scaffolding projects via `create-hono` and platform-specific deployment and development guides.

Tokens
5.1K
Snippets
39
Records
39
Agent score
50%

What's inside Hono Starters

  1. Run the Fastly Hono starter locally

    main

    To run the Fastly template on your local machine for development, use the following commands:

    1. Install dependencies: npm install
    2. Start the development server: npm run start
    3. Access the application at http://localhost:7676
    npm install
    npm run start
    
    # Open http://localhost:7676
  2. Use typed bindings for Fastly resources

    main

    To get type safety for your Fastly resources (like KV Stores or Config Stores), use buildFire from @fastly/hono-fastly-compute instead of the standard fire.

    1. Call buildFire with an object mapping your desired resource names to their Fastly types (e.g., 'KVStore' or 'ConfigStore:name').
    2. Pass fire.Bindings as the generic parameter to the Hono constructor to enable typed access to these resources within your routes.
    import { buildFire } from '@fastly/hono-fastly-compute'
    
    // Define your resources
    const fire = buildFire({
      assets: 'KVStore', // A KV Store named 'assets'
      mySettings: 'ConfigStore:my-settings' // A Config Store named 'my-settings'
    })
    
    // Pass fire.Bindings as the generic parameter
    const app = new Hono<{ Bindings: fire.Bindings }>()
  3. Develop locally with the Vercel template

    main

    To start a local development server for this Hono template, ensure you have the Vercel CLI installed globally. Run the following commands to install dependencies and start the development environment:

    1. Install dependencies: npm install
    2. Start development server: vc dev
    3. Access the application at http://localhost:3000
    npm install
    vc dev