Formy is a full-stack web application that allows users to generate custom forms based on natural language descriptions. It uses OpenAI's GPT model to interpret user descriptions and create corresponding JSON Forms schemas.
- Features
- Technology Stack
- Prerequisites
- Installation
- Configuration
- Running the Application
- Usage
- API Endpoints
- Contributing
- License
- Dynamic form generation based on natural language descriptions
- Dark mode UI with a sleek, modern design
- Real-time form preview using JSON Forms
- RESTful API for form generation
- Error handling and loading states
- Responsive design for various screen sizes
- React
- Material-UI (MUI)
- JSON Forms
- Axios for API calls
- Flask (Python)
- OpenAI API
- Flask-CORS for handling Cross-Origin Resource Sharing
Before you begin, ensure you have met the following requirements:
- Node.js (v14 or later)
- Python (v3.7 or later)
- OpenAI API key
-
Clone the repository:
git clone https://github.com/yourusername/formy.git cd formy/backend
-
Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Navigate to the frontend directory:
cd ../frontend
-
Install the required npm packages:
npm install
-
Set your OpenAI API key as an environment variable:
export OPENAI_API_KEY='your-api-key-here'
-
(Optional) Modify the
app.py
file to change the port or add additional configurations.
- If your backend is running on a different URL, update the
axiosInstance
baseURL insrc/App.js
.
- From the
backend
directory, run:The server should start running onpython app.py
http://localhost:8080
.
- From the
frontend
directory, run:The application should open in your default browser atnpm start
http://localhost:3000
.
- Open the application in your web browser.
- In the text area, describe the form you want to create. For example: "Create a contact form with fields for name, email, and message."
- Click the "Generate Form" button.
- The application will generate a form based on your description and display it below.
- You can interact with the generated form and see the form data update in real-time.
GET /test
: Test the API connectionPOST /generate-form
: Generate a form schema based on a description- Request body:
{ "description": "Your form description here" }
- Response:
{ "form_structure": "JSON Forms schema" }
- Request body:
Contributions to Formy are welcome! Please follow these steps:
- Fork the repository
- Create a new branch:
git checkout -b feature-branch-name
- Make your changes and commit them:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-branch-name
- Create a pull request
This project is licensed under the MIT License - see the LICENSE.md file for details.
For any additional questions or support, please open an issue in the GitHub repository.