A modern, feature-rich survey platform with AI-powered survey generation, real-time analytics, and comprehensive response management.
- Survey Creation & Management: Create, edit, and manage surveys with multiple question types
- AI-Powered Survey Generation: Generate professional surveys automatically using OpenAI GPT-4o-mini
- Question Types Support:
- Text input
- Multiple choice
- Radio buttons
- Checkboxes
- Rating scales
- Date picker
- Email validation
- Number input
- Public & Private Surveys: Control survey visibility and access
- Anonymous Responses: Allow anonymous participation for sensitive topics
- Real-time Analytics: View response statistics and survey performance
- Response Management: Track, view, and analyze survey responses
- User Role Management: Creator and Respondent roles with appropriate permissions
- Modern UI: Built with shadcn/ui components and Tailwind CSS
- Responsive Design: Works seamlessly on desktop and mobile devices
- Dark/Light Mode: Theme switching support
- Email Verification: Secure user registration with email verification
- Password Reset: Complete password recovery workflow
- Next.js 15 - React framework with App Router
- React 19 - Latest React with modern features
- TypeScript - Type-safe development
- Tailwind CSS - Utility-first CSS framework
- shadcn/ui - Beautiful, accessible UI components
- Lucide React - Icon library
- Framer Motion - Animations and transitions
- PostgreSQL - Primary database
- Prisma - Database ORM and migrations
- Better Auth - Authentication and session management
- Resend - Email delivery service
- OpenAI API - AI survey generation (GPT-4o-mini)
- Vercel AI SDK - AI integration toolkit
- Bun - Fast JavaScript runtime and package manager
- React Query (TanStack) - Data fetching and state management
- React Hook Form - Form handling and validation
- Zod - Schema validation
- Axios - HTTP client
- Node.js 18+ or Bun
- PostgreSQL database
- OpenAI API key (for AI features)
- Resend API key (for emails)
git clone https://github.com/your-username/fe-surveyer.git
cd fe-surveyer
bun install
Create a .env.local
file in the root directory:
# Database
DATABASE_URL="postgresql://username:password@localhost:5432/surveyer"
# Authentication
BETTER_AUTH_SECRET="your-secret-key-here"
BETTER_AUTH_URL="http://localhost:3000"
# OpenAI (for AI survey generation)
OPENAI_API_KEY="your-openai-api-key"
# Email (Resend)
RESEND_API_KEY="your-resend-api-key"
RESEND_FROM_EMAIL="noreply@yourdomain.com"
# App Configuration
NEXT_PUBLIC_APP_URL="http://localhost:3000"
# Generate Prisma client
bun run db:generate
# Run database migrations
bun run db:migrate
# (Optional) Open Prisma Studio to view your database
bun run db:studio
bun run dev
Visit http://localhost:3000 to see your application.
fe-surveyer/
βββ src/
β βββ app/ # Next.js App Router
β β βββ (app)/ # Authenticated app routes
β β β βββ dashboard/ # User dashboard
β β β βββ surveys/ # Survey management
β β β βββ responses/ # Response management
β β βββ (auth)/ # Authentication routes
β β βββ api/ # API routes
β β βββ survey/ # Public survey taking
β βββ components/ # Reusable components
β β βββ ui/ # shadcn/ui components
β β βββ auth/ # Authentication forms
β β βββ landing/ # Landing page components
β βββ hooks/ # Custom React hooks
β βββ lib/ # Utility libraries
β β βββ dal/ # Data access layer
β β βββ email-templates/ # Email templates
β βββ types/ # TypeScript definitions
βββ prisma/ # Database schema and migrations
βββ public/ # Static assets
# Development
bun run dev # Start development server with Turbopack
bun run build # Build for production
bun run start # Start production server
bun run lint # Run ESLint
# Database
bun run db:generate # Generate Prisma client
bun run db:migrate # Run database migrations
bun run db:push # Push schema changes to database
bun run db:studio # Open Prisma Studio
- Sign Up/Sign In: Create an account or sign in to get started
- Dashboard: Access your dashboard to view survey overview
- Create Survey: Click "Create Survey" and choose:
- Manual creation with custom questions
- AI-assisted generation with topic and requirements
- Configure Questions: Add various question types and configure options
- Publish: Make your survey live and shareable
- Click "AI Assistant" when creating a survey
- Provide:
- Survey topic
- Number of questions (1-20)
- Target audience
- Additional context (optional)
- Review and customize the generated questions
- Publish your AI-generated survey
- View Analytics: Real-time response statistics and trends
- Response Details: Individual response analysis
- Export Data: Download responses for further analysis
- Anonymous Tracking: Support for anonymous submissions
- Secure Registration: Email verification required
- Password Security: Bcrypt hashing with salt
- Session Management: Secure session handling with Better Auth
- Role-based Access: Creator and Respondent permissions
- CSRF Protection: Built-in protection against cross-site attacks
GET /api/surveys
- List surveysPOST /api/surveys
- Create surveyGET /api/surveys/[id]
- Get survey detailsPUT /api/surveys/[id]
- Update surveyDELETE /api/surveys/[id]
- Delete surveyPOST /api/surveys/[id]/publish
- Publish survey
GET /api/responses/survey/[surveyId]
- Get survey responsesPOST /api/responses/submit
- Submit responseGET /api/responses/[id]
- Get specific response
POST /api/ai/generate-survey
- Generate survey with AI
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Join our community discussions
- Next.js for the amazing React framework
- shadcn/ui for beautiful UI components
- Prisma for excellent database tooling
- OpenAI for AI capabilities
- Vercel for hosting and AI SDK
Built with β€οΈ using Next.js and modern web technologies.