Skip to content

Latest commit

Β 

History

119 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎴 MeshCards

AI-Powered Flashcard Generator - Transform any content into Anki-ready flashcards instantly

License: MIT Python FastAPI React TypeScript


✨ Features

AI-Powered Generation

  • Multiple AI Models: Gemini 3 Pro, Gemini 3 Flash, Gemini 2.5 Series (Pro/Flash/Lite)
  • Latest Tech: Powered by Gemini 2.0 Flash and 1.5 Pro
  • Smart Extraction: Automatically identifies key concepts and creates Q&A pairs
  • LaTeX Support: Perfect for math, science, and technical subjects
  • Multimodal: Generate flashcards from text, PDFs, and images

Content Sources

  • πŸ“ Text Input: Paste notes, articles, or study materials
  • πŸ“„ PDF Upload: Extract content from textbooks and papers
  • πŸ–ΌοΈ Image Upload: Generate from diagrams, charts, and screenshots
  • πŸ“– Multiple Files: Combine multiple sources in one deck

Customization

  • Difficulty Levels: Beginner, Intermediate, Advanced
  • Card Styles: Q&A, Cloze Deletion, Mixed
  • Deck Size: 10-100 cards per generation
  • Custom Instructions: Fine-tune generation with specific requirements

User Features

  • Authentication: Secure sign-in with Supabase
  • Daily Quota: 2 free decks per day (resets at 12 AM IST)
  • Usage Tracking: Monitor your daily generation count
  • Instant Download: Get .apkg files ready for Anki

Security & Limits

  • 4-Layer Protection: Frontend validation, authentication, quota system, rate limiting
  • Privacy First: No data stored, instant generation and download
  • API Protection: Automatic error reporting and abuse prevention
  • IST Timezone: Fair quota reset for all users

Quick Start

Prerequisites

  • Python 3.11+
  • Node.js 18+
  • Supabase account (for auth & quotas)
  • Gemini API key (or OpenAI/Anthropic)

Installation

  1. Clone the repository

    git clone https://github.com/pranavsinghpatil/MeshCards.git
    cd MeshCards
  2. Backend Setup

    # Create virtual environment
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    
    # Install dependencies
    pip install -r requirements.txt
    
    # Configure environment
    cp .env.example .env
    # Edit .env with your API keys
  3. Frontend Setup

    cd frontend
    npm install
    
    # Configure environment
    cp .env.example .env
    # Edit .env with your API URL
  4. Run Development Servers

    # Terminal 1 - Backend
    uvicorn backend.main:app --reload --port 8000
    
    # Terminal 2 - Frontend
    cd frontend
    npm run dev
  5. Open in Browser

    http://localhost:8080
    

πŸ“– Usage

Basic Workflow

  1. Sign In - Authenticate with Google/Email
  2. Input Content - Paste text or upload files
  3. Configure - Choose model, difficulty, and style
  4. Generate - AI creates flashcards in seconds
  5. Download - Get .apkg file for Anki
  6. Import - Open in Anki and start studying!

Example: Generate from Text

Input: "Photosynthesis is the process by which plants convert light energy into chemical energy..."

Output: 
Q: What is photosynthesis?
A: The process by which plants convert light energy into chemical energy

Q: What are the main inputs of photosynthesis?
A: Light energy, water, and carbon dioxide

Q: What are the products of photosynthesis?
A: Glucose and oxygen

Example: Generate from Image

Upload a diagram β†’ AI analyzes visual content β†’ Creates flashcards about the diagram


Architecture

Tech Stack

Backend:

  • FastAPI (Python web framework)
  • Supabase (Authentication & database)
  • Google Gemini AI (Primary LLM)
  • Genanki (Anki deck generation)
  • SlowAPI (Rate limiting)

Frontend:

  • React 18 + TypeScript
  • Vite (Build tool)
  • TailwindCSS (Styling)
  • Shadcn/ui (Components)
  • React Router (Navigation)

Deployment:

  • Backend: Leapcell
  • Frontend: Vercel
  • Database: Supabase

Project Structure

