@calvinbonner/minifw
v0.2.1
Published
A simple, server-side framework for building hypermedia apps quickly with HTMX.
Maintainers
Readme
Mini Framework
MiniFW is a server-rendered framework for HTMX applications. It keeps application state on the server and renders HTML responses, with a small client runtime only for HTMX navigation and scoped styles.
Installation
# deno
deno add jsr:@calvinbonner/minifw
# npm
npx jsr add @calvinbonner/minifw
# pnpm
pnpm dlx jsr add @calvinbonner/minifw
# bun
bunx jsr add @calvinbonner/minifw
# yarn
yarn dlx jsr add @calvinbonner/minifwOr, when using Deno, you can import directly from JSR without installing:
import { mini, page } from "jsr:@calvinbonner/minifw/core";# npm
npm install @calvinbonner/minifw
# pnpm
pnpm add @calvinbonner/minifw
# bun
bun add @calvinbonner/minifw
# yarn
yarn add @calvinbonner/minifw[!NOTE]
MiniFW requires Bun
1.4or later to run themini()server.
Minimal Application
import { layout, mini, page } from "@calvinbonner/minifw/core";
import { html } from "@calvinbonner/minifw/helpers";
mini({
port: 3000,
layouts: {
"*": layout(({ page }) => html`<main id="app">${page}</main>`, {
pageTarget: "#app",
}),
},
routes: {
"/": page(
() => html`
<h1>Welcome to MiniFW</h1>
<p>This page is rendered on the server.</p>
`,
),
"/about": page(() => html`<h1>About</h1>`),
},
});Run the application with bun ., then open http://localhost:3000. MiniFW
creates the document, serves each page, and uses HTMX to swap the #app target
on boosted navigation.
Documentation
Read the full guides and API reference at minifw.calvinbonner.dev.
