A full-stack AI-powered questionnaire platform built with Next.js, NestJS, and generative AI capabilities. This application enables users to create, manage, and analyze intelligent surveys and questionnaires powered by Google's Generative AI and OpenAI.
🌐 Live Demo: https://ai-questionnaire-sepia.vercel.app
- AI-Powered Question Generation: Automatically generate survey questions using Google Generative AI or OpenAI
- Questionnaire Management: Create, edit, and delete questionnaires with ease
- User Authentication: Secure authentication powered by Better Auth
- File Upload & Processing: Support for CSV, Excel, PDF, and Word documents
- Email Notifications: Send surveys via email using Nodemailer and Resend
- Real-time Updates: Socket-ready architecture with Redis support
- Payment Integration: Stripe integration for premium features
- Responsive Design: Beautiful UI built with TailwindCSS and Framer Motion
- Database: PostgreSQL with Prisma ORM for reliable data management
- Framework: Next.js 16+ (App Router)
- Language: TypeScript
- Styling: TailwindCSS v4, PostCSS
- UI Components: Lucide React, Framer Motion
- State Management: Zustand
- API Calls: Axios
- Search: Fuse.js
- Notifications: Sonner
- Framework: NestJS
- Language: TypeScript
- API Docs: Swagger
- Authentication: JWT, Passport
- Database: PostgreSQL with Prisma
- Job Queue: BullMQ with Redis
- File Processing: Multer, Mammoth, PDF-Parse, XLSX, CSV-Parse
- Testing: Jest
- Frontend Deployment: Vercel
- Containerization: Docker Compose
- Database: PostgreSQL
- Caching: Redis
- Email Services: Nodemailer, Resend
ai-questionnaire/
├── app/ # Next.js frontend (App Router)
├── backend/ # NestJS backend
│ ├── src/
│ │ ├── modules/ # Feature modules
│ │ ├── auth/ # Authentication
│ │ └── common/ # Shared utilities
│ └── prisma/ # Database schema
├── components/ # React components
├── lib/ # Utilities and helpers
├── public/ # Static assets
├── docker-compose.yml # Local development setup
├── package.json # Root dependencies
└── tsconfig.json # TypeScript config
- Node.js 18+
- npm or yarn
- PostgreSQL 14+
- Redis (optional, for job queue)
-
Clone the repository
git clone https://github.com/eyob13-coder/AI-Questionnaire.git cd AI-Questionnaire -
Install dependencies
npm install
-
Set up environment variables
- Create
.env.localin the root directory - Create
.envin thebackend/directory
Required variables:
# Backend DATABASE_URL=postgresql://user:password@localhost:5432/ai_questionnaire JWT_SECRET=your_jwt_secret GOOGLE_API_KEY=your_google_generative_ai_key OPENAI_API_KEY=your_openai_key STRIPE_SECRET_KEY=your_stripe_key EMAIL_FROM=noreply@example.com - Create
-
Initialize the database
npm run build
Run both frontend and backend concurrently:
npm run devThis will start:
- Frontend: http://localhost:3000
- Backend: http://localhost:3001
Individual commands:
- Frontend only:
npm run dev:frontend - Backend only:
npm run dev:backend - Redis:
npm run dev:redis
npm run build
npm startnpm run dev- Start development servers (frontend + backend)npm run build- Build for productionnpm start- Start production servernpm run lint- Run ESLint
npm run dev- Start NestJS in watch modenpm run build- Build the NestJS appnpm run start- Start production servernpm run test- Run unit testsnpm run test:e2e- Run e2e testsnpm run lint- Fix linting issues
Start the full stack with Docker:
docker-compose upThis will spin up:
- PostgreSQL database
- Redis cache
- Backend API
- Frontend application
Once the backend is running, access the Swagger API documentation at:
http://localhost:3001/api
- Leverage Google Generative AI or OpenAI to automatically generate relevant survey questions
- Customize tone, difficulty, and question types
- Upload and parse CSV, Excel, PDF, and Word documents
- Extract data and generate surveys based on document content
- Send surveys to respondents via email
- Track email delivery and opens
- Automated reminders and follow-ups
- Secure signup and login with Better Auth
- Social login support
- JWT-based session management
- Stripe integration for premium features
- Subscription management
- Usage tracking and billing
See .env.example files in root and backend/ directories for all available configuration options.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is currently unlicensed. See LICENSE file for details.
For issues and questions, please open an issue on GitHub or visit the live demo.
Created by eyob13-coder
Made with ❤️ using Next.js, NestJS, and AI