hono-preact
Overview
Quick Start
The Route Table
Layouts & Nesting
Adding Pages
Head Management
Active Links
Signals
Server Loaders
Loading States
Reloading Data
Prefetching
Streaming
Live Loaders
Realtime Channels
Server Actions
Validation
Optimistic UI
Server Caller
View Transitions
Middleware
CSRF Protection
CLI
Vite Config
Project Structure
Styling
Composing Hono Middleware
WebSockets
Rooms & Presence
renderPage
Link Prefetch
Build & Deploy
Overview
Dialog
Popover
Tooltip
Menu
Context Menu
Select
Combobox
Toast
renderElement
useControllableState
mergeRefs
useListNavigation
useTypeahead
useListboxSelection
usePosition
usePositioner
useDismiss

CLI#

One command gets you from nothing to a running hono-preact app: create-hono-preact scaffolds the project, installs dependencies, and initializes a git repo. It also has an add-agents subcommand for dropping framework guidance into a project you set up manually.

Create a new app#

npm create hono-preact

Run with no arguments and the wizard walks you through it: project directory, adapter (Cloudflare Workers or a Node server), whether to add hono-preact-ui components, and whether to install dependencies and initialize git. Because the common path takes no flags, there is nothing for npm to mis-parse.

The CLI requires Node ^22.18.0 || >=24.11.0 (the range hono-preact itself supports) and exits with a clear message on an older Node before anything is scaffolded. --help, --version, and add-agents work on any Node.

You can pass a directory and skip prompts with flags for scripting or CI:

# pnpm/yarn/bun forward flags directly:
pnpm create hono-preact my-app --adapter node --ui --yes
# npm needs a `--` separator before tool flags:
npm create hono-preact my-app -- --adapter node --ui --yes

Options#

FlagDescription
--adapter <cloudflare|node>Choose the deployment target (prompted otherwise).
--ui, --no-uiInclude or exclude hono-preact-ui components.
--no-installSkip the dependency install step.
--no-gitSkip git init.
-y, --yesAccept defaults for anything not specified (no prompts).
--skip-hintsSuppress the "Next steps" note.
--version, -vPrint the CLI version.
--help, -hPrint usage.

In a non-interactive shell (CI, piped input), the CLI never prompts: it uses your flags plus defaults (adapter cloudflare, UI off, install on, git on), and a missing directory is an error. With npm, put tool flags after --.

Add agent guidance to an existing app#

If you added hono-preact to a project you did not scaffold (for example with pnpm add hono-preact), drop in the guidance an AI coding agent reads:

npx create-hono-preact add-agents

It writes AGENTS.md (framework conventions for any AI coding agent), a one-line CLAUDE.md pointer, an agents/skills/ directory of step-by-step recipes (add a page, a loader, an action, a guard), and agents/llms-full.txt (the full documentation bundled for offline reference). Existing files are left untouched unless you pass --force.

FlagDefaultDescription
--forceoffOverwrite existing files (AGENTS.md, CLAUDE.md, agents/skills/*.md, agents/llms-full.txt).

See Quick Start for the full walkthrough.