Skip to content

dpkpaswan/AI-powered-Google-Form-Generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AI Google Form Generator β€” Dashboard

πŸ€– AI-Powered Google Form Generator

Describe your form in plain English β€” get a fully‑configured Google Form in seconds.

Node β‰₯ 20 React 18 Vite 5 Express 4 Supabase Gemini AI License


πŸ“– Table of Contents


🌟 Overview

AI-Powered Google Form Generator is a full-stack web application that lets users sign in with their Google account and create professional Google Forms using natural language prompts. Powered by Google Gemini AI, the app interprets your description, generates structured questions, and publishes a real Google Form to your account β€” all in one click.


✨ Key Features

Feature Description
πŸ” Google OAuth 2.0 Secure user-consent login β€” forms are created in your own Google account
🧠 AI Form Generation Describe your form in plain text and Gemini AI generates structured questions
πŸ“„ Generate from Document Upload a PDF or DOCX and auto-generate a form from the document content
πŸ“ Form Templates Quick-start templates for surveys, quizzes, feedback forms, and more
✏️ Edit Forms Modify generated forms before or after publishing
πŸ“Š Form Analytics Visualize response data with interactive charts (D3.js + Recharts)
πŸ“‚ My Forms Dashboard View, manage, archive, and track all your generated forms
πŸ›‘οΈ Security Helmet, rate limiting, encrypted token storage, Zod validation
🐳 Docker Ready Multi-stage Dockerfile for single-service production deployment

πŸ“Έ Screenshots

