AI PlatformQ3 2026Solo
Lecture Lense
Turns any recording into searchable, timestamp-cited notes.

The build
Ninety minutes of lecture, and every idea in it findable in seconds.
Problem
A recorded lecture is the worst possible container for what it contains. The material is all there, in order, and completely unsearchable — finding the four minutes where the lecturer defined a term means scrubbing, guessing, and scrubbing again. Auto-captions help a little and hurt a little: they're searchable, but they mis-hear exactly the words that matter most, the domain terms nobody outside the room says.
The thing that was missing wasn't transcription. It was structure — and a way to trust it, because a summary you can't check against the source is just a confident stranger's notes.
Constraints
- No team. One person across five stacks — a Next.js app, a Node worker, a Python inference service, the database, and the ops holding them together. Anything I couldn't debug alone at eleven at night was out before it was considered, which is most of what kept the architecture at three services instead of eight.
- Recordings are long and processing is slow. An hour of audio can't be handled inside a request. Everything after upload had to be a queue, with failure treated as normal rather than exceptional.
- Free tiers only. No budget, so no managed vector database, no per-minute transcription API, and no always-on managed anything. Whatever I couldn't get free, I had to be able to run myself.
- Generated text is guilty until proven otherwise. A model will produce plausible notes about a lecture it misheard. Anything it wrote had to point back at the audio it came from.
Approach
Three services and seven packages over one database. A Next.js app for everything a person touches, a Node worker running the pipeline, and a Python service that owns the models. The split between the last two is language, not domain — Python takes what needs PyTorch, Node takes the rest, and both consume the same queues, so it stays an implementation detail rather than a boundary the product knows about.
Postgres holds the users, the transcript segments, their embeddings, and every generated artifact — one store, so a question can be answered with a single join instead of a fan-out across three systems.
- apps
- web# Next.js 15 — workspace, chat, library, public API
- worker# BullMQ stages, ffmpeg, yt-dlp, exports, clips
- services
- inference# FastAPI — Whisper, pyannote, embeddings
- packages
- ai# prompts, providers, retrieval, pricing, tracing
- db# Drizzle schema + pgvector
- pipeline# flow plan, stage records, run lifecycle
- media# ffmpeg, yt-dlp, S3
- export# Markdown, PDF, DOCX, SRT/VTT, Anki
- study# SM-2 scheduling
- shared# Zod schemas, job payloads, errors
- evals# golden sets, run in CI
The pipeline is twelve stages — ingest, transcribe, diarize, correct, companion align, segment chapters, embed, notes, glossary, study, highlights, finalize — declared to a BullMQ FlowProducer as explicit parent and child jobs rather than each stage enqueueing the next as its last act. Two of them are optional and only enter the plan when the run needs them: diarize when speaker labels were asked for, companion_align when slides were attached. A stage that was planned and turns out not to apply records itself as skipped rather than done, so "every stage succeeded" and "every stage ran" stay separate questions.
Every stage writes its own row before it starts and checks for that row before it runs, so a stage that dies halfway through resumes instead of redoing the hour of transcription in front of it. Each row carries duration, tokens and cost, which is where every timing and cost figure in the UI comes from — none are estimated. A failure marks the recording partial when usable output already exists, and failed only when nothing does.
The stage worth describing is correction. Whisper mishears domain vocabulary in a specific, predictable way: it substitutes a common word that sounds like the uncommon one. My first attempt was a dictionary of known substitutions, which fixed the errors I'd already seen and none of the ones I hadn't. The replacement passes a window of segments to a model along with what the lecture is about, and asks for edits with reasons — so "code" becomes "dam" in a hydraulics lecture because the surrounding sentences are about spillways, not because anyone wrote that rule down. Windows with no low-confidence words never reach a model at all.
Retrieval is deliberately unclever: vector search and Postgres full-text run separately over the same rows the UI renders, and their rankings are fused with RRF, because the questions people ask are half conceptual and half a half-remembered exact phrase. Scope is a mandatory predicate rather than a filter applied afterwards, which is what makes a cross-recording leak structurally impossible instead of merely guarded against.
// The prompt speaks in short handles — M1:12 — and the mapping back to
// milliseconds lives beside the parser, because a citation that resolves to the
// wrong second is worse than none: it points somewhere plausible and nothing
// looks broken.
const result = await retriever.retrieve({
scope: { kind: "media", mediaId },
query,
});
return {
answer,
citations: parseCitations(answer, result).map((c) => ({
mediaId: c.mediaId,
startMs: c.startMs, // clicking this seeks the player
endMs: c.endMs,
})),
};Around that sit the parts that make it a product rather than a pipeline: collections and cross-recording search, flashcards on SM-2 with quizzes, exports to Markdown, PDF, DOCX, SRT/VTT, Anki and Obsidian, share links, rendered highlight clips, a public API under /api/v1 with an OpenAPI spec generated from the same Zod schemas, and a settings page where a user can bring their own OpenAI, Google or Groq key — verified against the provider, sealed with AES-256-GCM, and used for their recordings instead of the deployment's, so their minutes stop being metered.
Tradeoffs
- Self-hosted Whisper over a transcription API. A hosted endpoint is four cents an hour and instant to integrate; running
faster-whisperon a CPU box is free and slower than real time. I took the slow one because the pipeline is asynchronous anyway — nobody is waiting on a spinner — and because the cost of the whole product then lives in one place I control. - One Postgres over a purpose-built vector database. A dedicated store would search faster at scale I don't have. Keeping embeddings beside the segments they came from meant chapters, glossary terms, and citations all resolve in the same query, and there was one fewer service to keep alive on a free tier.
- Correcting transcripts with a model, knowing it can invent. A model that rewrites text can rewrite it wrongly. The guard is a cap on how much of any window it may change, plus every edit stored with its original and a reason, revertible in the UI. Confident silence would have been the worse failure.
- Speaker labels from pyannote alone. The usual recipe bolts whisperX on for word-level alignment first. That's a second model, a second set of weights, and a second failure mode for a feature that only needs to know who is talking at a given second, which pyannote already answers. Segment-level attribution is occasionally wrong at a handover; a whole dependency was the price of fixing that.
- Batch processing over anything live. No real-time transcription, no live meeting bot. Both are a different architecture wearing the same product's clothes.
Outcome
An hour of audio costs cents to process and comes back as chapters, three lengths of notes, a glossary, flashcards, quizzes, highlight clips, and an index that answers questions with the timestamp it read the answer from.
On the committed baseline, retrieval finds a gold segment in the top five for 97% of questions, with an MRR of 0.80 — the answer is in what the model gets, and near the top of it. Correction lands at 0.85 edit F1 against hand-labelled transcripts, and chapter boundaries at 0.86 F1 within thirty seconds of where a human drew them. Every one of those comes from pnpm eval against a committed baseline, and CI fails the build if any drops more than 5% — or if a suite reports a metric the baseline has no bar for, which is how a whole suite once ran green while checking nothing.
The whole thing runs on free tiers with one small box doing the work, and one person on call for it. Those two constraints shaped most of the decisions above.
Decisions
What was chosen against, and why:
- Postgres with pgvector over MongoDB and Chroma. The earlier version of this used both, plus a separate relational store for users — three databases, three failure modes, and no way to ask a question that crossed them. Consolidating cost me document flexibility I wasn't using and bought back the only thing in short supply, which was attention. Against it: pgvector's index needs tuning that a dedicated store handles for you.
- Timestamps as the primary key of the product. Every artifact — chapter, note heading, flashcard, quiz question, citation — carries a time and seeks the player. It constrained the UI heavily, since everything has to belong somewhere on a timeline. It also made the product checkable, which was the point.
- A chain, not a tree. The dependency graph says slide alignment could run beside chapter segmentation, both after correction. A BullMQ job has exactly one parent, so that branch can't be expressed literally, and the optional stage is sequenced after correction instead. It costs a little parallelism on a stage that only runs when slides are attached; the alternative was hand-rolling a second dependency mechanism next to the one the queue already has.
- Evaluating prompts in CI, before building more features. Golden sets for correction, retrieval, chaptering and chat, run on every change to the prompts, failing the build on a regression. It's unglamorous work that shipped nothing users can see, and building it alone meant a week spent labelling data instead of adding features. Without it, though, there is no second reader — "I improved the prompt" stays a feeling rather than a claim.
- Measuring retrieval by hit rate and MRR, not precision@5. The original plan set the bar at precision@5 ≥ 0.8. The baseline reads 0.22, which looks like missing by a factor of four and isn't: most questions about a lecture have one correct answer in one place, and precision at 5 divides by the five results returned, so a perfect retriever caps at 0.2. The metric was measuring the shape of the dataset, not the quality of the search. Hit rate answers the question the chat prompt actually depends on; MRR answers whether it survives the context budget.
- Model tiering over one good model everywhere. A cheap model does correction, chaptering, glossary and flashcards; a stronger one writes notes, answers questions and explains quiz answers. It cut the per-recording cost by most of it, at the price of a provider abstraction and a second set of prompt behaviours to keep an eye on.
Stack
- Next.js 15
- TypeScript
- BullMQ
- Postgres + pgvector
- Drizzle
- FastAPI
- faster-whisper
- pyannote
- Vercel AI SDK
- Docker
Related projects

Chitter
A mini social app that lets users sign up, log in and post whatever is on their mind.

Heckfree
Users get a public profile that showcases all of their links in one place.

Coscholars
An Ed-Tech platform built end to end during my internship at Coscholars.