BuildShip Logo
BuildShip Community

The Great Big Quiz of Everything

Create interactive, audio-enabled quizzes on any topic. Includes full video tutorial allowing you to build AI-powered, Supabase-secured, and fully adaptive quizzes on literally any topic you can imagine.

29

Report this template

Select the reason for reporting

Describe the issue in detail

Share template

Link to template

https://templates.buildship.com/template/zgxp6LGtgPR5/

This template contains 2 flows:

Select an example

Inputs

topic

Flutter

userId

********

threadId

45522dcc-9339-4574-9f82-615acab854f5

audio

True
False

level

1

countryCode

US

quizSessionId

45522dcc-9339-4574-9f82-615acab854f5
This is a static example using sample inputs. Remix the template to run it with your own values.

Output

Read me

📖 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)

Tutorial Part 2 (BuildShip Setup)

Tutorial Part 3 (Integrating an AI Quiz Host with Elevenlabs)

Tutorial Part 4 (Deployment)

Overview

This repository contains two complementary BuildShip workflows that power a complete quiz generation system:

  1. Main Quiz Workflow - Generates quizzes with optional audio narration
  2. 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:

  1. Clone the workflows from the provided links
  2. Import them into your BuildShip account
  3. Configure your API keys in the BuildShip environment
  4. Deploy the workflows
  5. 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