Sign In Dashboard
Sign In Dashboard
Create Form with AI My Forms
Create Form My Forms

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                    React + Vite (SPA)                    β”‚
β”‚  TailwindCSS Β· Framer Motion Β· Redux Toolkit Β· Recharts β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚  /api/* (Vite proxy in dev)
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚               Node.js + Express Backend                  β”‚
β”‚                                                          β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ Controllers β”‚β†’β”‚  Services  β”‚β†’β”‚  External APIs     β”‚  β”‚
β”‚  β”‚  (thin)     β”‚  β”‚ (business  β”‚  β”‚  β€’ Google Forms   β”‚  β”‚
β”‚  β”‚             β”‚  β”‚  logic)    β”‚  β”‚  β€’ Google OAuth   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚  β€’ Google Gemini  β”‚  β”‚
β”‚                                   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚  Middlewares: auth Β· rateLimit Β· validate Β· errorHandler  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                         β”‚
                         β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                Supabase (PostgreSQL)                      β”‚
β”‚  Tables: users Β· user_google_tokens Β· forms              β”‚
β”‚          form_questions Β· form_analytics                  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

🧰 Tech Stack

Backend

Technology Purpose
Node.js β‰₯ 20 Runtime
Express 4 HTTP framework
Google Gemini AI-powered question generation
googleapis Google Forms & OAuth integration
Supabase JS Database client (PostgreSQL)
Zod Environment & request validation
Helmet HTTP security headers
express-rate-limit API rate limiting
jsonwebtoken Session JWT tokens
Pino Structured JSON logging
Multer File upload handling
pdf-parse / Mammoth Document text extraction (PDF & DOCX)

Frontend

Technology Purpose
React 18 UI framework
Vite 5 Build tool & dev server
Redux Toolkit Global state management
TailwindCSS 3 Utility-first styling
Framer Motion Animations & transitions
React Router v6 Client-side routing
React Hook Form Form handling & validation
D3.js + Recharts Data visualization & charts
Lucide React Icon library
Axios HTTP client

πŸ“ Project Structure

AI-powered-Google-Form-Generator/
β”‚
β”œβ”€β”€ src/                            # ── Backend (Node + Express) ──
β”‚   β”œβ”€β”€ server.js                   # Entry point β€” starts HTTP server
β”‚   β”œβ”€β”€ app.js                      # Express app factory (middleware, routes, static)
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── env.js                  # Zod-validated environment variables
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ generateFormController.js       # AI form generation
β”‚   β”‚   β”œβ”€β”€ generateFromDocumentController.js # Document β†’ form
β”‚   β”‚   β”œβ”€β”€ extractFromImagesController.js    # Image β†’ form
β”‚   β”‚   β”œβ”€β”€ formsController.js              # CRUD for user forms
β”‚   β”‚   β”œβ”€β”€ formTemplateController.js       # Template endpoints
β”‚   β”‚   β”œβ”€β”€ improveFormController.js        # AI form improvement
β”‚   β”‚   └── analyticsController.js          # Response analytics
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   β”œβ”€β”€ geminiService.js        # Google Gemini AI integration
β”‚   β”‚   β”œβ”€β”€ googleFormsService.js   # Google Forms API wrapper
β”‚   β”‚   β”œβ”€β”€ googleOAuthService.js   # OAuth2 token management
β”‚   β”‚   β”œβ”€β”€ userFormsService.js     # Form CRUD (Supabase)
β”‚   β”‚   β”œβ”€β”€ userGoogleFormsService.js # User-scoped Google Forms ops
β”‚   β”‚   β”œβ”€β”€ analyticsService.js     # Response analytics logic
β”‚   β”‚   β”œβ”€β”€ documentFormService.js  # PDF/DOCX text extraction
β”‚   β”‚   β”œβ”€β”€ formTemplateService.js  # Template management
β”‚   β”‚   β”œβ”€β”€ formImprovementService.js      # Form improvement logic
β”‚   β”‚   β”œβ”€β”€ aiFormImprovementService.js    # AI-powered improvements
β”‚   β”‚   β”œβ”€β”€ sessionService.js       # JWT session helpers
β”‚   β”‚   └── supabaseClient.js       # Supabase client init
β”‚   β”œβ”€β”€ middlewares/
β”‚   β”‚   β”œβ”€β”€ auth.js                 # JWT cookie authentication
β”‚   β”‚   β”œβ”€β”€ requireUser.js          # Require authenticated user
β”‚   β”‚   β”œβ”€β”€ validate.js             # Request body validation
β”‚   β”‚   β”œβ”€β”€ rateLimit.js            # Rate-limiting config
β”‚   β”‚   └── errorHandler.js         # Global error handler
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ authRoute.js            # /auth/* β€” login, callback, logout
β”‚   β”‚   β”œβ”€β”€ generateFormRoute.js    # /generate β€” AI generation
β”‚   β”‚   └── formsRoute.js           # /forms/* β€” CRUD, analytics, templates
β”‚   └── utils/
β”‚       β”œβ”€β”€ appError.js             # Structured AppError class
β”‚       β”œβ”€β”€ asyncHandler.js         # Async route wrapper
β”‚       β”œβ”€β”€ crypto.js               # Token encryption/decryption
β”‚       β”œβ”€β”€ formTemplates.js        # Built-in template definitions
β”‚       └── logger.js               # Pino logger instance
β”‚
β”œβ”€β”€ FRONTEND/                       # ── Frontend (React + Vite) ──
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ index.jsx               # React entry point
β”‚   β”‚   β”œβ”€β”€ App.jsx                 # Root app component
β”‚   β”‚   β”œβ”€β”€ Routes.jsx              # Route definitions
β”‚   β”‚   β”œβ”€β”€ components/             # Reusable UI components
β”‚   β”‚   β”œβ”€β”€ pages/                  # Page-level components
β”‚   β”‚   β”‚   β”œβ”€β”€ dashboard/          # Main dashboard
β”‚   β”‚   β”‚   β”œβ”€β”€ create-form/        # AI form creation
β”‚   β”‚   β”‚   β”œβ”€β”€ generate-from-document/ # Document upload β†’ form
β”‚   β”‚   β”‚   β”œβ”€β”€ my-forms/           # Form management
β”‚   β”‚   β”‚   β”œβ”€β”€ edit-form/          # Form editor
β”‚   β”‚   β”‚   β”œβ”€β”€ form-analytics/     # Response analytics
β”‚   β”‚   β”‚   β”œβ”€β”€ templates/          # Template browser
β”‚   β”‚   β”‚   β”œβ”€β”€ profile/            # User profile
β”‚   β”‚   β”‚   └── login/              # Google sign-in
β”‚   β”‚   β”œβ”€β”€ context/                # React context providers
β”‚   β”‚   β”œβ”€β”€ services/               # API service layer
β”‚   β”‚   β”œβ”€β”€ styles/                 # Global CSS
β”‚   β”‚   └── utils/                  # Frontend utilities
β”‚   β”œβ”€β”€ vite.config.mjs             # Vite config + API proxy
β”‚   β”œβ”€β”€ tailwind.config.js          # TailwindCSS config
β”‚   └── package.json
β”‚
β”œβ”€β”€ supabase/
β”‚   └── schema.sql                  # Database schema (PostgreSQL)
β”‚
β”œβ”€β”€ scripts/                        # Developer utility scripts
β”‚   β”œβ”€β”€ check-supabase.mjs          # Verify Supabase connection
β”‚   β”œβ”€β”€ test-gemini.js              # Test Gemini API
β”‚   β”œβ”€β”€ test-generate.js            # Test form generation
β”‚   └── ...                         # More test/debug scripts
β”‚
β”œβ”€β”€ docs/images/                    # Screenshots for docs
β”œβ”€β”€ Dockerfile                      # Multi-stage production build
β”œβ”€β”€ render.yaml                     # Render.com deploy config
β”œβ”€β”€ package.json                    # Backend dependencies & scripts
β”œβ”€β”€ eslint.config.js                # ESLint flat config
└── LICENSE                         # Proprietary (evaluation-only)

πŸ“‹ Prerequisites

  • Node.js β‰₯ 20 β€” Download
  • npm (bundled with Node.js)
  • Google Cloud Project with the following APIs enabled:
    • Google Forms API
    • Google Drive API (for form permissions)
  • OAuth 2.0 Credentials (Web application type) β€” Console
  • Google Gemini API Key β€” AI Studio
  • Supabase Project β€” supabase.com

πŸš€ Getting Started

1. Clone the repository

git clone https://github.com/your-username/AI-powered-Google-Form-Generator.git
cd AI-powered-Google-Form-Generator

2. Install backend dependencies

npm install

3. Install frontend dependencies

cd FRONTEND
npm install
cd ..

4. Configure environment

Copy the example env file and fill in your credentials:

cp .env.example .env

See Environment Variables for the full reference.

5. Set up the database

Run the SQL schema against your Supabase project:

# Copy contents of supabase/schema.sql into your Supabase SQL Editor and execute

6. Start development servers

Terminal 1 β€” Backend (port 3000):

npm run dev

Terminal 2 β€” Frontend (port 4028):

cd FRONTEND
npm run dev

7. Open the app

Navigate to http://localhost:4028 β€” sign in with Google and start generating forms!


πŸ” Environment Variables

Create a .env file in the project root with the following variables:

Variable Required Description
PORT Β· Backend port (default: 3000)
NODE_ENV Β· development or production
FRONTEND_APP_URL βœ… Frontend URL (e.g., http://localhost:4028)
GEMINI_API_KEY βœ… Google Gemini API key
GOOGLE_OAUTH_CLIENT_ID βœ… OAuth 2.0 client ID
GOOGLE_OAUTH_CLIENT_SECRET βœ… OAuth 2.0 client secret
GOOGLE_OAUTH_REDIRECT_URI βœ… OAuth callback URL (e.g., http://localhost:3000/auth/google/callback)
SESSION_JWT_SECRET βœ… JWT signing secret (min 32 chars)
TOKENS_ENCRYPTION_KEY_BASE64 βœ… AES encryption key for tokens (base64, 32 bytes)
SUPABASE_URL βœ… Supabase project URL
SUPABASE_SERVICE_ROLE_KEY βœ… Supabase service role key (not the anon key)

⚠️ Important: Do not use the Supabase anon key β€” the app will detect this and throw an error at startup.


πŸ—„οΈ Database Setup

Execute the schema in supabase/schema.sql via the Supabase SQL Editor. This creates:

Table Purpose
users Google-authenticated user profiles
user_google_tokens Encrypted OAuth refresh tokens
forms Form metadata (title, prompt, URLs, settings)
form_questions Individual questions per form
form_analytics Cached response analytics (reduces API calls)

πŸ›£οΈ API Endpoints

Authentication

Method Endpoint Description
GET /auth/google Initiate Google OAuth flow
GET /auth/google/callback OAuth callback handler
GET /auth/me Get current user info
POST /auth/logout Clear session & logout

Form Generation

Method Endpoint Description
POST /generate Generate a form from a text prompt
POST /generate/from-document Generate a form from an uploaded document
POST /generate/from-images Generate a form from uploaded images

Form Management

Method Endpoint Description
GET /forms List all user forms
GET /forms/:id Get form details
PATCH /forms/:id Update form metadata
DELETE /forms/:id Delete / archive a form
POST /forms/:id/improve AI-powered form improvement
GET /forms/:id/analytics Get response analytics

Templates

Method Endpoint Description
GET /templates List available form templates

All endpoints are also available under the /api prefix (e.g., /api/generate).


πŸ§ͺ Developer Scripts

Command Description
npm run dev Start backend with --watch (auto-restart on changes)
npm run start Start backend in production mode
npm run build Build frontend for production
npm run lint Run ESLint on backend code

Utility Scripts (scripts/)

# Verify Supabase connection & list forms
node -r dotenv/config scripts/check-supabase.mjs

# Test Gemini API connectivity
node -r dotenv/config scripts/test-gemini.js

# Test full form generation pipeline
node -r dotenv/config scripts/test-generate.js

# Test Google Forms API directly
node -r dotenv/config scripts/test-google-create-form.js

🚒 Deployment

Docker (Recommended)

The included multi-stage Dockerfile builds the React frontend and serves everything from a single Express server:

docker build -t ai-form-generator .
docker run -p 3000:3000 --env-file .env ai-form-generator

Render.com

A render.yaml blueprint is included for one-click deployment:

  1. Connect your GitHub repo to Render
  2. Use the Blueprint feature and select render.yaml
  3. Set the required environment variables in the Render dashboard
  4. Deploy β€” the app will be live at your Render URL

Production Note: The backend serves the built frontend from FRONTEND/build/ in production, ensuring same-origin cookies work without cross-site configurations.


πŸ“œ License

Copyright Β© 2025 Deepak Paswan β€” All Rights Reserved.

This repository is made publicly viewable for academic review, hackathon judging, and evaluation purposes only. No license is granted to use, copy, modify, distribute, or create derivative works. See LICENSE for full terms.


Built with ❀️ by Deepak Paswan

About

Generate Google Forms instantly from a text prompt using Google Gemini AI. Full-stack app with Google OAuth (forms are created in your own account), React + Vite frontend, Node/Express backend, and Supabase for metadata storage. Deployable via Docker on Render.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages