Flashcard Quiz App is a full-stack web application built with Python (Streamlit) and Supabase.
It helps users study efficiently by creating and reviewing flashcards. Users can manually add flashcards or upload PDFs to extract content and generate flashcards automatically.
- Add Flashcards Manually: Create custom Q&A pairs.
- Upload PDFs: Extract text and optionally generate flashcards automatically.
- Quiz Mode: Randomized questions with immediate feedback.
- Review Mode: Retry flashcards answered incorrectly.
- Persistent Data Storage: All flashcards and progress stored in Supabase.
FLASHCARDQ&A/
|
|---src/ # Core application logic
| |---logic.py # Business logic and task
operations
| |---db.py # DataBase operations
|
|---api/ # Backend API
| |---main.py # FastAPI endpoints
|
|---frontend/ # Frontend application
| |---app.py # Streamlit web interface
|
|---requirements.txt # Install python dependencies
|
|---README.md # Project Documentation
|
|---.env # Python Variables (supabase)
- Python 3.8 or higher
- A Supabase Acoount
- Git (Push/Pull/Clone)
git clone https://github.com/dharanikandikonda7/PythonFullStackProject
pip install -r requirements.txt
1.Create a Supabase Project:
- create the Tasks Table:
- Go to the SQL Editor in your Supabase dashboard
- Run this SQL Command:
-- Table for flashcards
CREATE TABLE flashcards (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
question TEXT NOT NULL,
answer TEXT NOT NULL,
source TEXT DEFAULT 'manual', -- 'manual' or 'pdf'
created_at TIMESTAMP DEFAULT NOW()
);
-- Progress
CREATE TABLE progress (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
flashcard_id BIGINT REFERENCES flashcards(id) ON DELETE CASCADE,
is_correct BOOLEAN NOT NULL,
attempted_at TIMESTAMP DEFAULT NOW()
);
-- Upload PDFs
CREATE TABLE uploaded_pdfs (
id BIGINT GENERATED ALWAYS AS IDENTITY PRIMARY KEY,
file_name TEXT NOT NULL,
uploaded_at TIMESTAMP DEFAULT NOW(),
user_id BIGINT NULL -- Optional, for multi-user support
);
- Get Your Credintials:
-
create a
.env
file in the project root -
Add Your Supabase credentials to
.env
: SUPABASE_URL=YOUR_PROJECT_URL_HERE SUPABASE_KEY=YOUR_ANON_KEY_HERE
streamlit run frontend/app.py
The app will open inyour browser at http://localhost:8000
cd api python main.py
The app will be available at http://localhost:8000
Add flashcards manually or upload PDFs
Start a quiz session to practice questions
Submit your answers and get instant feedback
Track your progress with performance graphs
Frontend: Streamlit (Python-based interactive web interface)
Backend: Python (handles quiz logic, PDF processing, and communication with Supabase)
Database: Supabase (PostgreSQL) – stores flashcards, quiz progress, and optional PDF metadata
Programming Language: Python
-
src/db.py
:Database operations Handles all CRUD operations with Supabase -
src/logic.py
: Business logic Task validation and Processing -
api/main.py
: Backend API. Contains FastAPI endpoints to interact with the frontend and database. -
frontend/app.py
: Frontend application. Streamlit interface for users to interact with the Flashcard Q&A system. -
requirements.txt
: Python dependencies. Lists all required packages for the project. -
.env
: Environment variables. Stores sensitive configuration like Supabase keys and API credentials. -
README.md
: Project documentation. Contains overview, setup instructions, and usage details.
-
"Module not found" errors
make sure you've installed all Python dependencies and that Python can find your packages.- Install deps:
pip install -r requirements.txt
- Ensure your package folders are importable (either add
__init__.py
files or run with the project root onPYTHONPATH
). Examples:- Add
__init__.py
(empty) toapi/
andsrc/
. - Or set
PYTHONPATH
(mac / linux):(PowerShell)export PYTHONPATH=$(pwd) uvicorn api.main:app --reload --port 8000
$env:PYTHONPATH = (Get-Location).Path uvicorn api.main:app --reload --port 8000
- Add
- If you use relative imports, run uvicorn with module form from project root:
uvicorn api.main:app --reload --port 8000
- Install deps:
-
Supabase connection errors / invalid credentials
make sure you've added correct Supabase variables to.env
and loaded them..env
should include:SUPABASE_URL=https://your-project.supabase.co SUPABASE_KEY=your_anon_or_service_key
- Verify the values are not expired/rotated and that your network allows outbound HTTPS to Supabase.
-
"Could not find table 'public.xxx' / SQL errors
make sure you've created the required tables in Supabase (run the SQL in the README).- Double-check table names and schema (usually
public
). - Run the SQL in Supabase → SQL Editor and confirm tables exist.
- Double-check table names and schema (usually
-
Streamlit:
File does not exist: app.py
make sure you run Streamlit from the folder containingapp.py
, or provide full path:# if app.py is inside frontend/ streamlit run frontend/app.py
run
dir
(Windows) orls
(mac/linux) to confirm file location. -
Uvicorn import / relative import errors
common cause: running from wrong directory or missing__init__.py
.- Use absolute imports (
from src.logic import ...
) and run from project root. - Or run with
python -m uvicorn api.main:app --reload
to ensure package imports resolve.
- Use absolute imports (
-
Port already in use
change port or kill existing process. Example (Windows):netstat -ano | findstr 8000 taskkill /PID <pid> /F
or start uvicorn on a different port:
uvicorn api.main:app --reload --port 8001
-
CORS errors when frontend calls backend
ensure your FastAPI has CORS configured (allow origins for Streamlit). Example inapi/main.py
:from fastapi.middleware.cors import CORSMiddleware app.add_middleware( CORSMiddleware, allow_origins=["http://localhost:8501","http://127.0.0.1:8501"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"], )
-
PDF upload / PyPDF2 extraction errors
- Verify the uploaded file is a valid PDF and saved successfully before processing.
- For large PDFs, processing may take time—check server logs and increase timeouts if needed.
- Confirm
PyPDF2
version inrequirements.txt
and that it is installed.
-
OneDrive / Windows file-lock & permission issues
if your project is inside OneDrive, files may be locked or synced. Try moving the project to a non-OneDrive folder (e.g.,C:\projects\FlashCardQ&A
) and re-run. -
API returns unexpected JSON / frontend errors when parsing
- Inspect API response with
print(resp.status_code, resp.text)
in the frontend or use Postman/curl to check exact shape. - Make sure frontend
requests
code expects the same structure your backend returns (e.g.,{"Success": True, "data": [...]}
vs[...]
).
- Inspect API response with
- Activate virtual env:
venv\Scripts\activate
(Windows) orsource venv/bin/activate
(mac/linux) - Install deps:
pip install -r requirements.txt
- Confirm
.env
values and restart server(s). - Start backend from project root:
uvicorn api.main:app --reload --port 8000
- Start frontend with correct path:
streamlit run frontend/app.py
- If something fails, copy & paste the full traceback into the issue — that makes fixing much faster.
-
Multi-User Support (Auth & Profiles)
Add sign-up / sign-in (JWT or Supabase Auth) so each user has a personal set of flashcards and progress. -
Flashcard Categories / Topics
Add atopic
column and UI filters so users can choose a subject-specific quiz. -
Spaced Repetition Scheduler
Implement an SRS algorithm (e.g., SM-2) to surface cards at optimal intervals for retention. -
Analytics Dashboard
Track per-user metrics: daily accuracy, average response time, most-missed cards; show charts and trends. -
Enhanced PDF Processing
Improve Q&A generation using NLP (OpenAI or local ML models): extract key sentences, generate Q/A, and optional multiple-choice. -
Import / Export (CSV / JSON)
Allow users to import large decks or export their decks and progress for backup or sharing. -
Mobile-Friendly UI
Improve responsive layout and test on mobile browsers (or create a PWA). -
Gamification
Badges, streaks, leaderboards, and small rewards to motivate daily practice. -
Offline Mode / Local Cache
Keep a lightweight local cache of flashcards so users can practice without a network connection, syncing when back online. -
Role-based Admin Panel
Admin UI to moderate uploaded PDFs, review auto-generated flashcards and manage content quality.
If you encounter any issues or have questions: dharanikandikonda7@gmail.com