Synapse is an AI-powered lecture intelligence platform that works as a second brain for students, teachers and researchers. Feed it a lecture in almost any form (live voice recording, a YouTube link, a PDF, slides, handwritten notes or audio) and it returns a complete study kit: structured notes, flashcards, timed quizzes, auto-generated concept diagrams and multi-agent deep research.
Under the hood it ships with Supabase authentication, shared team workspaces and a complete Stripe subscription billing layer, so it behaves like a real SaaS product rather than a demo.
Everything below is implemented and working today.
- ποΈ Live recording: capture the microphone and transcribe in the browser with the Web Speech API.
- πΊ YouTube import: paste a public video link and the backend pulls the transcript and sends it through the AI pipeline.
- π File uploads: PDFs, PowerPoint decks, images of handwritten notes, audio files, plus plain transcripts and text summaries.
- π Study notes: summaries, key takeaways, exam-prep questions and reminders generated from each lecture.
- π Concept maps: Mermaid.js diagrams are produced automatically to show how ideas or events connect.
- π¬ Chat with your lectures: ask questions, request deeper explanations or clarify topics against the context of your own notes.
- π¬ Deep research over SSE: a multi-agent run that analyses your notes and streams live progress to the browser via Server-Sent Events.
- π Flashcards: decks generated automatically and grouped by topic and difficulty.
- β Quizzes: multiple-choice practice exams with a timer, created on demand.
- π₯ Team workspaces: shared folders for study groups and projects, governed by role-based access control (RBAC) with four roles:
Owner,Admin,EditorandViewer.
- π Authentication: sessions handled end to end by Supabase SSR auth.
- π³ Subscription plans: four tiers (Explorer, Pro, Premium, Team) kept in sync with Stripe billing intervals.
- β‘ Daily quotas: per-plan limits on AI queries, YouTube imports, flashcard generations and quiz generations keep API costs under control.
- π‘οΈ Row-Level Security (RLS): Postgres policies make sure users can only read, write or delete their own notes and flashcards.
- π JWT verification: every backend request carries a Supabase access token, which FastAPI dependencies verify with
SUPABASE_JWT_SECRETbefore any router runs. - π¦ Secrets stay server-side: Anthropic/Groq keys, Stripe keys and the Supabase service-role key never reach the browser bundle.
graph TD
Client[Next.js 16 + React 19 Frontend]
STT[Web Speech API STT] --> Client
Client -->|API Requests + Auth JWT| Gateway[FastAPI Backend Gateway]
Gateway -->|User Auth Verification| SupabaseAuth[Supabase Auth / SSR]
Gateway -->|Data & Notes CRUD| SupabaseDB[(Supabase PostgreSQL)]
Gateway -->|Contextual Prompting| Claude[Claude Sonnet 4 API]
Gateway -->|Billing & Subscriptions| Stripe[Stripe API & Webhooks]
Gateway -->|Usage Tracking| Cache[(In-Memory / Postgres Usage Tracker)]
| Layer | Technologies |
|---|---|
| Frontend | React 19 Β· Next.js 16 (App Router) Β· TypeScript Β· Tailwind CSS v4 Β· Framer Motion Β· shadcn/ui |
| Backend | FastAPI Β· Pydantic Β· Python 3.10+ Β· Uvicorn |
| Database | Supabase PostgreSQL |
| Authentication | Supabase SSR session provider |
| AI Processing | Claude Sonnet 4 via the Anthropic API (Groq available as an alternative provider) |
| Payments | Stripe (Checkout, Webhooks, Billing Portal) |
| Diagrams | Mermaid.js (client-side rendering) |
synapse/
βββ frontend/
β βββ app/
β β βββ (auth)/ # Login and sign-up screens
β β βββ ask/ # AI chat Q&A and deep research
β β βββ flashcards/ # Flashcard review
β β βββ notes/ # Notes library, detail view and editor
β β βββ pricing/ # Plan cards and Stripe checkout
β β βββ quiz/ # Multiple-choice quizzes
β β βββ record/ # Live recording and transcript view
β β βββ search/ # Global full-text search
β β βββ settings/ # Billing and account settings
β β βββ youtube/ # YouTube transcript import
β β βββ globals.css # Tailwind v4 setup and design tokens
β β βββ layout.tsx # Root layout with the sidebar dock
β βββ components/ # Custom components and shadcn/ui primitives
β βββ lib/ # Supabase SSR clients, API helpers, TS utilities
β βββ package.json
βββ backend/
β βββ app/
β β βββ main.py # App creation and CORS setup
β β βββ config.py # Settings loaded with Pydantic BaseSettings
β β βββ dependencies.py # Shared FastAPI dependencies (auth, DB, settings)
β β βββ middleware/ # Auth and subscription/limit checks
β β βββ migrations/ # PostgreSQL schema SQL scripts
β β βββ models/ # Database client and Pydantic schemas
β β βββ routers/ # API routes (notes, youtube, ask, billing, workspaces, ...)
β β βββ services/ # Business logic (ai_service, stripe_service, usage_service)
β βββ requirements.txt # Python dependencies
β βββ .env.example # Environment variable template
βββ docs/ # PRD, architecture, rules and roadmap
βββ README.md # You are here
You will need:
- Node.js v18 or newer
- Python 3.10 or newer
- A Supabase account with a project
- An Anthropic API key (or a Groq key if you prefer that provider)
- A Stripe developer account
Run the SQL scripts in backend/app/migrations from the Supabase SQL editor or the Supabase CLI, in this order:
001_subscription_tables.sqlcreates the subscription, daily-usage and payment tables and seeds the Explorer, Pro, Premium and Team plans.002_team_workspaces.sqladds workspaces and memberships, and links notes to workspaces.
-
Move into the backend folder:
cd backend -
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate
-
Install the dependencies:
pip install -r requirements.txt
-
Create your environment file:
cp .env.example .env
Then fill in
.env:ANTHROPIC_API_KEY: your Anthropic key.SUPABASE_URL,SUPABASE_SERVICE_KEY,SUPABASE_JWT_SECRET: from your Supabase project settings.STRIPE_SECRET_KEY,STRIPE_WEBHOOK_SECRET,STRIPE_PRICE_*: your Stripe secrets and price IDs.
-
Start the API server:
uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload
- Move into the frontend folder:
cd frontend - Install the packages:
npm install
- Create a
.env.localfile infrontend/with your Supabase and API settings:NEXT_PUBLIC_SUPABASE_URL=https://your-project-ref.supabase.co NEXT_PUBLIC_SUPABASE_ANON_KEY=your-supabase-anon-key NEXT_PUBLIC_API_URL=http://localhost:8000
- Start the dev server:
npm run dev
- Open http://localhost:3000 in your browser.
Synapse stores its data in a relational PostgreSQL database hosted on Supabase. The main tables relate like this:
βββββββββββββββββ
β auth.users β
βββββββββ¬ββββββββ
β
ββββββββββββββββββΌβββββββββββββββββ¬ββββββββββββββββ
βΌ βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββ ββββββββββββββββββ βββββββββββββ
βuser_subscriptionsβ βworkspaces β β usage_daily β β notes β
ββββββββββ¬βββββββββ βββββββ¬ββββββ ββββββββββββββββββ βββββββ¬ββββββ
β β β
βΌ βΌ βΌ
βββββββββββββββββββ βββββββββββββ βββββββββββββ
β payment_history β βwksp_membersβ βflashcards β
βββββββββββββββββββ βββββββββββββ βββββββββββββ
notes: summaries, topics and tags, raw transcripts, key points, study schedules and Mermaid diagrams, each scoped to aworkspace_id.flashcards: AI-generated cards with question, answer, display order and difficulty.workspacesandworkspace_members: teams, shared folders and each member's RBAC role.subscription_plansanduser_subscriptions: available tiers, each user's current plan, Stripe sync data and billing dates.usage_daily: a daily counter of operations (YouTube imports, AI queries and so on) used to enforce plan limits.
Contributions are welcome. Before opening a pull request, read docs/rules.md for the architecture guidelines, naming conventions and PR rules.
Aayush β GitHub