odixon / Formify

An open source application to create, manage and embed contact forms on static/dynamic sites with no code

Home Page:https://formify.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Formify

Formify licence Formify forks Formify stars Formify issues Formify pull-requests

Formify is an open source application that lets you create, manage and embed contact forms on any site without writing code.

This project is done as a part of PlanetScale and HashNode hackathon.

How formify works?

  1. Visit formify.vercel.app
  2. Create an account by signing up
  3. Create a form and copy the script
  4. Embed the script on any site
  5. Whenever somebody submits the form you can see the data in the submissions of Formify dashboard

Sample script that get's copied on clicking the code icon

<script src="https://formify.vercel.app/script.min.js"></script>
<script>
  const fields = 'name,email,message'.split(',').filter((f) => f);
  const formURL = 'https://formify.vercel.app/api/forms/submissions?id=<ID-of-the-form>';
  const heading = 'Contact/feedback';
  formifyInit(fields, formURL, heading);
</script>

To embed forms as components on react based sites, use formify-form npm library

import { Form } from 'formify-form';

const App = () => {
  return (
    <div>
      <Form
        formFields={['name', 'email', 'message']}
        formURL="https://formify.vercel.app/api/forms/submissions?id=<ID from formify>"
        formTitle="Share your feedback"
      />
    </div>
  );
};

Video demo

To see all the above instructions lively, check this demo video below.

FormEasy video demo

Tech stack used in formify

  • NextJS
  • TypeScript
  • PlanetScale MySQL database
  • Prisma ORM
  • Tailwind CSS

To get started with formify setup locally

  1. Clone the repo
git clone https://github.com/Basharath/Formify.git
  1. Install the dependencies
cd Formify
npm install
  1. Set the environment variables as given in .env.example and rename the file to .env
PLANETSCALE_PRISMA_DATABASE_URL=mysql://<USERNAME>:<PLAIN_TEXT_PASSWORD>@<ACCESS_HOST_URL>/<DATABASE_NAME>?sslaccept=strict
JWT_PRIVATE=<Secret key>
SERVER=<URL of the site>
NEXT_PUBLIC_GOOGLE_CLIENT_ID=<Google auth client ID>
  • To get PLANETSCALE_PRISMA_DATABASE_URL sign up and create a database on planetscale.com and get the connection URL for Prisma.
  • Put any secret text for JWT_PRIVATE which is used to sign JWT tokens
  • SERVER is the URL of the site you will be creating. This is used to give the location for the script source.
  • To get NEXT_PUBLIC_GOOGLE_CLIENT_ID visit Google cloud credentials and create a new credentials for the website and get the client ID.
  1. After all the above environment variables are set, run the below command(s).
npx prisma db push
npx prisma generate # This runs automatically in the previous command

This pushes the Prisma schema to the database and generates schema types to use with the Prisma client

  1. Once all the above steps are done, start the dev server by running the following command
npm run dev

Formify app starts running locally with your set database and other details

License

Formify is distributed using the MIT License. Check the License details.

About

An open source application to create, manage and embed contact forms on static/dynamic sites with no code

https://formify.vercel.app

License:MIT License


Languages

Language:TypeScript 87.5%Language:JavaScript 8.1%Language:CSS 4.2%Language:Shell 0.2%