Skip to content

boemer00/study-wise-ai

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

StudyWise AI ๐Ÿง โœจ

AI-Powered Learning Platform with FSRS Spaced Repetition & Advanced Study Modes

StudyWise AI transforms study materials into intelligent, interactive learning experiences by combining proven educational psychology with state-of-the-art AI.


๐Ÿš€ Quick Start (Local Development)

# 1. Clone and set up a virtual environment
git clone <repository-url>
cd study-wise-ai
python -m venv study-env && source study-env/bin/activate
pip install -r requirements.txt

# 2. Configure environment variables
cp .env.example .env
# Edit .env with your API keys

# 3. Generate a secure secret key (production only)
python scripts/generate_secret_key.py

# 4. Run the development server
python start_local_demo.py  # http://localhost:8000

๐ŸŒ Production Deployment โ€” Google Cloud Run

StudyWise AI ships with first-class support for Google Cloud Run. Two options are provided.

1. One-Command Deployment using deploy.sh

./deploy.sh                      # backend only, Cloud Build + Cloud Run

The script will:

  1. Enable required GCP APIs (Cloud Build, Cloud Run, Container Registry).
  2. Build the container image and push it to Container Registry.
  3. Deploy the image to Cloud Run with recommended CPU, memory, and scaling parameters.
  4. Output the live service URL so that it can be added to the frontend or CORS configuration.

2. Cloud Build Trigger (cloudbuild.yaml)

Add a build trigger in the Cloud Console that points to the repository and references the included cloudbuild.yaml. Every push to main will then:

  1. Build the Docker image gcr.io/$PROJECT_ID/studywise-api:$COMMIT_SHA.
  2. Push it to Container Registry.
  3. Deploy the image to Cloud Run (region us-central1, service name studywise-api).

A minimal manual invocation looks like this:

# From the project root
gcloud builds submit --config cloudbuild.yaml

Once deployment finishes, retrieve the service URL:

SERVICE_URL=$(gcloud run services describe studywise-api \
             --region us-central1 \
             --format="value(status.url)")
echo "Backend available at $SERVICE_URL"

Tip : To deploy the companion React frontend as well, see deploy-both.sh, which builds and deploys both images and automatically wires the frontend's VITE_API_URL to the new backend URL.


๐ŸŒŸ Core Features

๐Ÿง  Flashcards

  • FSRS Algorithm: Scientific spaced repetition with 17-parameter algorithm for your flashcards
  • Document Processing: PDF/DOCX upload with semantic search

๐Ÿ” Intelligent Processing

  • Hybrid Architecture: Weaviate (vector) + Supabase (relational)
  • Semantic Search: OpenAI embeddings with similarity scoring --> Talk to you database.
  • Real-time Analytics: Comprehensive learning insights and progress tracking

๐ŸŽฏ Production Ready

  • FastAPI Backend: High-performance API with 36+ endpoints
  • React Frontend: Modern TypeScript interface
  • UUID Authentication: Secure user session management
  • Comprehensive Testing: 30+ tests with automated validation

๐Ÿ—๏ธ Architecture

๐ŸŒ React Frontend โ†โ†’ โšก FastAPI Backend โ†โ†’ ๐Ÿ” Weaviate (Vector) + ๐Ÿ“Š Supabase (Data)
                                        โ†•
                                    ๐Ÿค– OpenAI (GPT-4 + Embeddings)

Key Components:

  • Study Framework: FSRS Flashcards
  • Document Processing: PDF/DOCX handlers with intelligent chunking
  • Vector Search: Semantic document retrieval and similarity
  • Analytics Engine: Learning progress and personalized recommendations

๐Ÿงช Quality Assurance

Multi-Layer Validation System

# Quick sanity check (โ‰ˆ 1 second)
python scripts/pre_merge_validation.py --quick

# Full test suite (โ‰ˆ 45 seconds)
python scripts/pre_merge_validation.py

Automated Protection

  • Pre-commit hooks: Validate every commit automatically
  • GitHub Actions: CI/CD pipeline with PR validation
  • Zero disruption guarantee: All changes tested against existing functionality

Test Coverage

  • โœ… 442 tests collected across all modules
  • โœ… FSRS Algorithm: Integration tests with real scheduling
  • โœ… API Endpoints: All 36 routes validated

๐Ÿ” Security & Configuration

Environment-Based Configuration

# Development: Auto-generates secure keys
ENVIRONMENT=development

# Production: Requires explicit SECRET_KEY
ENVIRONMENT=production
SECRET_KEY=your_secure_key_here  # Generate with scripts/generate_secret_key.py

