What if AI didn't just explain your notes, but actually figured out what you should study next?
This is my submission for the Hacktoberfest Weekend Challenge: Build for a Friend.
I built PrepFlow because students don't usually have a shortage of study material.
They have the opposite problem.
Too much of it.
PDFs. Notes. Syllabi. Previous-year questions. Multiple subjects. Weak topics. Different confidence levels. And a deadline that keeps getting closer.
The difficult question isn't:
โWhat does this PDF say?โ
It's:
โGiven everything I need to learn, how should I spend the limited time I have left?โ
That's the problem PrepFlow tries to solve.
๐ง The Idea
PrepFlow takes this:
BEFORE PREPFLOW
โโโโโโโโโโโ โโโโโโโโโโโ โโโโโโโโโโโ
โ PDFs โ โ Notes โ โ Syllabusโ
โโโโโโฌโโโโโ โโโโโโฌโโโโโ โโโโโโฌโโโโโ
โ โ โ
โโโโโโโโโโโโโโโผโโโโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโ
โ STUDENT โ
โ โ
โ "What do I โ
โ study today?" โ
โโโโโโโโโโโโโโโโโ
and turns it into:
WITH PREPFLOW
PDF / TEXT
โ
โผ
โโโโโโโโโโโโโโโโ
โ EXTRACT โ
โ page-aware โ
โ text โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ CHUNK โ
โ deterministicโ
โ boundaries โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ GEMMA โ
โ understand โ
โ material โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ VERIFY โ
โ evidence + โ
โ structured โ
โ output โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ PRIORITIZE โ
โ importance โ
โ weakness โ
โ urgency โ
โ difficulty โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ PLAN โ
โ capacity + โ
โ prerequisitesโ
โ revision โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ TODAY โ
โ โ
โ 1. Dynamic Programming โ
โ 2. Graph Traversal โ
โ 3. Revise Greedy โ
โ โ
โ 145 / 160 min planned โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโ
The important part is that AI doesn't generate the final timetable.
That distinction shaped almost the entire architecture.
๐ฏ The Core Principle
I split the system into two responsibilities:
| AI should do | Software should do |
|---|---|
| Understand unstructured material | Calculate available time |
| Identify topics | Calculate priority |
| Identify subtopics | Enforce capacity |
| Suggest prerequisites | Validate evidence |
| Estimate semantic difficulty | Persist state |
| Connect topics to source evidence | Schedule tasks |
| Interpret weak-topic hints | Schedule revision |
| Produce structured analysis | Handle progress |
| Recover missed work |
Why?
Because I don't want an LLM deciding whether:
โYou have 120 minutes available, so I'll give you 157 minutes of work.โ
That's not intelligence.
That's a bug.
So PrepFlow follows a simple rule:
AI interprets. Deterministic software decides.
๐ The Full PrepFlow Pipeline
The repository currently implements the complete path from material ingestion through planning, daily execution, revision, and progress.
โโโโโโโโโโโโโโโโโโโโโโโ
โ STUDY SETUP โ
โ โ
โ Exam date โ
โ Hours/day โ
โ Study days โ
โ Weak topics โ
โ Confidence โ
โ Buffer โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ MATERIAL INGESTION โ
โ โ
โ PDF / pasted text โ
โ Page preservation โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ DETERMINISTIC โ
โ CHUNKING โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ GEMMA โ
โ โ
โ Topics โ
โ Subtopics โ
โ Difficulty โ
โ Importance โ
โ Prerequisites โ
โ Evidence โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ VALIDATION โ
โ โ
โ JSON โ Zod โ
โ Evidence matching โ
โ Page derivation โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ KNOWLEDGE MODEL โ
โ โ
โ Subjects โ
โ Topics โ
โ Prerequisites โ
โ Evidence โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ PRIORITY ENGINE โ
โ โ
โ Importance โ
โ Weakness โ
โ Foundation โ
โ Difficulty โ
โ Urgency โ
โ Emphasis โ
โ Evidence โ
โ Revision โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ CAPACITY ENGINE โ
โ โ
โ Available minutes โ
โ Buffer โ
โ Revision reserve โ
โ Exam deadline โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ PLANNER โ
โ โ
โ MUST โ
โ SHOULD โ
โ IF TIME โ
โ DEFER โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ DAILY EXECUTION โ
โ โ
โ Start โ
โ Complete โ
โ Skip โ
โ Progress โ
โโโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโโ
โ REVISION + RECOVERY โ
โ โ
โ +1 / +3 / +7 โ
โ Missed tasks โ
โ Rebalance โ
โ Replan โ
โโโโโโโโโโโโโโโโโโโโโโโ
๐ค Why This Isn't "Chat With Your PDF"
There are thousands of projects that can answer:
โSummarize chapter 4.โ
That wasn't the product I wanted to build.
PrepFlow's model produces structured knowledge, not the final answer the student follows.
The application then transforms that knowledge into an executable workflow.
GENERIC PDF CHAT
PDF โโโโโโโบ LLM โโโโโโโบ Answer
PREPFLOW
PDF
โ
โผ
Extraction
โ
โผ
Chunking
โ
โผ
Gemma
โ
โผ
Structured Topics
โ
โผ
Evidence Verification
โ
โผ
Priority Engine
โ
โผ
Capacity Engine
โ
โผ
Planner
โ
โผ
Daily Tasks
โ
โผ
Progress
โ
โผ
Revision
The difference is subtle but important:
The output isn't text.
The output is a decision system.
๐ Evidence Is First-Class
One of the parts I cared about most was preventing the model from inventing study topics.
If Gemma says:
โDynamic Programming is highly important.โ
PrepFlow doesn't simply trust it.
The model must provide source evidence.
The system then checks that evidence against the extracted source text and derives the PDF page programmatically.
Gemma says:
Topic:
Dynamic Programming
Evidence:
"Dynamic programming solves problems
by combining solutions to overlapping
subproblems."
โ
โผ
SOURCE MATERIAL
โ
โผ
Does this exact evidence
exist in the source?
โโโโโโดโโโโโ
YES NO
โ โ
โผ โผ
ACCEPT REJECT
โ
โผ
derive PDF page
This gives each topic a traceable relationship back to the material.
The repository documents the same architecture: model output is parsed, schema-validated, then evidence-verified before topics are accepted.
๐งฎ How PrepFlow Decides What Matters
Not every topic deserves equal time.
PrepFlow combines multiple bounded factors:
| Factor | What it represents |
|---|---|
| Importance | How important the topic is |
| Weakness | How weak the student is |
| Foundation | Whether other topics depend on it |
| Difficulty | How demanding it is |
| Urgency | How close the exam is |
| Emphasis | Explicit emphasis in the source |
| Evidence | Strength of supporting evidence |
| Revision | Need for later review |
This produces a bounded priority score rather than asking the model to invent one.
TOPIC PRIORITY
Importance โโโโโโโโโ
Weakness โโโโโโโโโโโค
Foundation โโโโโโโโโค
Difficulty โโโโโโโโโค
Urgency โโโโโโโโโโโโค
Emphasis โโโโโโโโโโโผโโโบ PRIORITY SCORE โโโบ PLAN
Evidence โโโโโโโโโโโค
Revision โโโโโโโโโโโ
โฑ๏ธ The Planner Knows When You Don't Have Enough Time
This was one of the most important product decisions.
Suppose the student has:
40.5 hours of estimated work
but only:
24 hours available
A typical AI timetable might confidently distribute everything across the available days.
PrepFlow doesn't.
It tells the truth.
ESTIMATED WORK
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ 40.5h
AVAILABLE TIME
โโโโโโโโโโโโโโโโโโโโโโโโ 24.0h
โโโโโโโโโโโโโโโ
16.5h OVERLOAD
Then it prioritizes the work:
| Tier | Meaning |
|---|---|
| ๐ด MUST | Highest-value work to protect |
| ๐ SHOULD | Important if capacity permits |
| ๐ก IF TIME | Useful but lower priority |
| โช DEFER | Cannot realistically fit |
The planner therefore answers two questions:
- What should I study?
- What should I stop pretending I can finish?
That second question is surprisingly important.
๐งฑ Prerequisites Matter
A study plan shouldn't tell someone to learn:
โAdvanced Dynamic Programmingโ
before:
โDynamic Programming fundamentals.โ
PrepFlow models prerequisite relationships.
Arrays
โ
โผ
Recursion
โ
โผ
Dynamic Programming
โ
โโโโโโโโโโโโโโโโบ Knapsack
โ
โโโโโโโโโโโโโโโโบ Longest Common Subsequence
The planner can therefore account for foundational topics instead of treating every topic as an independent checkbox.
๐ A Plan Is Not Finished When It Is Generated
Real students miss tasks.
That's normal.
So PrepFlow treats planning as a feedback loop:
โโโโโโโโโโโโโโโโ
โ INITIAL PLAN โ
โโโโโโโโฌโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโ
โ TODAY โ
โโโโโโโโฌโโโโโโโโ
โ
โโโโโโโโโโผโโโโโโโโโ
โผ โผ โผ
COMPLETE SKIP MISS
โ โ โ
โโโโโโโโโโดโโโโโโโโโ
โ
โผ
โโโโโโโโโโโโโโโโโโโ
โ RECOVERY / โ
โ REBALANCE โ
โโโโโโโโโโฌโโโโโโโโโ
โ
โผ
NEW PLAN VERSION
Completed work is preserved.
Unfinished work can be recovered or re-planned.
This is much closer to how real studying works than generating one static timetable.
๐ Revision Is Built Into the Plan
Studying a topic once isn't enough.
PrepFlow schedules revision sessions after learning using spaced intervals.
Conceptually:
LEARN
โ
โโโโโ +1 study day โโโโโบ REVISION 1
โ
โโโโโ +3 study days โโโโโบ REVISION 2
โ
โโโโโ +7 study days โโโโโบ REVISION 3
The planner also respects the exam boundary and available study days.
๐๏ธ Architecture
The repository is a TypeScript monorepo containing the React frontend, Express/TypeScript API, and shared schemas/types.
PrepFlow/
โ
โโโ apps/
โ โโโ api/
โ โ โโโ domain/
โ โ โ โโโ planning/
โ โ โ โโโ analysis/
โ โ โ
โ โ โโโ infrastructure/
โ โ โ โโโ prisma/
โ โ โ โโโ PDF extraction
โ โ โ โโโ AI providers
โ โ โ
โ โ โโโ HTTP API
โ โ
โ โโโ web/
โ โโโ React
โ โโโ TypeScript
โ โโโ Vite
โ โโโ Tailwind
โ
โโโ packages/
โ โโโ shared/
โ โโโ Zod schemas + shared types
โ
โโโ docs/
โ โโโ analysis.md
โ โโโ planning.md
โ โโโ decisions/
โ
โโโ PostgreSQL + Prisma
๐ง Why the AI Layer Is Replaceable
I didn't want the entire application to become dependent on one model.
The architecture therefore separates:
APPLICATION
โ
โผ
โโโโโโโโโโโโโโโ
โ AI PROVIDER โ
โ INTERFACE โ
โโโโโโโโฌโโโโโโโ
โ
โโโโโโโโโโโผโโโโโโโโโโ
โผ โผ โผ
Ollama Gemini Fake
+ Gemma + Gemma Provider
The model can change without rewriting the planning engine, database layer, or frontend.
The repository currently exposes ollama, gemini, and fake provider modes.
๐ก๏ธ AI Security and Trust Boundaries
The system treats uploaded study material as untrusted input.
USER MATERIAL
โ
โ untrusted
โผ
โโโโโโโโโโโโโโโโ
โ nonce + โ
โ delimiters โ
โโโโโโโโฌโโโโโโโโ
โผ
GEMMA
โ
โผ
โโโโโโโโโโโโโโโโ
โ tolerant โ
โ JSON parsing โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ Zod schema โ
โ validation โ
โโโโโโโโฌโโโโโโโโ
โผ
โโโโโโโโโโโโโโโโ
โ source โ
โ evidence โ
โ verification โ
โโโโโโโโฌโโโโโโโโ
โผ
ACCEPT
The model receives no application secrets or tools.
Its output is never treated as trusted application state.
The repository also documents bounded retries, analysis concurrency limits, upload limits, CORS controls, and environment-based secrets.
๐งช Testing the Important Parts
I didn't want the project to only work in a happy-path demo.
The current test suite covers multiple layers:
| Layer | What is tested |
|---|---|
| Shared | Schemas and shared logic |
| API | Business logic and routes |
| Web | Frontend behavior |
| HTTP | End-to-end API routing |
| Planning | Priority, capacity, scheduling |
| Randomized invariants | Planner safety properties |
| PostgreSQL | Real persistence |
| Concurrency | Rebalance/version behavior |
| PDF extraction | Real document parsing |
Current validation:
423 automated tests passing
and
20/20 real PostgreSQL integration tests passing
The integration tests include persistence and concurrent plan-rebalancing scenarios.
๐ What the Test Numbers Actually Mean
AUTOMATED TESTS
Shared โโโโโโโโโโโโโโโโโโโโ 22
API โโโโโโโโโโโโโโโโโโโโ 358
Web โโโโโโโโโโโโโโโโโโโโ 43
โโโ
TOTAL 423
Real database integration:
PostgreSQL integration
Passed โโโโโโโโโโโโโโโโโโโโ 20
Failed 0
I also validated the PDF extraction pipeline against a real academic PDF and compared the extracted page structure against the source.
๐งฐ Technology Stack
| Layer | Technology | Why |
|---|---|---|
| Frontend | React + TypeScript | Component-based UI |
| Build | Vite | Fast development/build |
| Styling | Tailwind CSS | Consistent UI system |
| Backend | Node.js + Express | Lightweight API |
| Language | TypeScript | Shared type safety |
| Validation | Zod | Runtime contracts |
| Database | PostgreSQL | Relational persistence |
| ORM | Prisma | Type-safe DB access |
| PDF.js | Page-aware extraction | |
| AI | Gemma | Open-weight material analysis |
| Local AI | Ollama | Local model execution |
| Testing | Vitest | Fast automated testing |
| CI | GitHub Actions | Automated verification |
๐ Why Open Innovation Matters
Study material can be surprisingly sensitive.
It can contain:
- Personal information
- University documents
- Assignments
- Private notes
- Exam preparation
- Proprietary material
That's why I wanted PrepFlow's architecture to support local/open-weight AI, rather than making a cloud LLM the only possible path.
Gemma sits behind an AI-provider abstraction instead of being hardcoded into the application's business logic.
That gives the project a useful property:
The intelligence can evolve without rebuilding the product around a single AI provider.
๐ What PrepFlow Is โ And Isn't
| PrepFlow is | PrepFlow isn't |
|---|---|
| AI-assisted planning | A generic chatbot |
| Evidence-backed analysis | Blind LLM output |
| Deterministic scheduling | LLM-generated timetable |
| Capacity-aware | โEverything fitsโ fantasy |
| Revision-aware | One-time checklist |
| Explainable | Black-box prioritization |
| Open-weight AI compatible | Locked to one provider |
| Built around execution | Just another note summarizer |
๐ก The Engineering Lesson
The biggest thing I learned wasn't how to connect an AI model to a backend.
It was learning where not to use AI.
A tempting architecture would have been:
PDF
โ
โผ
LLM
โ
โผ
"Here is your study plan."
It's easy.
It's also difficult to trust.
PrepFlow instead looks more like:
AI
โ
โผ
UNDERSTAND THE MATERIAL
โ
โผ
STRUCTURED DATA
โ
โผ
โโโโโโโโโโโโโโโโโโโโโโ
โ DETERMINISTIC CODE โ
โ โ
โ Validate โ
โ Prioritize โ
โ Calculate โ
โ Schedule โ
โ Revise โ
โ Recover โ
โโโโโโโโโโโฌโโโโโโโโโโโ
โ
โผ
REAL PLAN
That separation gives me much more confidence in the system.
๐ What's Next
PrepFlow is intentionally an MVP.
The next areas I'd explore are:
| Area | Possible improvement |
|---|---|
| Documents | OCR for scanned PDFs |
| AI | More provider/model evaluation |
| Knowledge | Better prerequisite inference |
| Planning | Calendar-aware scheduling |
| Progress | More sophisticated learning models |
| AI runtime | Additional local/open-weight providers |
| UX | Topic editing and plan refinement |
| Validation | Larger real-student testing |
The current repository roadmap already separates the completed repository/database, ingestion, AI analysis, and planning milestones from later topic-review, polish, deployment, and real-user testing.
๐ Try It
Source Code
github.com/piyusshhjangid/PrepFlow
Local Development
npm install
npm run db:migrate
npm run db:seed
npm run dev:api
npm run dev:web
Then open the web application.
The repository also documents the local Gemma/Ollama and hosted Gemma provider setup.
โค๏ธ Why โBuild for a Friendโ Matters
Building for a friend changes the question.
Instead of:
โWhat AI feature can I add?โ
you start asking:
โWhat is actually making this person's life harder?โ
For PrepFlow, the answer was:
Students don't necessarily need more study material.
They need help turning the material they already have into a realistic sequence of actions.
So that's what I built.
Not another chatbot.
Not another PDF summarizer.
A system that tries to answer one deceptively difficult question:
What should I study next?
Built for the Hacktoberfest Weekend Challenge โ Build for a Friend.
Top comments (0)