Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

7 Commits

Folders and files

Repository files navigation

StaticForms Examples

Contact form examples for 13 frameworks using StaticForms.dev, a form backend for static sites. Each example is a small app you can deploy to Vercel with one click. None of them need a backend.

📖 For step-by-step walkthroughs, read the StaticForms blog. Each example below links to its tutorial.

Examples

Framework Stack Source Guide Deploy
Next.js Next.js 16 + React 19 apps/next-example Tutorial Deploy with Vercel
Nuxt Nuxt 4 + Vue 3.5 apps/nuxt-example Tutorial Deploy with Vercel
React React 19 + Vite 8 apps/react-example Tutorial Deploy with Vercel
Vue Vue 3.5 + Vite 8 apps/vue-example Tutorial Deploy with Vercel
SvelteKit SvelteKit 3 + Svelte 5 apps/sveltekit-example Tutorial Deploy with Vercel
Astro Astro 7 apps/astro-example Tutorial Deploy with Vercel
Angular Angular 22 apps/angular-example Tutorial Deploy with Vercel
React Router React Router 8 (framework mode) + React 19 apps/react-router-example Tutorial Deploy with Vercel
SolidStart SolidStart 2 + Solid 1.9 apps/solid-start-example Tutorial Deploy with Vercel
Qwik Qwik 1.20 + Qwik City apps/qwik-example Tutorial Deploy with Vercel
Gatsby Gatsby 5 + React 19 apps/gatsby-example Tutorial Deploy with Vercel
Eleventy Eleventy 3 apps/eleventy-example Tutorial Deploy with Vercel
HTML Plain HTML + vanilla JavaScript apps/html-example Tutorial Deploy with Vercel

Every example has the same form (name, email, message), the same loading/success/error states and the same styling. That makes it easy to compare how each framework handles the same task.

Getting Started

Prerequisites

  • Node.js 24 or later (see .nvmrc)
  • pnpm 10 (corepack enable picks up the version pinned in package.json)

Install

git clone https://github.com/static-forms/static-forms-examples.git
cd static-forms-examples
pnpm install

Configure

  1. Create a free account and get your API key at staticforms.dev.
  2. Copy the example env file in the app you want to run and add your key:
cp apps/next-example/env.example apps/next-example/.env.local

Each framework exposes environment variables to the browser differently:

Framework Variable File
Next.js NEXT_PUBLIC_STATICFORMS_API_KEY apps/next-example/.env.local
Nuxt NUXT_PUBLIC_STATICFORMS_API_KEY apps/nuxt-example/.env
React VITE_STATICFORMS_API_KEY apps/react-example/.env.local
Vue VITE_STATICFORMS_API_KEY apps/vue-example/.env.local
SvelteKit PUBLIC_STATICFORMS_API_KEY apps/sveltekit-example/.env
Astro PUBLIC_STATICFORMS_API_KEY apps/astro-example/.env
Angular NG_APP_STATICFORMS_API_KEY apps/angular-example/.env
React Router VITE_STATICFORMS_API_KEY apps/react-router-example/.env
SolidStart VITE_STATICFORMS_API_KEY apps/solid-start-example/.env
Qwik PUBLIC_STATICFORMS_API_KEY apps/qwik-example/.env
Gatsby GATSBY_STATICFORMS_API_KEY apps/gatsby-example/.env.development / .env.production
Eleventy STATICFORMS_API_KEY apps/eleventy-example/.env
HTML STATICFORMS_API_KEY apps/html-example/.env

Run

pnpm dev               # every example at once
pnpm dev:next          # Next.js on http://localhost:3000
pnpm dev:nuxt          # Nuxt on http://localhost:3001
pnpm dev:react         # React on http://localhost:3002
pnpm dev:vue           # Vue on http://localhost:3003
pnpm dev:sveltekit     # SvelteKit on http://localhost:3004
pnpm dev:astro         # Astro on http://localhost:3005
pnpm dev:angular       # Angular on http://localhost:3006
pnpm dev:react-router  # React Router on http://localhost:3007
pnpm dev:solid-start   # SolidStart on http://localhost:3008
pnpm dev:qwik          # Qwik on http://localhost:3009
pnpm dev:gatsby        # Gatsby on http://localhost:3010
pnpm dev:eleventy      # Eleventy on http://localhost:3011
pnpm dev:html          # HTML on http://localhost:3012

Build

pnpm build             # builds every example with Turborepo

Deploying to Vercel

Use the Deploy buttons in the table above. Each one:

  1. Copies this repository into your GitHub account
  2. Creates a Vercel project with the Root Directory set to that example's folder
  3. Asks for that example's API key environment variable

Each app has a vercel.json that installs only that app's dependencies (pnpm install --filter <app>...), so deploys stay fast even though this is a monorepo.

The StaticForms API

All examples send a JSON POST from the browser:

// POST https://api.staticforms.dev/submit
{
  "apiKey": "YOUR_API_KEY",
  "name": "Jane Doe",
  "email": "jane@example.com",
  "message": "Hello!",
  "replyTo": "@",            // reply-to = the sender's email
  "subject": "New Contact Form Submission"
}

Responses:

{ "success": true }
{ "success": false, "message": "Error description" }

See the StaticForms documentation for spam protection (honeypot, reCAPTCHA, Turnstile, ALTCHA), file uploads, redirects, webhooks and integrations.

Project Structure

static-forms-examples/
├── apps/
│   ├── next-example          # Next.js 16 + React 19
│   ├── nuxt-example          # Nuxt 4 + Vue 3.5
│   ├── react-example         # React 19 + Vite 8
│   ├── vue-example           # Vue 3.5 + Vite 8
│   ├── sveltekit-example     # SvelteKit 3 + Svelte 5
│   ├── astro-example         # Astro 7
│   ├── angular-example       # Angular 22
│   ├── react-router-example  # React Router 8 (framework mode) + React 19
│   ├── solid-start-example   # SolidStart 2 + Solid 1.9
│   ├── qwik-example          # Qwik 1.20 + Qwik City
│   ├── gatsby-example        # Gatsby 5 + React 19
│   ├── eleventy-example      # Eleventy 3
│   ├── html-example          # Plain HTML + vanilla JavaScript
├── turbo.json             # Turborepo pipeline
├── pnpm-workspace.yaml    # pnpm workspace
└── package.json

More From StaticForms

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages