Inspiration

Every time I wanted to learn something new — a programming language for a weekend project, music theory before a trip, the basics of investing — I hit the same wall. Courses are built for a fixed pace and a fixed syllabus, not for my topic and my timeline. I'd spend more time assembling a study plan than actually studying.

So I asked a simple question: what if an AI could generate a complete, structured curriculum for literally any topic, scaled to exactly how much time I have — five minutes or three months? That question became AnyLearn.

What it does

AnyLearn turns any topic into a personalized learning path:

  • AI-generated curriculum — Gemini 2.5 Flash builds a full plan tailored to your topic, goal type, and available time.
  • Structured sessions — Material is broken into progressive sessions (Foundations → Core Concepts → Applied Skills → Advanced Topics → Mastery Review) that unlock as you advance.
  • Three learning modes per session:
    • A multi-section study guide with key takeaways
    • Smart flashcards with 3D flip animations and per-card mastery tracking
    • An adaptive 5-question quiz, freshly generated every time — never the same quiz twice
  • Progress analytics — streaks, quiz scores, and learning velocity across every topic.

How we built it

The app is a Next.js 16 (App Router) + React 19 + TypeScript application styled with Tailwind CSS v4 and animated with Framer Motion.

  • AI layer — All educational content is generated through the Vercel AI SDK using generateObject, with Gemini 2.5 Flash as the model. Every output is constrained by a Zod schema, so quizzes, flashcards, and study guides always come back as valid, strongly-typed JSON rather than free-form text.
  • AuthFirebase Authentication handles sign-up and login, with a session cookie bridging the client to server-side API routes.
  • Database — User profiles, learning sessions, and quiz results are persisted in Amazon Aurora DSQL (Postgres) accessed via the pg pool. Connections are authenticated with short-lived IAM tokens from @aws-sdk/dsql-signer, using Vercel OIDC (awsCredentialsProvider) so there are no long-lived AWS keys.
  • API routes handle AI generation, auth/session/onboarding, session CRUD, and quiz result storage.
  • Deployed on Vercel.

Schema-constrained generation is the core idea. For example, every quiz must satisfy:

$$\text{questions} = 5, \quad \text{options per question} = 4, \quad 0 \le \text{correct} \le 3$$

which guarantees the UI never has to defend against malformed AI output.

Challenges we ran into

  • Reliable structured output — Early free-text prompts produced inconsistent shapes. Moving to generateObject with strict Zod schemas (exact counts, bounded indices) made AI responses safe to render directly.
  • Keyless cloud auth — Wiring Aurora DSQL's IAM token signing to Vercel's OIDC provider so the serverless functions authenticate without storing AWS secrets took careful configuration.
  • Connection management on serverless — Using a pooled pg client with attachDatabasePool to keep DSQL connections healthy across function invocations.
  • Tuning prompts per session — Getting content difficulty to scale appropriately with both the session number and the chosen timeframe.

What we learned

  • Pairing an LLM with a schema validator turns "creative but unpredictable" generation into a dependable backend primitive.
  • OIDC-based, keyless access to cloud databases is a real, practical security upgrade over static credentials.
  • Good structure around an AI — sessions, gating, analytics — matters as much as the model itself for an actual learning experience.

What's next for AnyLearn

  • Spaced-repetition scheduling for flashcards
  • Multi-modal content (diagrams, generated illustrations)
  • Shareable learning paths and collaborative study
  • Voice-based quiz mode

Built With

Share this project:

Updates