• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
msd

msd

aa

Public
Like
aa
Home
Code
4
frontend
1
README.md
H
course-generator.ts
H
frontend-handler.ts
Branches
1
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
README.md
Code
/
README.md
Search
5/16/2025
Viewing readonly version of main branch: v12
View latest version
README.md

AI Course Generator

This Val Town project generates comprehensive course structures from user prompts using OpenAI.

Features

  • Takes a course topic as input and generates a complete course structure
  • Uses OpenAI's GPT-4o model for high-quality content generation
  • Provides a structured output with course title, description, target audience, prerequisites, learning outcomes, modules, and lessons
  • Includes a user-friendly web interface

Project Structure

  • /course-generator.ts - Core logic for generating course structures using OpenAI
  • /frontend-handler.ts - HTTP handler that serves the frontend and processes API requests
  • /frontend/index.html - Web interface for the course generator

How to Use

Web Interface

  1. Visit the frontend URL
  2. Enter a course topic in the text area (e.g., "Introduction to Machine Learning", "Web Development with React")
  3. Click "Generate Course"
  4. View the generated course structure with modules and lessons

API Usage

You can also use the course generator as an API:

// Example API call const response = await fetch('YOUR_VAL_TOWN_URL', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify({ prompt: 'Introduction to Machine Learning' }), }); const courseStructure = await response.json();

Response Format

The API returns a JSON object with the following structure:

{ "courseTitle": "Title of the course", "courseDescription": "A paragraph describing the course", "targetAudience": "Description of who this course is for", "prerequisites": ["Prerequisite 1", "Prerequisite 2", ...], "learningOutcomes": ["Outcome 1", "Outcome 2", ...], "modules": [ { "title": "Module title", "description": "Module description", "lessons": [ { "title": "Lesson title", "description": "Brief description of the lesson", "keyPoints": ["Key point 1", "Key point 2", ...] }, ...more lessons ] }, ...more modules ] }

Requirements

  • OpenAI API key set as an environment variable in Val Town

Notes

  • The course generator uses GPT-4o for optimal results
  • Each course typically contains 4-6 modules with 3-5 lessons each
  • The generation process may take a few seconds to complete
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
ExploreDocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.