Convert natural language descriptions into actual Google Forms using AI. This application uses Google's Gemini AI to generate form structures and the official Google Forms API to create forms in your Google Drive.
- AI-Powered Form Generation: Describe your form in natural language and get a structured Google Form
- Direct Google Forms Integration: Creates actual forms in your Google Drive using the official API
- NextAuth Authentication: Secure Google OAuth integration with automatic token management
- Real-time Form Creation: Generate and create forms in seconds
- Multiple Question Types: Supports text, multiple choice, checkboxes, rating scales, dates, and more
-
Create a Google Cloud Project:
- Go to Google Cloud Console
- Create a new project or select an existing one
-
Enable Required APIs:
- Go to "APIs & Services" > "Library"
- Enable the following APIs:
- Google Forms API
- Google Drive API
- Google Gemini API
-
Create OAuth 2.0 Credentials:
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth 2.0 Client IDs"
- Choose "Web application"
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google(for development)https://yourdomain.com/api/auth/callback/google(for production)
-
Configure OAuth Consent Screen:
- Go to "APIs & Services" > "OAuth consent screen"
- Choose "External" user type
- Fill in required information:
- App name: "Google Forms Generator"
- User support email: Your email
- Developer contact information: Your email
- Add scopes:
https://www.googleapis.com/auth/forms.bodyhttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/userinfo.emailhttps://www.googleapis.com/auth/userinfo.profile
Create a .env.local file in the root directory:
# Google OAuth Configuration
GOOGLE_CLIENT_ID=your_google_client_id_here
GOOGLE_SECRET=your_google_client_secret_here
# Google Gemini AI Configuration
GOOGLE_GEMINI_API_KEY=your_gemini_api_key_here
# Next.js Configuration
NEXTAUTH_URL=http://localhost:3000
NEXTAUTH_SECRET=your_nextauth_secret_here
# Database Configuration
DATABASE_URL=your_database_url_herenpm installnpx prisma generate
npx prisma db pushnpm run devOpen http://localhost:3000 in your browser.
- Navigate to
/test-formto test the form generation without authentication - Enter a natural language description of your form
- Click "Generate Form Structure" to get the JSON structure
- Navigate to
/create-formto create actual Google Forms - Click "Sign in with Google" to authenticate
- Grant the necessary permissions
- Enter a form description and generate the structure
- Click "Create Google Form" to create the form in your Google Drive
Generates a Google Forms JSON structure from a natural language prompt.
Request:
{
"prompt": "Create a customer feedback form with name, email, rating scale from 1-5, and comments section"
}Response:
{
"success": true,
"formStructure": {
"info": {
"title": "Customer Feedback Form",
"description": "Please provide your feedback about our service"
},
"items": [...]
}
}Creates an actual Google Form in Google Drive using the official Google API. Requires NextAuth session with Google authentication.
Request:
{
"formStructure": {
"info": {...},
"items": [...]
}
}Response:
{
"success": true,
"form": {
"formId": "1FAIpQLS...",
"title": "Customer Feedback Form",
"description": "Please provide your feedback about our service",
"responderUri": "https://docs.google.com/forms/d/.../viewform",
"webViewLink": "https://drive.google.com/file/d/.../view",
"editLink": "https://docs.google.com/forms/d/.../edit",
"owners": [...],
"permissions": [...]
}
}Validates NextAuth session and checks form creation permissions.
Response:
{
"success": true,
"authenticated": true,
"canCreateForms": true,
"message": "Authentication verified successfully"
}- NextAuth Integration: Uses NextAuth.js for secure Google OAuth
- Automatic Token Management: NextAuth handles access token storage and refresh
- Session-based Access: Server-side session validation for API calls
- Seamless Experience: Single sign-in for all Google services
├── app/
│ ├── api/
│ │ ├── auth/
│ │ │ └── [...nextauth]/route.ts # NextAuth configuration
│ │ ├── generate-form/route.ts # Form structure generation
│ │ └── create-google-form/route.ts # Google Form creation
│ ├── create-form/page.tsx # Main form creation interface
│ ├── test-form/page.tsx # Form generation testing
│ └── layout.tsx # App layout with AuthProvider
├── lib/
│ ├── google-auth-simple.ts # Google API client utilities
│ ├── types.ts # TypeScript type definitions
│ └── next-auth.d.ts # NextAuth type extensions
├── providers/
│ └── AuthProvider.tsx # NextAuth session provider
└── prisma/
└── schema.prisma # Database schema
- Next.js 15: React framework with App Router
- NextAuth.js: Authentication and session management
- Google Gemini AI: Natural language processing for form generation
- Google Forms API: Official API for form creation
- Google Drive API: File management and permissions
- Prisma: Database ORM with PostgreSQL
- TypeScript: Type-safe development
- Tailwind CSS: Styling and UI components
- OAuth 2.0: Secure Google authentication
- Session Management: Server-side session validation
- Token Security: Automatic token refresh and secure storage
- API Protection: All endpoints require valid authentication
- Environment Variables: Secure configuration management
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
For issues and questions:
- Check the troubleshooting section above
- Review the Google Forms API documentation
- Open an issue on GitHub
- Google Forms API for the comprehensive API
- Google API Node.js Client for the official client library
- Google Gemini AI for natural language processing capabilities