📖 The Great Big Quiz Of Everything - Backend Guide
A comprehensive workflow system that generates professional multiple-choice quizzes with optional audio narration based on any topic. This solution uses AI to research topics, create relevant questions, and deliver results in a structured JSON format ready for integration with The Great Big Quiz of Everything front-end in FlutterFlow.
- Download on FlutterFlow Marketplace: https://marketplace.flutterflow.io/item/y1ZvSwCvEWBnRtZ4a60j
- Supabase Schema: https://drive.google.com/drive/folders/1uezPUocRnFKTyz88By8pCc1KSooMOnww?usp=sharing
Tutorial Part 1 (FlutterFlow & Supabase Setup & Authentication)
VIDEO
Tutorial Part 2 (BuildShip Setup)
VIDEO
Tutorial Part 3 (Integrating an AI Quiz Host with Elevenlabs)
VIDEO
Tutorial Part 4 (Deployment)
VIDEO
Overview
This repository contains two complementary BuildShip workflows that power a complete quiz generation system:
Main Quiz Workflow - Generates quizzes with optional audio narration
Topic Suggestion Workflow - Provides related topic recommendations
Workflow Architecture
Main Quiz Workflow (/new-quiz-everything
)
The primary workflow consists of multiple connected nodes that handle quiz generation and delivery:
REST API Trigger : Receives user requests with topic, difficulty level, and audio preference
UUID Generator : Creates unique identifiers for each quiz session
Web Search AI : Uses OpenAI with web search capability to generate relevant quiz questions
Conditional Branch : Routes based on whether audio is requested
Parallel Processing : Handles conversion of questions to audio files in parallel
ElevenLabs Text-to-Speech : Converts text to speech for each question and topic introduction
Supabase Storage : Uploads generated audio files to cloud storage
Data Integration : Combines quiz data with audio URLs
Supabase Database : Stores the complete quiz session data including questions and audio references
Topic Suggestion Workflow (/newTopics
)
A supporting workflow that provides intelligent topic recommendations:
REST API Trigger : Receives current topic and previously used topics
OpenAI JSON Generator : Generates 5 related but distinct topic suggestions
Smart Filtering : Avoids suggesting previously used topics
JSON Response : Returns structured topic recommendations
API Endpoints
Main Quiz Generation
POST /new-quiz-everything
Creates a new quiz with optional audio narration.
Request Body Parameters
json{
"topic": "string (required)",
"level": "number (required, 1-5)",
"audio": "boolean (required)",
"threadId": "string (optional)",
"userId": "string (optional)",
"countryCode": "string (optional)"
}
Response
json{
"response": {
"questions": [
{
"question": "string",
"options": ["string", "string", "string", "string"],
"correctAnswer": "string",
"audioUrl": "string (if audio enabled)"
}
],
"topicAudio": "string (if audio enabled)"
},
"quizSessionId": "string",
"userId": "string"
}
Topic Suggestions
POST /newTopics
Generates related topic suggestions based on a given topic.
Request Body Parameters
json{
"topic": "string (required)",
"previousTopics": "array of strings (optional)"
}
Response
json{
"topics": [
"string",
"string",
"string",
"string",
"string"
]
}
Key Features
Quiz Generation Features
Dynamic Quiz Creation : Custom quizzes on any topic with difficulty levels 1-5
Web Search Integration : AI researches topics using real-time web data
Text-to-Speech : Optional audio generation using ElevenLabs voices
Parallel Processing : Efficiently processes multiple audio files concurrently
Cloud Storage : Stores all data and audio files in Supabase
Stateless Architecture : Each request creates a unique quiz session with UUID
Topic Suggestion Features
Intelligent Recommendations : AI-generated related topics
Duplicate Prevention : Avoids suggesting previously used topics
Expanding Scope : Progressively suggests broader related subjects
JSON Format : Structured response for easy integration
Implementation Details
AI Question Generation
The system uses OpenAI's API with web search capabilities to generate relevant questions about the requested topic. The AI is instructed to:
Create 5 questions with 4 possible answers each
Match the difficulty level requested (1-5)
Format output as structured JSON
Ensure the correctAnswer
exactly matches one of the options
Research current information via web search
Topic Suggestion Algorithm
The topic suggestion system:
Analyzes the provided topic for thematic connections
Generates 5 related but distinct topics
Filters out previously suggested topics
Provides increasingly diverse suggestions while maintaining relevance
Uses temperature settings for creative variation
Text-to-Speech Processing
For audio generation, the workflow uses ElevenLabs' API to convert each individual question into speech
TTS Configuration
Voice : "DwI0NZuZgKu8SNwnpa1x" (default)
Audio Quality : MP3, 44.1kHz, 64kbps
Voice Settings :
Stability: 0.5
Similarity boost: 0.81
Style: 0
Speaker boost: enabled
Storage Architecture
All assets are stored in Supabase with the following structure:
Bucket : audio
Path Pattern : [uuid]/topic.mp3
and [uuid]/question1.mp3
, etc.
Database : Quiz data with references to audio files stored in quizSessions
table
Development Notes
Extending the System
To add additional features to these workflows:
Quiz Workflow Enhancements
Custom Voices : Modify the voice_id
parameter in the ElevenLabs node
Additional Languages : Update the OpenAI system prompt for multilingual questions
Custom Audio Formats : Change the output_format
parameter in the ElevenLabs node
Quiz Personalization : Add user preferences to the API request and modify AI prompts
Topic Suggestion Improvements
Category Filtering : Add topic categories to narrow suggestions
Difficulty-Based Topics : Include difficulty level in topic generation
User Preferences : Incorporate user interest profiles
Topic Relationships : Build a knowledge graph for better suggestions
Required API Keys
Both workflows require API keys stored in the BuildShip environment:
OpenAI API key : For AI-powered content generation
ElevenLabs API key : For text-to-speech conversion (main workflow only)
Supabase API key : For storage and database operations (main workflow only)
Dependencies
Main Workflow
axios
: HTTP client for API requests
@supabase/supabase-js
: Supabase client for storage and database operations
uuid
: For generating unique identifiers
openai
: For AI-powered question generation
Topic Suggestion Workflow
openai
: For AI-powered topic generation
Deployment
Both workflows are deployed on BuildShip and accessible via REST API endpoints. To deploy your own versions:
Clone the workflows from the provided links
Import them into your BuildShip account
Configure your API keys in the BuildShip environment
Deploy the workflows
Update your FlutterFlow app to use the new endpoints
Troubleshooting
Main Quiz Workflow Issues
Audio Generation Failures : Check ElevenLabs API key and quota
Question Generation Issues : Verify OpenAI API key and model availability
Storage Problems : Confirm Supabase bucket configuration and permissions
Web Search Failures : Ensure OpenAI web search is enabled and functioning
Topic Suggestion Workflow Issues
No Topic Variations : Check OpenAI API key and response format
Duplicate Topics : Verify previousTopics array is being passed correctly
Poor Suggestions : Adjust temperature and system prompt parameters