Skip to content

sidhantpande/Askmynotes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“š AskMyNotes β€” Subject-Scoped AI Study Copilot

πŸš€ Live Demo: https://askmynotes-algorise.vercel.app

Important

Note: Responses may occasionally fail with a "something went wrong" message due to the daily 20-request quota limit of the Gemini API free tier.

Stop asking general AI. Ask your notes.
The AI tutor that actually knows your curriculum, provides citations, and prevents hallucinations.

AskMyNotes is a full-stack RAG (Retrieval-Augmented Generation) study app built with Next.js 16, Gemini 2.0 Flash, ChromaDB, and Supabase Auth. Upload your lecture notes (PDF or text), and get an AI copilot that answers questions only from your material β€” with confidence scores, citations, and source snippets.


✨ Features

Feature Description
πŸ” Auth Supabase email/password authentication with middleware-protected routes
πŸ“„ PDF & Text Upload Upload study material (PDF or paste text) β€” chunked and embedded into ChromaDB
πŸ’¬ RAG Chat Ask questions and get answers grounded in your notes with confidence badges and citations
πŸ“š Study Mode Generate MCQs (5) or Short Q&A (3) directly from your uploaded material
πŸŽ™οΈ AI Voice Assistant Speak your questions and hear AI answers using Web Speech API
πŸ’Ύ Chat Persistence Chat history saved per subject via localStorage β€” survives page reloads
πŸŒ— Dark / Light Mode Full theme toggle with smooth transitions
πŸ‘€ Profile Modal View user profile with study stats
🎨 Premium UI Glassmorphism, gradient accents, micro-animations, Bricolage Grotesque font

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Next.js    │────▢│   Gemini     β”‚     β”‚   Supabase   β”‚
β”‚   Frontend   β”‚     β”‚   2.0 Flash  β”‚     β”‚   Auth       β”‚
β”‚   (App Router)β”‚     β”‚   (LLM +     β”‚     β”‚              β”‚
β”‚              β”‚     β”‚   Embeddings)β”‚     β”‚              β”‚
β””β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
       β”‚
       β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   ChromaDB   β”‚
β”‚   Vector     β”‚
β”‚   Store      β”‚
β”‚  (Persisted) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

How RAG Works

  1. Upload β†’ PDF/text is chunked (500 chars, 50 overlap) β†’ embedded via Gemini β†’ stored in ChromaDB with {userId, subject} metadata
  2. Ask β†’ Question is embedded β†’ top-k similar chunks retrieved (filtered by user + subject) β†’ Gemini generates answer with citations
  3. Study β†’ Context chunks retrieved β†’ Gemini generates MCQs or short-answer questions grounded in the material

πŸ“‚ Project Structure

src/
β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   β”œβ”€β”€ ask/route.js          # RAG Q&A endpoint
β”‚   β”‚   β”œβ”€β”€ study/route.js        # MCQ & Short Q&A generator
β”‚   β”‚   └── upload/route.js       # PDF/text upload + chunking + embedding
β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”œβ”€β”€ actions.js            # Supabase login/signup/logout server actions
β”‚   β”‚   β”œβ”€β”€ auth.css              # Auth page styles
β”‚   β”‚   └── page.js               # Login / Sign-up page
β”‚   β”œβ”€β”€ dashboard/
β”‚   β”‚   β”œβ”€β”€ dashboard.css         # Dashboard styles (incl. voice assistant)
β”‚   β”‚   └── page.jsx              # Dashboard with subjects, AI tools, voice panel
β”‚   β”œβ”€β”€ subject/[id]/
β”‚   β”‚   β”œβ”€β”€ page.jsx              # Subject page: upload, chat, study mode
β”‚   β”‚   └── subject.css           # Subject page styles
β”‚   β”œβ”€β”€ globals.css               # Design system: tokens, components, animations
β”‚   β”œβ”€β”€ layout.js                 # Root layout with Google Fonts
β”‚   └── page.js                   # Landing page
β”œβ”€β”€ components/
β”‚   └── dashboard/
β”‚       β”œβ”€β”€ Header.jsx            # Dashboard header with theme toggle
β”‚       └── Sidebar.jsx           # Sidebar with workspace subjects
β”œβ”€β”€ lib/
β”‚   β”œβ”€β”€ gemini.js                 # Gemini LLM + embeddings singleton
β”‚   └── vectorStore.js            # ChromaDB connection + collection management
β”œβ”€β”€ utils/
β”‚   └── supabase/
β”‚       β”œβ”€β”€ client.js             # Browser Supabase client
β”‚       └── server.js             # Server-side Supabase client
└── middleware.js                  # Auth route protection

πŸš€ Getting Started

Prerequisites

  • Node.js β‰₯ 18
  • Python β‰₯ 3.8 (for ChromaDB)
  • A Google AI Studio account (aistudio.google.com) for the Gemini API key
  • A Supabase project (supabase.com) for authentication

1. Clone the repo

git clone https://github.com/YOUR_USERNAME/AskMyNotes.git
cd AskMyNotes

2. Install dependencies

npm install --legacy-peer-deps

--legacy-peer-deps is needed because @langchain/community expects pdf-parse@2.x as an optional peer, but we use 1.1.1 for Turbopack compatibility.

3. Install ChromaDB

pip install chromadb

4. Set up environment variables

Create a .env.local file in the project root:

# Supabase (get these from your Supabase project β†’ Settings β†’ API)
NEXT_PUBLIC_SUPABASE_URL=https://YOUR_PROJECT.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key

# Google Gemini (get from https://aistudio.google.com/apikey)
GEMINI_API_KEY=your_gemini_api_key

# ChromaDB
CHROMA_URL=http://localhost:8000

5. Set up Supabase Auth

  1. Go to your Supabase project dashboard
  2. Navigate to Authentication β†’ Providers
  3. Ensure Email provider is enabled
  4. (Optional) Disable email confirmation for dev: Authentication β†’ Settings β†’ Confirm Email β†’ toggle off

6. Start ChromaDB

chroma run --host 0.0.0.0 --port 8000 --path /tmp/chroma_data

ChromaDB will persist data at /tmp/chroma_data. Change the path if you want a permanent location.

7. Start the dev server

npm run dev

Open http://localhost:3000 πŸš€


πŸ§ͺ Usage Guide

1. Sign Up / Log In

Navigate to /auth and create an account with email and password.

2. Create a Subject

From the dashboard, click Create Subject and give it a name (e.g., "Physics", "Biology").

3. Upload Material

Click on a subject β†’ choose Paste Text or Upload PDF β†’ your material is chunked, embedded, and stored.

4. Ask Questions

Type a question in the chat bar. The AI will answer using only your uploaded notes, showing:

  • Confidence badge (High / Medium / Low)
  • Citations (file name + chunk ID)
  • Supporting snippets (collapsible)

5. Study Mode

Click the πŸ“š button in the prompt bar β†’ choose:

  • MCQ Practice β†’ 5 multiple-choice questions with explanations
  • Short Q&A β†’ 3 short-answer questions with answers

6. Voice Assistant

From the dashboard, click the AI Voice Assistant card β†’ select a subject β†’ tap the mic β†’ speak your question β†’ hear the AI response.


πŸ”§ API Routes

Route Method Description
/api/upload POST Upload PDF/text, chunk, embed, store in ChromaDB
/api/ask POST RAG query β€” retrieve relevant chunks + generate answer
/api/study POST Generate MCQs (type: "mcq") or short Q&A (type: "short")

All routes are auth-gated β€” they verify the Supabase session and scope queries by userId + subject.


πŸ› οΈ Tech Stack

Layer Technology
Framework Next.js 16 (App Router, Turbopack)
Language JavaScript (React 19)
LLM Google Gemini 2.0 Flash (gemini-2.0-flash)
Embeddings Google Gemini Embedding (text-embedding-004)
Vector Store ChromaDB (persistent, self-hosted)
Auth Supabase (email/password)
PDF Parsing pdf-parse v1.1.1
Text Splitting LangChain RecursiveCharacterTextSplitter
Styling Vanilla CSS (glassmorphism, dark mode)
Font Bricolage Grotesque (Google Fonts)

⚠️ Troubleshooting

PDF upload fails

  • Make sure ChromaDB is running (chroma run ...)
  • Check that pdf-parse is v1.1.1: npm ls pdf-parse
  • Clear the .next cache: rm -rf .next && npm run dev

"Unauthorized" errors

  • Verify your Supabase keys in .env.local
  • Make sure you're logged in (session cookies must be present)

"No notes found" in study mode

  • Upload material to the subject first before generating study questions

Voice assistant not working

  • Use Chrome β€” SpeechRecognition API is not supported in all browsers
  • Allow microphone permissions when prompted

πŸ“„ License

MIT


Askmynotes

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors