/htmx-forms

Validating forms with HTMX using Zod, styled with DaisyUI

Primary LanguageTypeScript

HTMX Forms

A simple example of how to valdate forms using HTMX and Zod. It uses Express with TypeScript as the backend and JSX as the templating engine. There's also a corresponding blog post explaining how this works: Form validation with HTMX and Zod.

Prerequisites

  • Node v18 (LTS) or above
  • PNPM

Steps

  • Clone this repo
  • Run pnpm i
  • Use any one of the below commands

Commands

  • pnpm dev - Runs the development server with ESBuild (building TypeScript), Tailwind (building CSS), and Nodemon (watching for changes)
  • pnpm build - Builds the server for production using ESBuild
  • pnpm start - Start the built app