An AI-powered learning platform with document retrieval, spaced-repetition flashcards, and interactive mind maps.
Context: This project was built during the summer of 2023, when GPT-4 had just come out. I had early access to the GPT-4 API, which at the time was locked behind a program where you had to contribute evaluation benchmarks to OpenAI to get in. This was how I first got into the LLM/AI application space.
Back then there were no established RAG frameworks or vector database ecosystems to lean on. I built the document retrieval pipeline from scratch: PDF text extraction, OpenAI embeddings, vector storage in Firestore, and client-side similarity search with TensorFlow.js. Today there are dedicated solutions for all of this, but building it from the ground up taught me a lot about how these systems actually work.
Upload a PDF, generate page-level embeddings via OpenAI, and search the document using natural language. Results are ranked by vector similarity with TensorFlow.js.
Chat with a GPT-powered teacher in the context of a lesson.
Ask the AI to generate flashcards from the lesson content. They come back as structured JSON and feed into a spaced repetition system (1d, 7d, 1mo, 3mo, 1yr).
| Layer | Tech |
|---|---|
| Framework | SvelteKit, Svelte 3, TypeScript |
| Styling | Tailwind CSS, DaisyUI |
| AI | OpenAI API (chat completions, embeddings) |
| Vector Search | TensorFlow.js (client-side similarity) |
| Database | Firebase Firestore (real-time sync) |
| Auth | Firebase Authentication |
| Storage | Firebase Cloud Storage + IndexedDB (offline cache) |
| PDF.js (rendering, text extraction) | |
| Maps | Leaflet.js |
| Markdown | Remark + Rehype (KaTeX math, syntax highlighting) |
Clone the repo and install dependencies:
npm install
Copy .env.example to .env and fill in your OpenAI API key:
cp .env.example .env
# edit .env and set OPENAI_API_KEY=sk-...
(Optional) For server-side Firestore features, place your Firebase Admin SDK credential at:
secret/project-socrates-firebase-admin-sdk.json
Download from: Firebase Console > Project Settings > Service Accounts > Generate New Private Key.
Start the dev server:
npm run dev
The app uses Firebase Authentication. Sign in or create an account on the login screen.