MeshCards/
β”œβ”€β”€ backend/
β”‚   β”œβ”€β”€ core/
β”‚   β”‚   β”œβ”€β”€ llm.py              # LLM client management
β”‚   β”‚   β”œβ”€β”€ generator.py        # Flashcard generation logic
β”‚   β”‚   β”œβ”€β”€ anki.py             # Anki deck builder
β”‚   β”‚   β”œβ”€β”€ auth.py             # Authentication & quota
β”‚   β”‚   β”œβ”€β”€ error_reporter.py  # Automatic error reporting
β”‚   β”‚   └── storage.py          # File storage management
β”‚   └── main.py                 # FastAPI application
β”œβ”€β”€ frontend/
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/         # React components
β”‚   β”‚   β”œβ”€β”€ pages/              # Page components
β”‚   β”‚   β”œβ”€β”€ hooks/              # Custom hooks
β”‚   β”‚   └── lib/                # Utilities
β”‚   └── public/                 # Static assets
β”œβ”€β”€ docs/                       # Documentation
└── decks/                      # Generated decks (local dev)

πŸ”§ Configuration

Environment Variables

Backend (.env):

# Environment
ENV=development  # or production

# AI Providers
GEMINI_API_KEY=your_gemini_key
OPENAI_API_KEY=your_openai_key  # Optional

# Supabase (Required)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_ANON_KEY=your_supabase_anon_key
SUPABASE_SERVICE_ROLE_KEY=your_supabase_service_role_key

# Rate Limiting
RATE_LIMIT_FREE=2/hour

# GitHub Integration (Optional)
GITHUB_TOKEN=ghp_your_token
GITHUB_REPO=username/repository

Frontend (.env):

# API Configuration
VITE_API_URL=http://localhost:8000

# Maintenance Mode
VITE_MAINTENANCE_MODE=false

Features in Detail

Quota System

  • Limit: 2 decks per user per day
  • Reset: 12:00 AM IST (India Standard Time)
  • Tracking: Stored in Supabase profiles table
  • Enforcement: Strict in production, lenient in development

Rate Limiting

  • Limit: 2 requests per hour per IP address
  • Purpose: Prevent abuse and bot attacks
  • Independent: Works even without authentication
  • Bypass: Difficult (requires IP change)

Error Reporting

  • Automatic: Creates GitHub issues for backend errors
  • Privacy: Sanitizes API keys and sensitive data
  • Context: Includes stack trace, user ID (anonymized), and request data
  • Labels: Auto-categorized (bug, llm, quota, auth)

Feedback System

  • File Upload: Attach screenshots and files
  • GitHub Issues: Automatically creates issues
  • Categories: Bug, Feature Request, Praise, Other
  • Rating: 1-5 star rating system

Deployment

Backend (Leapcell)

  1. Create Project on Leapcell
  2. Connect Repository
  3. Set Environment Variables
  4. Configure Build:
    • Build Command: pip install -r requirements.txt
    • Start Command: uvicorn backend.main:app --host 0.0.0.0 --port 8000
  5. Deploy

Full Guide

Supabase Setup

  1. Create Project on Supabase
  2. Create profiles table:
    CREATE TABLE profiles (
        id UUID PRIMARY KEY,
        daily_count INTEGER DEFAULT 0,
        last_reset DATE NOT NULL,
        created_at TIMESTAMP DEFAULT NOW()
    );
  3. Enable RLS Policies (Guide)
  4. Get API Keys from Project Settings

Contributing

We welcome contributions! Here's how:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Development Guidelines

  • Follow existing code style
  • Add tests for new features
  • Update documentation
  • Keep commits atomic and descriptive

Documentation


Known Issues

  • LaTeX rendering may fail for complex equations (use $$ delimiters)
  • Large PDFs (>10MB) may timeout
  • Image generation requires specific model selection

See Issues for full list.


Roadmap

Short Term

  • Add more AI models (Claude, Llama)
  • Implement deck preview before download
  • Add deck history and management
  • Support for more file formats (DOCX, PPTX)

Medium Term

  • Premium tier with higher quotas
  • Collaborative deck creation
  • Deck sharing and marketplace
  • Mobile app (React Native)

Long Term

  • Spaced repetition algorithm integration
  • Study analytics and insights
  • Community features
  • Offline mode

Support

If you find MeshCards helpful, consider supporting the project:

  • Star this repository
  • Buy me a coffee
  • Report bugs and suggest features
  • Share with fellow students

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • Google Gemini - For powerful AI capabilities
  • Anki - For the amazing spaced repetition system
  • Supabase - For authentication and database
  • FastAPI - For the excellent Python framework
  • React - For the frontend framework
  • All Contributors - For making this project better

Contact

Pranav Singh Patil


Stats

  • Daily Active Users: Growing!
  • Decks Generated: Thousands
  • Success Rate: 98%+
  • Average Generation Time: 6-12 seconds

Made with ❀️ for students worldwide

⬆ Back to Top

About

AI-Powered Flashcard Generator - Transform any content into Anki-ready flashcards instantly

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages