aa
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.
Viewing readonly version of main branch: v10View latest version
This Val Town project generates comprehensive course structures from user prompts using OpenAI.
- 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
/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
- Visit the frontend URL
- Enter a course topic in the text area (e.g., "Introduction to Machine Learning", "Web Development with React")
- Click "Generate Course"
- View the generated course structure with modules and lessons
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();
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 ] }
- OpenAI API key set as an environment variable in Val Town
- 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