How LectureLink is built

A full-stack AI study platform — from audio transcription to adaptive mastery tracking. Here's what's under the hood.

Architecture Overview

lecturelink.caCloud Run: Next.js 16 frontend
api.lecturelink.caCloud Run: FastAPI backend + arq worker
RedisQueue + cache
SupabasePostgreSQL + pgvector + Auth + Storage
Google Gemini APITranscription, concepts, RAG

Frontend

Next.js 16 + React 19

App Router, RSC, 33 pages, streaming SSR, TypeScript strict mode.

Tailwind CSS 4 + shadcn/ui

Custom design system, oklch color space, semantic tokens, 173+ components.

Radix UI

Accessible primitives, WCAG keyboard nav, ARIA labels.

Backend

FastAPI + Python 3.12

22 API modules, Pydantic, fully async.

arq (Redis job queue)

Background workers, always-on Cloud Run.

Google Gemini 2.5 Flash

Single LLM for transcription, slides, concepts, quizzes, tutoring, RAG.

Data

Supabase (PostgreSQL + pgvector)

Auth, storage, RLS, hybrid search via RRF.

Gemini embeddings (2000-dim)

pgvector storage, hybrid_search RPC via UNION.

Redis

LLM caching, job queue, session state.

AI / ML

6-Stage Processing Pipeline

Input router → Transcription → Slides → Alignment → Concepts (V2, dedup-aware) → Embedding.

Bayesian Knowledge Tracing

Per-concept mastery, confidence-weighted, unified mastery.py.

4-Signal Readiness

Coverage 35%, Practice 30%, Freshness 20%, Effort 15%.

Concept Registry

Two-pass dedup (title + embedding cosine similarity).

Infrastructure

Google Cloud Run

3 services (API 2 CPU / 2 GB, Worker 1 CPU / 1 GB always-on, Web 256 MB).

GitHub Actions CI/CD

Workload Identity Federation, prod + staging pipelines.

Observability

Sentry, PostHog, Langfuse, bug reporting → GitHub Issues.

Testing

1,298

unit tests across 92 files

E2E

Playwright integration tests

Critic

Quiz critic agent validates question quality

Full

Integration tests for lecture processing pipeline

Key Engineering Decisions

Deterministic-first architecture

LLM calls are constrained and grounded in structured data. If the LLM fails, deterministic layers (schedule-based, keyword overlap, embedding similarity) still work.

Unified mastery system

One learning_events table and a shared mastery module replaced fragmented tracking across features. Single source of truth.

Parallel execution

Development decomposed into non-conflicting tracks with explicit sync points, yielding ~3× throughput over sequential execution.

Syllabus locking

Syllabus confirmed by student then locked. Re-upload requires full course deletion. Eliminates complex cascade cleanup.