Frontend developers often struggle to handle form submissions on static websites without relying on paid, third-party services. Ghost Form solves this by providing a lightweight, self-hosted backend that seamlessly captures, stores, and manages form submissions.
Built with a focus on developer experience and data privacy, it features a premium, spacious UI and a robust Node.js + Prisma backend. No more monthly fees or data sharing with third parties!
- 🔒 Privacy-First: Your data stays on your own server. Zero third-party tracking.
- ⚡ Lightweight & Fast: Built with vanilla Node.js, Express, and Prisma ORM.
- 🎨 Premium UI: Modern, spacious design with 16dp rounded corners and clean aesthetics.
- 🎛️ Dynamic Form Creation: Create unlimited forms instantly via the dashboard UI (no coding required).
- 📊 Built-in Dashboard: View, filter, and manage all submissions in a clean, responsive table.
- 📥 One-Click CSV Export: Download your form data instantly for offline use.
- ⚡ Integration Guide: Built-in code snippets (HTML & JS) with one-click copy for instant website integration.
- 🛡️ Spam Protection Ready: Architecture supports easy addition of honeypot fields and rate limiting.
*A clean, modern form ready to be embedded in any static website.*
*Create forms dynamically, copy endpoints, and view submissions with a single click.*
- Backend: Node.js, Express.js
- Database: MySQL
- ORM: Prisma
- Frontend: Vanilla JavaScript, HTML5, Custom CSS (Tailwind-inspired design system)
Follow these simple steps to get Ghost Form running on your local machine.
Make sure you have the following installed:
- Node.js (v18 or higher) - Download here
- MySQL Database (e.g., XAMPP, MySQL Workbench, or a cloud provider like PlanetScale)
-
Clone the repository
git clone https://github.com/khdcoder/Ghost-Form.git cd Ghost-Form -
Install dependencies
npm install
-
Create the Database
Open your MySQL client (e.g., phpMyAdmin in XAMPP) and run:CREATE DATABASE ghost_form;
-
Set up Environment Variables
Create a.envfile in the root directory and add your database connection string.
(Note: If using XAMPP, the default password is empty, so leave it blank after the colon)DATABASE_URL="mysql://root:YOUR_PASSWORD@localhost:3306/ghost_form" PORT=3000
-
Push the Database Schema
npx prisma db push
(This will create the
FormandSubmissiontables in your database). -
Start the Server
node src/server.js
The server will start on
http://localhost:3000.
- Go to the Dashboard: Open
http://localhost:3000/dashboard.html - Create a Form: Click "✨ Create New Form", give it a name (e.g.,
contact-us), and click Create. - Integrate: Click the "⚡ Integration Guide" dropdown, copy the HTML code, and paste it into your website. That's it!
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/forms |
Fetch a list of all created forms and their submission counts |
POST |
/api/forms |
Create a new form (Requires { "slug": "your-form-name" } in body) |
POST |
/api/submit/:slug |
Submit data to a specific form endpoint |
GET |
/api/submissions/:slug |
Fetch all submissions for a specific form |
- Error:
Cannot find module '.prisma/client'
→ Runnpx prisma generateand thennpx prisma db push. - Error:
Access denied for user 'root'
→ Check your.envfile. If using XAMPP, ensure the URL ismysql://root:@localhost:3306/ghost_form(notice the empty password). - Error:
Unknown database 'ghost_form'
→ You forgot to create the database. RunCREATE DATABASE ghost_form;in your MySQL client.
- Month 1: Core backend, Prisma MySQL integration, Premium UI Dashboard, Dynamic Form Creation, and CSV Export.
- Month 2: Email notifications (Nodemailer) and advanced spam protection (Honeypot).
- Month 3: Webhooks support (Discord/Zapier) and Docker deployment configuration.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
