Project Info
Inspiration
We built LearnActively because most learning tools make it too easy to stay passive. A chatbot can explain something, but that does not mean you remember it. We wanted a tool that pushes people to think, practice, retrieve, and correct mistakes while they learn.
What it does
LearnActively turns any topic into a structured learning workspace. It creates an intro, cheatsheet, concept roadmap, visual explanations, activities, flashcards, and quizzes. Instead of just giving an answer, it guides the learner through the topic and checks understanding along the way.
How we built it
We built it with Next.js, React, TypeScript, Tailwind, and API routes. The AI layer uses separate agents for planning, explanations, activities, flashcards, quizzes, and feedback. We use Zod for structured outputs, Drizzle with Supabase Postgres for storage, ReactFlow for roadmaps, and Mermaid for diagrams.
Challenges we ran into
The hardest part was making the experience feel active instead of like a normal chatbot. We also had to coordinate many generated artifacts, stream them into the UI, and keep the data structured enough to render reliably. Balancing speed, quality, and useful practice was a big challenge.
Accomplishments we're proud of
We are proud that LearnActively feels like a real learning session, not just a wall of text. The roadmap, flashcards, activities, and quiz all work together. We are also proud of the agent-based architecture because it makes the product easier to extend.
What we learned
We learned that good AI learning tools need more than explanations. They need structure, feedback, and moments where the learner has to do the work. We also learned how important schemas are when turning AI output into a stable interactive product.
What's next
Next, we want to connect the agents to stronger live model generation, improve personalization, and add spaced repetition. We also want better progress tracking, richer diagrams, file uploads, and deeper feedback so LearnActively can become a long-term learning companion.
LearnActively
LearnActively is an AI-powered active-learning workspace built for the OpenAI hackathon. It turns any topic into a structured learning session with an introduction, visual overview, cheatsheet, concept roadmap, node-by-node explanations, practice activities, flashcards, and a quiz.
The goal is not to make learning passive. LearnActively uses OpenAI to generate material that makes learners retrieve, apply, and correct their understanding.
Demo Flow
Youtube Demo Video Here: https://youtu.be/zzGtWu65A1Q?si=VA5p5B1owcQPD4Vq
- Enter a topic such as
SQL joins,how transformers work, orphotosynthesis. - Choose a learning depth: beginner, intermediate, or advanced.
- The app creates a learning session and streams generated artifacts into the workspace.
- Read the intro and cheatsheet while deeper artifacts continue generating.
- Explore the concept roadmap, open each subtopic, complete activities, review flashcards, and take the quiz.
How This Project Uses OpenAI
OpenAI is the core generation layer for the product. The app uses the Vercel AI SDK with @ai-sdk/openai to call OpenAI models from the server.
1. Multi-Agent Learning Orchestration
The backend runs a learning orchestrator in lib/ai/orchestrator.ts. For each user topic, it coordinates specialized AI agents:
plannerAgentcreates a structured learning plan.introductionAgentgenerates the first explanation.visualExplainerAgentcreates an overview visual artifact.cheatsheetAgentproduces a compact reference guide.conceptTreeAgentbuilds the prerequisite roadmap.nodeExplanationAgentexplains each roadmap node.activityAgentcreates active-learning exercises.flashcardAgentcreates retrieval-practice cards.quizAgentcreates an assessment aligned to the roadmap.
Each agent is prompted to produce a specific learning artifact instead of a generic chat response.
2. Structured Outputs With Zod Validation
OpenAI responses are generated through generateObject from the AI SDK in lib/ai/generate.ts. Each artifact has a matching Zod schema in lib/ai/schemas.
This lets the app render AI output as real UI:
- ReactFlow roadmap nodes and edges
- Mermaid diagrams
- Quiz questions
- Flashcards
- Activity prompts
- Cheatsheet sections
- Stream events
The generated content is validated before being stored or displayed, which makes the product more reliable for a live demo.
3. Model Tiers
The app supports separate model settings for different generation jobs:
OPENAI_MODEL_FAST=gpt-4.1-mini
OPENAI_MODEL_REASONING=gpt-5
OPENAI_MODEL_STRUCTURED=gpt-4.1
Defaults are defined in lib/utils/env.ts. The planner and chatbot use the fast tier, while structured learning artifacts use the structured tier.
4. OpenAI-Powered Chat Support
The app also includes a support assistant in lib/ai/chatbot.ts, exposed through POST /api/chat. It uses OpenAI text generation to help users understand and navigate the LearnActively experience.
5. Search-Aware Generation
For current or fast-changing topics, the planner can decide to use Tavily search. Source notes are passed into OpenAI prompts so generated explanations can account for recent information instead of relying only on model knowledge.
For stable topics, the app skips web search and generates directly from the OpenAI model.
6. Resilient Fallbacks
If OPENAI_API_KEY is missing or a model call fails, the generation wrapper returns deterministic fallback artifacts. This keeps the demo usable locally while preserving the full OpenAI-powered path when credentials are configured.
Product Features
- Topic-to-session generation
- Beginner, intermediate, and advanced learning depths
- Streaming artifact updates with Server-Sent Events
- Interactive concept roadmap using ReactFlow
- Visual explanations with Mermaid and SVG overview artifacts
- Practice activities for each subtopic
- Flashcards for retrieval practice
- Quiz with feedback and weak-area recommendations
- Supabase/Postgres persistence through Drizzle ORM
- In-memory development fallback when
DATABASE_URLis not configured
Tech Stack
- Next.js 15
- React 19
- TypeScript
- Tailwind CSS
- Vercel AI SDK
- OpenAI via
@ai-sdk/openai - Zod
- Drizzle ORM
- Supabase Postgres
- ReactFlow
- Mermaid
- KaTeX
- Framer Motion
- Vitest
- Playwright
Architecture
User topic
-> POST /api/learn
-> learning session is created
-> GET /api/learn/:sessionId/stream
-> runLearningOrchestrator()
-> OpenAI-powered agents generate structured artifacts
-> artifacts are validated with Zod
-> artifacts are persisted with Drizzle
-> Server-Sent Events stream updates to the UI
-> learner interacts with roadmap, activities, flashcards, and quiz
Key Files
lib/ai/generate.ts- OpenAI model wrapper for structured objects and text.lib/ai/orchestrator.ts- Coordinates the full learning generation workflow.lib/ai/agents/*- Specialized artifact-generation agents.lib/ai/schemas/*- Zod schemas for AI-generated outputs.app/api/learn/[sessionId]/stream/route.ts- SSE endpoint for streaming generation progress.app/api/chat/route.ts- OpenAI-powered support chat endpoint.components/workspace/workspace-tabs.tsx- Main artifact workspace UI.components/roadmap/concept-tree.tsx- Interactive learning roadmap.db/schema.ts- Drizzle database schema.
Environment Variables
Create a .env.local file:
OPENAI_API_KEY=your_openai_api_key
DATABASE_URL=your_supabase_postgres_connection_string
TAVILY_API_KEY=your_tavily_key
NEXT_PUBLIC_APP_NAME=LearnActively
NEXT_PUBLIC_APP_URL=http://localhost:3000
OPENAI_MODEL_FAST=gpt-4.1-mini
OPENAI_MODEL_REASONING=gpt-5
OPENAI_MODEL_STRUCTURED=gpt-4.1
OPENAI_API_KEY is required for the full OpenAI-powered experience. DATABASE_URL and TAVILY_API_KEY are optional for local demo usage because the app includes development fallbacks.
Run Locally
npm install
npm run dev
Open:
http://localhost:3000
Verification
npm run test
npm run build
Why It Matters
Most AI learning tools answer the question and stop. LearnActively uses OpenAI to transform a topic into a complete active-learning path: plan, explain, visualize, practice, retrieve, assess, and review weak areas.
The OpenAI integration is not just a chatbot layer. It is the generation engine for a structured educational workspace.
Analysis
View
Metric
- 7
- 2
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- CSSIn code
- JavaScriptIn code
- Next.jsIn code
- OpenAIIn code
- ReactIn code
- SQLIn code
- SupabaseIn code
- Tailwind CSSIn code
- TypeScriptIn code
- Vercel AI SDKIn code
- Node.jsClaimed
- PostgreSQLClaimed
- VercelClaimed
10 of 13 appear in the indexed code. 3 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
286 KB
Source files
89
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
sonyalow-smu611/LearnActively
98 files · 677 KB · @ d4dc957
Structure
Interface
25 files · 26%Screens, components and styles rendered to the user.
+4 moreAPI & routing
8 files · 8%Request entry points: routes, handlers and controllers.
Application logic
26 files · 27%Domain rules, services and shared utilities.
Data & schema
19 files · 19%Schema definitions, migrations and data access.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- TypeScript77%
- Markdown21%
- SQL1%
- CSS0%
- JavaScript0%
Share of indexed source by file size. Binary and vendored files are excluded.
Dependencies
package.json
npm · 33- @ai-sdk/openai
- @supabase/ssr
- @supabase/supabase-js
- @xyflow/react
- ai
- class-variance-authority
- clsx
- drizzle-orm
- framer-motion
- html2canvas
- jspdf
- katex
- lucide-react
- mermaid
- motion
- next
- postgres
- react
- +15 more
Declared in the repository’s manifests at the indexed commit. A declared package is not proof it is used, and runtime dependencies are listed first.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.