Production Security

  • Secret Management: Environment-based with validation
  • No Hardcoded Keys: Production deployment blocked without proper secrets
  • Security Scanning: Automated detection of security issues

๐Ÿ“Š FSRS Spaced Repetition

How It Works

  1. Smart Scheduling: 17-parameter algorithm optimizes review intervals
  2. 4-Point Rating: Again (1 day) โ†’ Hard (2 days) โ†’ Good (4 days) โ†’ Easy (8 days)
  3. Adaptive Learning: Algorithm learns from your performance patterns

API Endpoints

GET /api/v1/flashcards/due-today        # Cards due for review
POST /api/v1/flashcards/{id}/review     # Record review with rating
GET /api/v1/flashcards/stats/overview   # Learning statistics

๐Ÿ’ก Usage Examples

Start Learning Session

# Get cards due today
curl http://localhost:8000/api/v1/flashcards/due-today

# Review with FSRS rating (1=Again, 2=Hard, 3=Good, 4=Easy)
curl -X POST "http://localhost:8000/api/v1/flashcards/card_001/review?difficulty_rating=3"

Upload & Process Documents

# Upload PDF with automatic flashcard generation
curl -X POST -F "file=@document.pdf" -F "generate_flashcards=true" \
  http://localhost:8000/api/v1/documents/upload

Semantic Search

# Search across all documents
curl -X POST -F "query=machine learning concepts" \
  http://localhost:8000/api/v1/documents/search

๐Ÿ› ๏ธ Technology Stack

Component Technology Purpose
Backend FastAPI + Python 3.12 High-performance API
Frontend React + TypeScript + Vite Modern UI
Vector DB Weaviate Cloud Semantic search
Database Supabase PostgreSQL Structured data
AI/ML OpenAI GPT-4 + Embeddings Natural language processing
Algorithm FSRS Scientific spaced repetition

๐Ÿ“ Project Structure

study-wise-ai/
โ”œโ”€โ”€ ๐Ÿ”ง api/                    # FastAPI backend
โ”œโ”€โ”€ ๐Ÿง  src/study_modes/        # Learning modes (FeynmanMode, Traditional)
โ”œโ”€โ”€ ๐Ÿงฎ src/flashcards/         # FSRS spaced repetition system
โ”œโ”€โ”€ ๐Ÿ“„ src/file_handlers/      # Document processing (PDF, DOCX)
โ”œโ”€โ”€ ๐Ÿงช tests/                  # Comprehensive test suite (442 tests)
โ”œโ”€โ”€ ๐Ÿ“Š scripts/                # Validation & deployment tools
โ””โ”€โ”€ ๐Ÿ“– docs/                   # Documentation & guides

๐Ÿšฆ Development Workflow

Making Changes

# 1. Validate starting point
python scripts/pre_merge_validation.py --quick

# 2. Make your changes...

# 3. Auto-validation on commit
git commit -m "Your changes"  # Pre-commit hook runs

# 4. Full validation before PR
python scripts/pre_merge_validation.py

Contributing Guidelines

  1. Install validation: python scripts/install_pre_commit_hook.py
  2. Follow workflow: Design โ†’ Scaffold โ†’ Implement โ†’ Test
  3. Ensure tests pass: All validation must pass before merge
  4. Document changes: Update relevant documentation

๐Ÿ“– Documentation

๐ŸŽฏ Key Endpoints

# Core Application
GET  /                              # Welcome & feature overview
GET  /health                        # System health check
GET  /docs                          # API documentation

# Flashcards (FSRS)
GET  /api/v1/flashcards/due-today   # Cards due for review
POST /api/v1/flashcards/{id}/review # Record review & get next interval

# Documents
POST /api/v1/documents/upload       # Upload PDF/DOCX with processing
POST /api/v1/documents/search       # Semantic search across documents

# Analytics
GET  /api/v1/flashcards/stats/overview  # Learning progress & insights
GET  /api/v1/users/stats             # User statistics & performance

๐ŸŽ‰ Demo & Testing

# Live demos
python demo_spaced_repetition.py    # FSRS algorithm demonstration
python test_feynman_demo.py         # FeynmanMode teaching analysis

# Validation
python scripts/pre_merge_validation.py --quick  # Fast validation
python scripts/pre_merge_validation.py          # Full system validation

# Server
python start_local_demo.py          # Demo server with all features

StudyWise AI - Transforming Learning Through Teaching ๐Ÿง โœจ

Built with modern AI, educational psychology, and comprehensive validation

ยฉ 2025 Renato Boemer. All rights reserved.

About

A multimodal personal knowledge management system using RAG

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages