Skip to main content

fhvite

Vite plugin for FastHTML/MonsterUI that semi-automates file setup & package installation

Usage

Installation

Install the latest version from pypi:

pip install fhvite

How to use

Import into an existing FastHTML application and add the following:

from fasthtml.common import *

# Add this import
from fhvite.core import add_vite

app = FastHTML()

# Add this line
add_vite(app)

At app startup, add_vite creates missing setup files, runs pybun install, builds assets with pybun run build and adds the entry-point scripts and stylesheets to the app header. Installation follows the project’s lockfile.

For a prebuilt deployment, use add_vite(app, run_build=False). It reads the existing manifest without creating setup files, installing dependencies or building. Both modes serve content-hashed build assets through FastHTML’s StaticImmutable.