templates/template-flash-cards-from-pdf/README.md
A template that generates educational flash cards from PDF documents. Attach a PDF in Mastra Studio, and the agent creates flash cards with optional AI-generated images. Built with Mastra.
This template shows how you can generate images with an agent, and how to build a tool that parses PDFs.
<video controls width="640" height="360" src="https://res.cloudinary.com/mastra-assets/video/upload/v1772538182/template-flash-cards-pdf_xok53r.mp4"></video>
This demo runs in Mastra Studio, but you can connect this workflow to your React, Next.js, or Vue app using the Mastra Client SDK or agentic UI libraries like AI SDK UI, CopilotKit, or Assistant UI.
npx create-mastra@latest --template flash-cards-from-pdf to scaffold the project locally..env.example to .env and fill in your keys.npm run dev and open localhost:4111 to try it out.Select the Flash Card Agent and attach a PDF file using the attachment button in the chat. You can use the assets/example.pdf file included in the repo for testing. Ask the agent: "Create flash cards from this PDF". Optionally, afterwards ask for images: "Generate flash cards with images for the key concepts".
Swap in a different image generation provider, add your instructions, or wire the agent into your app using the Mastra Client SDK. The agent is in src/mastra/agents — edit it directly to fit your use case.
Mastra templates are ready-to-use projects that show off what you can build — clone one, poke around, and make it yours. They live in the Mastra monorepo and are automatically synced to standalone repositories for easier cloning.
Want to contribute? See CONTRIBUTING.md.