Fondu

Introduction

View as Markdown

Fondu is a small meta-framework for full-stack React apps, built on Hono and Vite. It runs on Bun, Cloudflare Workers and Node.

Routes and pages

The files in app/routes/ are the app's URLs: the file path is the URL. A page's file has its Hono handlers, which run on the server, and the page, a React component: the loader renders it with its props.

// app/routes/users/[id].tsx: GET /users/7
export const loader = defineHandler.withValidator({ params })(async (c, { params }) =>
  render(c, Show, { user: await getUser(params.id) }),
)

// the component's props are the page's props; the browser gets this part of the file alone
export default function Show({ user }: { user: User }) {
  return <h1>{user.name}</h1>
}

The first request gets the page rendered on the server. From then on, links and forms are plain <a> and <form>: Fondu's client asks the same route for the next page and its props as JSON, and React swaps the page in place. There is no API to write for your pages and no client-side router to keep in sync with the server: the routes are the only router.

Who does what

PartDone by
HTTP, middleware, CSRF protection, security headersHono and its middleware
Dev server and production buildVite, with @hono/vite-dev-server or @cloudflare/vite-plugin
routes/, pages and layouts, the client, forms' errors and flash data, typed pages and URLs, the document, error and static pagesFondu

So most of what you write on the server is Hono's API, and its docs apply as they are. The pages here cover what Fondu adds.

Next

  • Quick start: create an app and run it.
  • The demo shows Fondu's features, one page each, on Cloudflare Workers.

Last updated