A simple and modern contact form built with Next.js and integrated with Formspree for easy form submission handling.
This project provides a ready-to-use contact form template with client-side validation and Formspree integration. It's designed to be a clean, minimal example that developers can use as a reference or starting point for their own projects.
- Clean and responsive contact form UI
- Client-side form validation (required fields and email format)
- Formspree integration for backend form handling
- Framework: Next.js 16
- Runtime: React 19
- Language: TypeScript
- Form Service: @formspree/react
next-formspree-template/
├── app/
│ ├── components/
│ │ └── ContactForm.tsx # Contact form component with validation
│ ├── favicon.ico # Site favicon
│ ├── globals.css # Global styles
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── public/ # Static assets
├── .env.example # Environment variables example
├── next.config.ts # Next.js configuration
├── package.json # Dependencies and scripts
└── tsconfig.json # TypeScript configuration
- Node.js 18.x or later
- Clone the repository:
git clone <repository-url>
cd next-formspree-template- Install dependencies:
npm install- Set up environment variables:
cp .env.example .env.local- Edit
.env.localand add your Formspree form ID:
NEXT_PUBLIC_FORM=your_form_id
- Go to Formspree and create an account
- Create a new form
- Copy your form ID (e.g.,
xabcdefg) - Add the form ID to your
.env.localfile
Start the development server:
npm run devBuild for production:
npm run buildThis project is configured for static export. The next.config.ts includes:
const nextConfig: NextConfig = {
output: "export",
};This generates a fully static site, ready for deployment to any static hosting service.
MIT