Skip to content

Udhay-Adithya/formflow_backend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

10 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

FormFlow logo

Build beautiful forms effortlessly with drag & drop, AI, and real-time analytics πŸš€

Python Version Framework Database Contributors License

✨ Features

  • User Management: Secure user registration and JWT-based authentication.
  • Dynamic Forms: Define complex form structures with various field types (text, email, multiple choice, etc.) via JSON.
  • Form CRUD: Full Create, Read, Update, and Delete operations for forms, restricted to owners.
  • Response Handling: Submit responses to forms and retrieve collected responses (owner-only access).
  • Asynchronous: Built with asyncio, FastAPI, and SQLAlchemy's async support for high performance.
  • Data Validation: Leverages Pydantic for robust request and response data validation.
  • Database Migrations: Uses Alembic for managing database schema changes.
  • Dependency Injection: Makes use of FastAPI's dependency injection system for cleaner code and easier testing.

πŸ› οΈ Tech Stack

πŸ“‚ Project Structure

form_builder_backend/
β”œβ”€β”€ alembic/                   # Alembic migration scripts
β”‚   β”œβ”€β”€ versions/
β”‚   └── env.py
β”œβ”€β”€ app/                       # Main application source code
β”‚   β”œβ”€β”€ api/                   # API endpoints (routers)
β”‚   β”‚   └── v1/
β”‚   β”‚       β”œβ”€β”€ endpoints/     # Specific endpoint logic
β”‚   β”‚       └── api.py         # API router aggregation
β”‚   β”œβ”€β”€ core/                  # Core components (config, security)
β”‚   β”œβ”€β”€ crud/                  # Database interaction logic (CRUD operations)
β”‚   β”œβ”€β”€ db/                    # Database setup (session, base model)
β”‚   β”œβ”€β”€ models/                # SQLAlchemy ORM models
β”‚   β”œβ”€β”€ schemas/               # Pydantic schemas (data validation)
β”‚   β”œβ”€β”€ dependencies.py        # FastAPI dependencies
β”‚   └── main.py                # FastAPI application entry point
β”œβ”€β”€ .env                       # Environment variables (create this file)
β”œβ”€β”€ .gitignore                 # Git ignore rules
β”œβ”€β”€ alembic.ini                # Alembic configuration
β”œβ”€β”€ requirements.txt           # Project dependencies
└── README.md                  # This file

πŸš€ Getting Started

Prerequisites

  • Python 3.10 or higher
  • PostgreSQL Server (running locally or accessible)
  • Git

Installation & Setup

  1. Clone the repository:

    git clone https://github.com/Udhay-Adithya/formflow_backend
    cd form_builder_backend
  2. Create and activate a virtual environment:

    python -m venv venv
    # On macOS/Linux
    source venv/bin/activate
    # On Windows
    # venv\Scripts\activate
  3. Install dependencies:

    pip install -r requirements.txt
  4. Configure Environment Variables: Create a .env file in the project root directory. Copy the contents from .env.example (if provided) or add the following variables, adjusting values as needed:

    # .env
    PROJECT_NAME="Formflow"
    
    # PostgreSQL Database URL
    # Format: postgresql+asyncpg://<user>:<password>@<host>:<port>/<database_name>
    DATABASE_URL=postgresql+asyncpg://user:password@localhost:5432/formflow_db
    
    # JWT Settings
    SECRET_KEY=your_super_secret_key_change_this # Generate a strong secret key (e.g., using openssl rand -hex 32)
    ALGORITHM=HS256
    ACCESS_TOKEN_EXPIRE_MINUTES=60
    • Ensure the specified PostgreSQL database exists or create it.
  5. Run Database Migrations: Apply the latest database schema changes using Alembic:

    alembic upgrade head

Running the Application

Start the development server using Uvicorn:

uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
  • --reload: Enables auto-reloading on code changes (for development).
  • --host 0.0.0.0: Makes the server accessible on your local network.
  • --port 8000: Specifies the port to run on.

The API will be available at http://localhost:8000.

πŸ“š API Documentation

Once the server is running, interactive API documentation is available at:

  • Swagger UI: http://localhost:8000/docs
  • ReDoc: http://localhost:8000/redoc

These interfaces allow you to explore and interact with all available API endpoints.

Main API Endpoint Groups

  • /api/v1/auth: User registration and token generation (login).
  • /api/v1/users: User-related operations (e.g., getting the current user).
  • /api/v1/forms: CRUD operations for forms.
  • /api/v1/forms/{form_id}/responses: Submitting and retrieving responses for a specific form.

πŸ§ͺ Running Tests (TODO)

(Instructions for running tests will be added here once test suites are implemented.)

🀝 Contributing

Contributions are welcome! Please follow standard fork-and-pull-request workflow. Ensure your code adheres to the project's style and includes tests for new features or bug fixes.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published