Interactive Request Flow Diagram with Quiz System - Planning
Interactive Request Flow Diagram with Quiz System - Planning
Related: Complete Request Lifecycle - From Browser to Database and Back, Canvas Management Planning, SWC Actions Planning
The Vision
You said: "I'd like to add a recreation/renaming party kind of interface where I can provide context on what the thing is, and this could somehow be attached to some sort of situation where I can quiz students on it."
Goal: Create an interactive web component that:
- Shows the request lifecycle visually (like an excalidraw diagram)
- Allows clicking on each step to see explanations
- Can be turned into Canvas quizzes automatically
- Students can test their knowledge of the flow
- Deployed on midimaze.com for educational use
Use Cases
Educational Scenarios
-
Computer Science 101 - Web Request Flow
- Student clicks through DNS β Cloudflare β nginx β Bun β Convex
- Each step explains what happens
- Quiz: "What server receives the request first?"
-
Network Engineering - OSI Model
- Interactive diagram showing all 7 layers
- Click each layer for real-world examples
- Quiz: Match protocols to layers
-
Recording Arts - Signal Flow
- Microphone β Preamp β Converter β DAW β Monitors
- Click each stage for technical details
- Quiz: Troubleshoot signal chain problems
-
Audio Production - Mixing Workflow
- Track β EQ β Compression β Effects β Bus β Master
- Interactive signal path diagram
- Quiz: What comes first, EQ or compression?
Architecture Overview
Component Stack
βββββββββββββββββββββββββββββββββββββββββββ
β Interactive Flow Diagram (React) β
β - Visual representation β
β - Clickable nodes β
β - Contextual tooltips β
β - Progress tracking β
βββββββββββββββ¬ββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β Quiz Engine (React) β
β - Multiple choice questions β
β - Drag-and-drop ordering β
β - Fill-in-the-blank β
β - Score tracking β
βββββββββββββββ¬ββββββββββββββββββββββββββββ
β
βββββββββββββββββββββββββββββββββββββββββββ
β Canvas API Integration (Bun backend) β
β - Create quiz via API β
β - Import questions β
β - Publish to course β
βββββββββββββββββββββββββββββββββββββββββββ
Data Flow
Professor creates diagram + quiz:
β
Store in Convex (questions, flow data)
β
Students interact on midimaze.com
β
(Optional) Export to Canvas quiz
β
Students take quiz in Canvas LMS
β
Scores sync back to gradebook
Component 1: Interactive Flow Diagram
React Component Structure
tsx// src/components/InteractiveFlowDiagram.tsx interface FlowNode { id: string; label: string; description: string; position: { x: number; y: number }; type: 'server' | 'service' | 'user' | 'database'; icon?: string; timing?: string; // e.g., "10-50ms" details?: string; // Long-form explanation } interface FlowConnection { from: string; to: string; label?: string; conditional?: boolean; // e.g., "if cached" vs "if not cached" } interface FlowDiagramProps { title: string; nodes: FlowNode[]; connections: FlowConnection[]; quizMode?: boolean; // Enable quiz features } export default function InteractiveFlowDiagram({ title, nodes, connections, quizMode = false }: FlowDiagramProps) { const [selectedNode, setSelectedNode] = useState<string | null>(null); const [visitedNodes, setVisitedNodes] = useState<Set<string>>(new Set()); const handleNodeClick = (nodeId: string) => { setSelectedNode(nodeId); setVisitedNodes(prev => new Set([...prev, nodeId])); }; return ( <div className="flow-diagram"> <h2>{title}</h2> {/* SVG Canvas */} <svg viewBox="0 0 800 600"> {/* Connections (arrows) */} {connections.map(conn => ( <ConnectionArrow key={`${conn.from}-${conn.to}`} {...conn} /> ))} {/* Nodes (clickable boxes) */} {nodes.map(node => ( <FlowNode key={node.id} {...node} selected={selectedNode === node.id} visited={visitedNodes.has(node.id)} onClick={() => handleNodeClick(node.id)} /> ))} </svg> {/* Detail Panel */} {selectedNode && ( <NodeDetailPanel node={nodes.find(n => n.id === selectedNode)!} onClose={() => setSelectedNode(null)} /> )} {/* Progress Tracker (quiz mode) */} {quizMode && ( <ProgressTracker total={nodes.length} visited={visitedNodes.size} /> )} </div> ); }
Example Flow Data (HTTP Request)
typescript// data/http-request-flow.ts export const httpRequestFlow: FlowDiagramData = { title: "Complete HTTP Request Lifecycle", nodes: [ { id: "browser", label: "Student Browser", description: "User types midimaze.com", position: { x: 100, y: 50 }, type: "user", icon: "π", details: ` The request starts when a student types a URL or clicks a link. The browser first checks if it has a cached IP address for the domain. ` }, { id: "dns", label: "DNS Server", description: "Resolves domain to IP", position: { x: 100, y: 150 }, type: "service", icon: "π‘", timing: "0-50ms", details: ` DNS (Domain Name System) translates human-readable domains like "midimaze.com" into IP addresses like "104.26.2.123". This is a distributed system with multiple layers: - Local cache - ISP resolver - Root nameservers - Authoritative nameservers (Cloudflare in your case) ` }, { id: "cloudflare", label: "Cloudflare Edge", description: "CDN cache check", position: { x: 300, y: 150 }, type: "service", icon: "βοΈ", timing: "1-5ms", details: ` Cloudflare's edge network has 300+ data centers worldwide. Students connect to the nearest edge server for faster response. Cloudflare checks if the requested content is cached: - If cached (80-90% of requests): Return immediately - If not cached: Fetch from origin server (your VPS) ` }, { id: "nginx", label: "nginx", description: "Web server & router", position: { x: 500, y: 150 }, type: "server", icon: "π", timing: "1-3ms", details: ` nginx is the first process on YOUR VPS to handle the request. It makes a routing decision based on the URL path: - Static files (/songs/, /images/) β Serve directly - API requests (/api/*) β Forward to Bun - Webhooks (/webhooks/*) β Forward to Bun ` }, { id: "bun", label: "Bun", description: "Application logic", position: { x: 500, y: 300 }, type: "server", icon: "π₯", timing: "10-50ms", details: ` Bun handles dynamic requests that require application logic. It only receives requests that nginx forwards to it: - Search API - GitHub webhooks - Any custom API endpoints Static files never reach Bun - nginx handles them directly. ` }, { id: "convex", label: "Convex", description: "Database & vector search", position: { x: 700, y: 300 }, type: "database", icon: "ποΈ", timing: "5-30ms", details: ` Convex is your cloud database with vector search capabilities. Bun calls Convex when it needs to: - Query article embeddings - Perform vector similarity search - Store or retrieve data Convex runs on external infrastructure (not your VPS). ` } ], connections: [ { from: "browser", to: "dns", label: "DNS lookup" }, { from: "dns", to: "cloudflare", label: "Returns Cloudflare IP" }, { from: "browser", to: "cloudflare", label: "HTTP request" }, { from: "cloudflare", to: "nginx", label: "If not cached", conditional: true }, { from: "nginx", to: "bun", label: "/api/* or /webhooks/*", conditional: true }, { from: "bun", to: "convex", label: "Database query", conditional: true } ] };
Component 2: Quiz System
Quiz Question Types
typescript// types/quiz.ts type QuestionType = | 'multiple_choice' | 'true_false' | 'fill_in_blank' | 'ordering' | 'matching' | 'drag_drop'; interface QuizQuestion { id: string; type: QuestionType; text: string; points: number; relatedNodeId?: string; // Link to flow diagram node // Type-specific fields options?: string[]; // For multiple choice correctAnswer?: string | number | string[]; explanation?: string; // Shown after answering } interface Quiz { id: string; title: string; flowDiagramId: string; // Reference to diagram questions: QuizQuestion[]; passingScore: number; timeLimit?: number; // minutes canvasQuizId?: string; // If exported to Canvas }
Example Quiz for HTTP Request Flow
typescript// data/http-request-quiz.ts export const httpRequestQuiz: Quiz = { id: "http-request-lifecycle", title: "HTTP Request Lifecycle Quiz", flowDiagramId: "http-request-flow", questions: [ { id: "q1", type: "multiple_choice", text: "When a student types 'midimaze.com', what is the FIRST external service that receives a request?", points: 1, relatedNodeId: "dns", options: [ "nginx on your VPS", "DNS server", "Cloudflare edge network", "Bun application server" ], correctAnswer: 1, // DNS server explanation: ` Before the browser can connect to any server, it must first resolve the domain name to an IP address. This is done by DNS servers. Only after getting the IP can the browser connect to Cloudflare's edge network. ` }, { id: "q2", type: "true_false", text: "Most student requests (80-90%) are served directly from Cloudflare's cache and never reach your VPS.", points: 1, relatedNodeId: "cloudflare", correctAnswer: true, explanation: ` TRUE! Cloudflare caches static content at edge locations worldwide. Most requests for HTML, CSS, images, etc. are served from cache, dramatically reducing load on your VPS. ` }, { id: "q3", type: "ordering", text: "Arrange these servers in the order they process a CACHED static file request:", points: 2, options: [ "DNS Server", "Browser", "Cloudflare Edge", "nginx", "Bun" ], correctAnswer: ["Browser", "DNS Server", "Cloudflare Edge"], explanation: ` For a cached request: 1. Browser initiates request 2. DNS resolves domain (may be cached) 3. Cloudflare edge serves from cache nginx and Bun are NEVER involved for cached requests! ` }, { id: "q4", type: "multiple_choice", text: "Which type of request does nginx forward to Bun?", points: 1, relatedNodeId: "nginx", options: [ "Static HTML files like /songs/giant-steps", "CSS and JavaScript files", "API requests like /api/search", "Image files like /images/photo.jpg" ], correctAnswer: 2, // API requests explanation: ` nginx only forwards /api/* and /webhooks/* to Bun. All static files (HTML, CSS, JS, images) are served directly by nginx without touching Bun. ` }, { id: "q5", type: "fill_in_blank", text: "nginx uses the _____ syscall to efficiently transfer files from disk to network without copying to userspace.", points: 1, relatedNodeId: "nginx", correctAnswer: "sendfile", explanation: ` The sendfile() syscall allows the Linux kernel to transfer files directly from disk to network socket without copying data through the application's memory space. This is why nginx is so efficient at serving static files. ` }, { id: "q6", type: "matching", text: "Match each server to its primary role:", points: 3, options: { servers: ["nginx", "Bun", "Convex", "Cloudflare"], roles: [ "Global CDN and caching", "Static file serving and routing", "Application logic and API endpoints", "Database with vector search" ] }, correctAnswer: { "nginx": "Static file serving and routing", "Bun": "Application logic and API endpoints", "Convex": "Database with vector search", "Cloudflare": "Global CDN and caching" } }, { id: "q7", type: "multiple_choice", text: "A student searches for 'jazz harmony'. The browser generates a vector embedding CLIENT-SIDE. What happens next?", points: 2, options: [ "Browser sends query text to Bun for embedding", "Browser sends vector directly to Convex", "Browser sends vector to nginx, which forwards to Bun", "Browser sends vector to Cloudflare for caching" ], correctAnswer: 2, explanation: ` Client-side search workflow: 1. Browser generates vector (locally) 2. Browser POSTs vector to /api/search 3. nginx receives request, forwards to Bun (port 3000) 4. Bun queries Convex with vector 5. Results return through same path The vector never goes to Cloudflare cache (API responses aren't cached) and never directly to Convex (only Bun has Convex API credentials). ` } ], passingScore: 70, timeLimit: 15 };
Component 3: Canvas API Integration
Canvas Quiz Creation Workflow
Reference: See _Nakul/3. SWC Actions/1. Daily and Weekly/_attachments/Quiz Creation HTTP Requests.excalidraw.md
typescript// api/canvas-quiz-export.ts interface CanvasQuizExportOptions { courseId: string; quizData: Quiz; publishImmediately?: boolean; dueDate?: Date; assignmentGroupId?: string; } async function exportQuizToCanvas(options: CanvasQuizExportOptions) { const { courseId, quizData, publishImmediately = false, dueDate, assignmentGroupId } = options; // Step 1: Create quiz shell const quizResponse = await fetch( `${CANVAS_API_URL}/courses/${courseId}/quizzes`, { method: 'POST', headers: { 'Authorization': `Bearer ${CANVAS_API_TOKEN}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ quiz: { title: quizData.title, description: `Interactive quiz based on ${quizData.flowDiagramId}`, quiz_type: 'assignment', points_possible: calculateTotalPoints(quizData.questions), time_limit: quizData.timeLimit, scoring_policy: 'keep_highest', published: publishImmediately, due_at: dueDate?.toISOString(), assignment_group_id: assignmentGroupId } }) } ); const { id: canvasQuizId } = await quizResponse.json(); // Step 2: Create questions for (const question of quizData.questions) { await createCanvasQuestion(courseId, canvasQuizId, question); } // Step 3: Publish if requested if (publishImmediately) { await publishCanvasQuiz(courseId, canvasQuizId); } return canvasQuizId; } async function createCanvasQuestion( courseId: string, quizId: string, question: QuizQuestion ) { const canvasQuestionData = convertToCanvasFormat(question); await fetch( `${CANVAS_API_URL}/courses/${courseId}/quizzes/${quizId}/questions`, { method: 'POST', headers: { 'Authorization': `Bearer ${CANVAS_API_TOKEN}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ question: canvasQuestionData }) } ); } function convertToCanvasFormat(question: QuizQuestion): CanvasQuestion { switch (question.type) { case 'multiple_choice': return { question_name: `Q${question.id}`, question_text: question.text, question_type: 'multiple_choice_question', points_possible: question.points, answers: question.options!.map((opt, idx) => ({ answer_text: opt, answer_weight: idx === question.correctAnswer ? 100 : 0 })), correct_comments: question.explanation || '' }; case 'true_false': return { question_name: `Q${question.id}`, question_text: question.text, question_type: 'true_false_question', points_possible: question.points, answers: [ { answer_text: 'True', answer_weight: question.correctAnswer === true ? 100 : 0 }, { answer_text: 'False', answer_weight: question.correctAnswer === false ? 100 : 0 } ], correct_comments: question.explanation || '' }; case 'fill_in_blank': return { question_name: `Q${question.id}`, question_text: question.text, question_type: 'short_answer_question', points_possible: question.points, answers: [ { answer_text: question.correctAnswer as string, answer_weight: 100 } ] }; // Add more question types... default: throw new Error(`Unsupported question type: ${question.type}`); } }
Implementation Plan
Phase 1: Core Components (Week 1-2)
Tasks:
- Create
InteractiveFlowDiagramReact component - Implement SVG rendering for nodes and connections
- Add click interactions and detail panels
- Style with Tailwind/CSS for professional look
- Test with HTTP request flow data
Deliverable: Working interactive diagram on midimaze.com
Phase 2: Quiz System (Week 3-4)
Tasks:
- Create
QuizEngineReact component - Implement multiple choice, true/false, ordering questions
- Add score tracking and feedback
- Link quiz questions to diagram nodes
- Create quiz data for HTTP request lifecycle
Deliverable: Complete quiz system with sample quiz
Phase 3: Canvas Integration (Week 5-6)
Tasks:
- Create Bun API endpoint for Canvas export
- Implement Canvas API authentication
- Convert quiz data to Canvas format
- Test quiz creation in Canvas sandbox
- Add UI for "Export to Canvas" button
Deliverable: Working Canvas quiz export functionality
Phase 4: Additional Diagrams (Week 7-8)
Tasks:
- Create diagrams for other topics:
- OSI Model
- Audio signal flow
- Mixing workflow
- React component lifecycle
- Write quizzes for each diagram
- Deploy all to midimaze.com
- Create professor admin panel for managing quizzes
Deliverable: Library of interactive educational diagrams
Technology Stack
Frontend
- React - Component framework
- TypeScript - Type safety
- Tailwind CSS - Styling
- Framer Motion - Animations
- React Flow (optional) - Pre-built diagram library
Backend
- Bun - API server (already running)
- Convex - Store quiz data and user progress
- Canvas API - LMS integration
Deployment
- Astro - Static site generator (already using)
- nginx - Serves static files (already configured)
- Hostinger VPS - Hosting (already have)
Data Models (Convex)
typescript// convex/schema.ts import { defineSchema, defineTable } from "convex/server"; import { v } from "convex/values"; export default defineSchema({ flowDiagrams: defineTable({ id: v.string(), title: v.string(), description: v.string(), category: v.string(), // "networking", "audio", "web-dev", etc. nodes: v.array(v.object({ id: v.string(), label: v.string(), description: v.string(), position: v.object({ x: v.number(), y: v.number() }), type: v.string(), icon: v.optional(v.string()), timing: v.optional(v.string()), details: v.string() })), connections: v.array(v.object({ from: v.string(), to: v.string(), label: v.optional(v.string()), conditional: v.optional(v.boolean()) })), createdAt: v.number(), updatedAt: v.number(), publishedToMidimaze: v.boolean(), publishedToCanvas: v.optional(v.string()) // Canvas quiz ID }), quizzes: defineTable({ id: v.string(), title: v.string(), flowDiagramId: v.string(), questions: v.array(v.any()), // QuizQuestion type passingScore: v.number(), timeLimit: v.optional(v.number()), canvasQuizId: v.optional(v.string()), courseId: v.optional(v.string()), createdAt: v.number(), updatedAt: v.number() }), studentProgress: defineTable({ studentEmail: v.string(), quizId: v.string(), flowDiagramId: v.string(), visitedNodes: v.array(v.string()), score: v.optional(v.number()), attempts: v.number(), completedAt: v.optional(v.number()) }) .index("by_student", ["studentEmail"]) .index("by_quiz", ["quizId"]) });
Student Experience Flow
1. Browse Diagrams
Student visits: midimaze.com/learn/diagrams
β
Sees grid of available topics:
- HTTP Request Lifecycle
- OSI Network Model
- Audio Signal Flow
- etc.
β
Clicks "HTTP Request Lifecycle"
2. Explore Diagram
Interactive diagram loads
β
Student clicks "DNS Server" node
β
Detail panel appears with explanation
β
Student reads, closes panel
β
Clicks next node...
β
Progress bar shows "5/6 nodes visited"
3. Take Quiz
"Ready to test your knowledge?" button appears
β
Student clicks "Start Quiz"
β
Quiz interface loads
β
Student answers questions
β
Immediate feedback after each question
β
Final score: "6/7 correct - 86%"
β
"Review incorrect answers" option
4. Canvas Integration (Optional)
Professor creates quiz on midimaze.com
β
Clicks "Export to Canvas"
β
Selects course: "RA&T 120 - Spring 2025"
β
Quiz automatically created in Canvas
β
Students take quiz in Canvas for grade
β
Scores sync to Canvas gradebook
Professor Admin Interface
Quiz Creation Workflow
Professor Dashboard: midimaze.com/admin/quizzes
β
"Create New Quiz" button
β
Form:
- Select diagram: [HTTP Request Lifecycle]
- Quiz title: [...]
- Questions:
+ Add Multiple Choice
+ Add True/False
+ Add Ordering
β
Preview quiz (as student would see it)
β
Save to Convex
β
Options:
- Publish to midimaze.com (public)
- Export to Canvas course (requires auth)
Next Steps
Immediate Actions (This Week)
- Create new directory:
_Nakul/5. Coding Actions/Interactive Quiz System/ - Design first diagram in Excalidraw (use HTTP request flow)
- Prototype basic React component for diagram display
- Research React Flow library vs custom SVG solution
Short Term (Next 2 Weeks)
- Build InteractiveFlowDiagram component
- Create sample quiz data structure
- Deploy to midimaze.com for testing
- Get feedback from colleague or student
Medium Term (Next Month)
- Implement full quiz system
- Test Canvas API integration in sandbox
- Create 3-5 diagrams with quizzes
- Beta test with one RA&T class
Long Term (This Semester)
- Deploy to all RA&T courses
- Create library of 20+ interactive diagrams
- Gather analytics on student engagement
- Consider expanding to other departments
Related Projects
Similar Tools/Inspiration
- Excalidraw - Diagram creation (you're already using)
- Mermaid.js - Diagram generation from code
- Cytoscape.js - Graph visualization library
- React Flow - Pre-built React diagram library
- H5P - Interactive content for LMS
Your Existing Work
- Quiz Creation HTTP Requests - Excalidraw diagram in SWC Actions
- Canvas Management Planning - Canvas API workflows
- Complete Request Lifecycle - Documentation to visualize
Budget & Resources
Software Costs
- Development time: ~40-80 hours
- Convex (already have)
- Canvas API (already have access)
- Hosting (already covered by Hostinger VPS)
Total additional cost: $0
Time Investment
- Phase 1 (Core): 10-15 hours
- Phase 2 (Quiz): 10-15 hours
- Phase 3 (Canvas): 10-15 hours
- Phase 4 (Content): 10-20 hours per diagram
Total: 40-65 hours for initial system + 3-5 diagrams
Success Metrics
Quantitative
- 50+ students use interactive diagrams
- 80% quiz completion rate
- Average score improvement on second attempt
- 10+ topics with diagrams and quizzes
Qualitative
- Positive student feedback
- Easier quiz creation vs manual Canvas
- More engaging than static documentation
- Usable by other faculty
Questions to Resolve
Technical
- Use React Flow library or build custom SVG?
- Store quiz data in Convex or separate JSON files?
- Client-side only or need Bun API for quizzes?
- How to handle Canvas authentication securely?
Design
- Mobile-friendly diagram interactions?
- Accessibility for screen readers?
- Print-friendly version?
- Dark mode support?
Pedagogical
- What topics are highest priority?
- Quiz difficulty level?
- Allow multiple attempts?
- Show correct answers immediately or after submission?
Notes
Date: 2025-11-10
This planning document outlines an ambitious but achievable project to create interactive learning tools for your students. The combination of visual exploration + knowledge testing is pedagogically sound and addresses multiple learning styles.
Key advantages:
- Builds on your existing infrastructure (nginx, Bun, Convex, Canvas)
- Reusable system (create many diagrams from same components)
- Benefits students (engaging, interactive) and professors (easy quiz creation)
- Canvas integration means it works within existing LMS workflow
Biggest challenge: Time investment to create high-quality content. Start with 1-2 excellent examples, then expand based on student response.
Related Documents
- Complete Request Lifecycle - From Browser to Database and Back - Content to visualize
- Web Server Architecture - nginx Cloudflare Bun GitHub Webhooks - Technical foundation
- Canvas Management Planning - Canvas API integration
- SWC Actions Planning - Course management workflows