Your AI-powered study companion for smarter learning. Transform any topic into interactive quizzes, flashcards, and clear explanations.
- Generate custom quizzes from any topic
- 4 question types: Multiple Choice, True/False, Short Answer, Fill-in-the-Blank
- 3 difficulty levels: Easy, Medium, Hard
- Instant feedback with explanations
- Confetti celebrations for high scores
- Quiz history with 30-day retention
- Auto-generate interactive flashcards
- Beautiful 3D flip animations
- 3 study modes: Study, Shuffle, Quiz
- Mobile swipe gestures (left/right/up)
- Progress tracking with mastery percentage
- Spaced repetition ready
- Get clear explanations for complex topics
- 3 complexity levels: Beginner, Intermediate, Advanced
- Real-time streaming responses
- Follow-up questions with context
- Bookmark favorite explanations
- Related topics suggestions
- Comprehensive progress tracking
- Animated stats cards
- Topic history with search and filters
- Quick action buttons
- Study insights with progress bars
- Focus timer with 25/5/15 minute cycles
- Customizable durations
- Browser notifications
- Session tracking
- Focus mode toggle
- Auto-start options
- Node.js 18+ installed
- OpenAI API key (get one here)
- Clone the repository
git clone https://github.com/yourusername/AI-Study-Buddy.git
cd AI-Study-Buddy- Install dependencies
pnpm install
# or
npm install- Set up environment variables
cp .env.example .env.localEdit .env.local and add your OpenAI API key:
OPENAI_API_KEY=sk-your-api-key-here- Run the development server
pnpm dev
# or
npm run devsrc/
βββ app/ # Next.js App Router pages
β βββ api/ # API routes
β β βββ quiz/generate/ # Quiz generation endpoint
β β βββ flashcards/generate/ # Flashcard generation
β β βββ explain/ # Explanation endpoint
β βββ dashboard/ # Study dashboard
β βββ quiz/ # Quiz pages (new, take, results)
β βββ flashcards/ # Flashcard pages (new, study, results)
β βββ explain/ # Explainer & bookmarks
β βββ layout.tsx # Root layout
β βββ page.tsx # Homepage
βββ components/ # React components
β βββ ui/ # shadcn/ui components
β βββ timer/ # Pomodoro timer
β βββ error-boundary.tsx # Error boundary
βββ store/ # Zustand state stores
β βββ useQuizStore.ts
β βββ useFlashcardStore.ts
β βββ useBookmarkStore.ts
β βββ useDashboardStore.ts
β βββ useTimerStore.ts
βββ types/ # TypeScript type definitions
βββ lib/ # Utilities and configurations
βββ openai.ts # OpenAI client
βββ prompts.ts # AI prompt templates
- Framework: Next.js 16 (App Router)
- Language: TypeScript
- Styling: Tailwind CSS v4
- UI Components: shadcn/ui + @ai-elements/all
- State Management: Zustand with persist middleware
- Data Storage: localStorage (30-day retention)
- AI Provider: OpenAI GPT-4o-mini
- Animations: Framer Motion
- Icons: Lucide React
- Streaming: Vercel AI SDK
- Theme: next-themes (dark/light mode)
The app uses a carefully crafted design system:
- Colors: Sky, Indigo, Emerald, Purple gradients
- Typography: System fonts for optimal performance
- Spacing: Consistent 8px grid
- Animations: Smooth 300ms transitions
- Shadows: Layered depth with backdrop blur
Create a .env.local file with:
# Required
OPENAI_API_KEY=your_openai_api_key_here
# Optional
NEXT_PUBLIC_BASE_URL=https://your-domain.com # For sitemap# Development
pnpm dev # Start dev server
pnpm build # Production build
pnpm start # Start production server
pnpm lint # Run ESLint
# Type checking
pnpm type-check # Run TypeScript compiler- Push your code to GitHub
- Import project to Vercel
- Add
OPENAI_API_KEYenvironment variable - Deploy!
The app is a standard Next.js application and can be deployed to:
- Netlify
- AWS Amplify
- Docker
- Any Node.js hosting
- Navigate to "New Quiz"
- Enter your topic (e.g., "Photosynthesis")
- Select difficulty and question count
- Choose question types
- Click "Generate Quiz"
- Take the quiz and view results
- Go to "Create Flashcards"
- Enter topic and card count
- Generate flashcards
- Choose study mode (Study/Shuffle/Quiz)
- Use flip animations or swipe gestures
- Mark cards as Know It/Learning/Don't Know
- Visit "Explain Any Concept"
- Enter your question
- Select complexity level
- View streaming explanation
- Ask follow-up questions
- Bookmark important explanations
- Linting: ESLint with Next.js config
- Formatting: Prettier (recommended)
- Type Safety: Strict TypeScript
- Git Hooks: Pre-commit linting (optional)
- Always run
pnpm lintbefore committing - Keep components under 300 lines
- Use TypeScript interfaces for all data
- Persist important state with Zustand
- Add error boundaries for features
- Test on mobile devices
- Define types in
src/types/ - Create Zustand store if needed
- Build UI components
- Add API route if required
- Update TASKS.md
- Test thoroughly
- Lighthouse Score: 90+
- First Contentful Paint: < 1.5s
- Time to Interactive: < 3s
- Bundle Size: ~ 200kb gzipped
Build fails with TypeScript errors
pnpm type-check # Check for type errorsOpenAI API errors
- Verify API key in
.env.local - Check API quota/limits
- Ensure key has proper permissions
Animations not working
- Check Framer Motion version compatibility
- Verify browser supports CSS transforms
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Run
pnpm lintandpnpm build - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Next.js - React framework
- shadcn/ui - UI components
- Vercel AI SDK - AI streaming
- OpenAI - AI models
- Framer Motion - Animations
- π§ Email: support@example.com
- π¬ Discord: Join our community
- π¦ Twitter: @studybuddy
- PDF upload for quiz generation
- Study groups and collaboration
- Mobile app (React Native)
- Voice mode for audio learning
- Achievement system with badges
- Advanced spaced repetition algorithm
Built with β€οΈ for learners everywhere