AI Engineer Summit 2023
GPT Web App Generator - 10,000 apps created in a month: Matija Sosic
Loading slides…
Read the talk
GPT Web App Generator - 10,000 apps created in a month
Mage turns a short app description into a working React and Node.js starter by combining Wasp scaffolding, staged code generation, targeted repairs, and selective model use.
From a talk by Matija Sosic
Before you start: Basic familiarity with React, JavaScript modules, and database records will help; no prior Wasp experience is required.
Start with a to-do app
What does it take to turn a short description of a to-do app into a working application, including authentication and a database? Mage starts with a web form and returns a downloadable codebase. Matija Sosic reports that people used it to create over 10,000 applications in one month.
The demonstration begins with an application name and a few sentences describing one main page that lists tasks. Users should be able to create tasks, edit them, and toggle their completion. A creativity setting corresponds to GPT temperature: the safer setting tends toward fewer features, while a more adventurous setting can introduce more features and more mistakes. Sosic chooses the balanced option and presses Generate. The result is a finished project with source files available to inspect.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
From generated files to persistent tasks
The generated stack combines React, Node.js, and Prisma through Wasp, a full-stack framework. Its central configuration describes authentication, routes, pages, and the data model in a high-level declarative form. The application still contains ordinary React client code and Node.js functions that execute on the backend; the configuration connects those pieces.
To run the downloaded project locally, Sosic uses:
sh
wasp start
The app opens with username-and-password login. After logging in, he creates tasks, including “Become an AI engineer,” and marks them complete. He then opens the database inspector included with Wasp to check the stored results.
The inspector shows two task rows with isDone set to true. Sosic adds “Have fun,” which initially has isDone: false. Completing that task in the app changes the stored value to true. This is the decisive part of the demonstration: the generated interface is connected to persistent data, and a completion toggle updates that data.
Completing “Have fun” changes its stored state
Constructed example: Object IDs are presentation identifiers; the visual shows only the task text and completion field described in the demonstration, not a complete database row.
Have fun
Operation: Complete the task in the app, then inspect its database state.
Task text
Have fun
Have fun
isDone
false
true
Deployment follows the same full-stack structure. Wasp offers a single-command helper for Fly.io, while the underlying React and Node.js application can also be deployed elsewhere. At the time of the demonstration, support for additional providers through the helper was described as forthcoming.
Sosic describes Mage as among the early coding agents capable of generating full-stack web apps with almost no errors. That prompted two recurring questions from users: why did it work so well, and was generation cheap enough to offer for free?
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Reduce the work before asking the model
Mage makes generation easier by narrowing what it has to generate. Three choices reinforce each other:
- Web apps only: Supporting React, Node.js, and Wasp lets the generator make assumptions about the application structure up front.
- High-level framework: Wasp removes boilerplate that the model would otherwise need to write and connect correctly.
- Automatic debugging: Mage detects and repairs errors before returning the final result. The restricted stack and smaller code surface also make this repair problem more manageable.
Those constraints enable step zero, which happens before the coding agent takes over. Mage produces known pieces of the project without calling the OpenAI API: configuration files, some authentication logic, global CSS, and similar shared infrastructure. The model does not have to rediscover the same starting structure for every app.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Plan, generate, then repair
After scaffolding, the generation log exposes three phases:
- Planning: Turn the app description into a list of queries, actions, entities or data models, and pages. For the to-do app, the plan includes one page.
- Generation: Implement the components listed in that plan.
- Repair: Detect common errors and attempt fixes, repeating when a fix fails.
The displayed run includes a failed repair followed by another attempt. It finishes when Mage cannot detect further errors; that stopping condition does not establish that every possible behavior is correct. Sosic reports that the demonstrated run used about 27,000 tokens.
During development, the team found recurring mistakes such as mixing up default and named imports. Some errors could be fixed with a simple heuristic, without asking GPT again. For example, a named export in task.js:
js
export function completeTask(task) {
return { ...task, isDone: true };
}
requires a named import in its consumer:
js
import { completeTask } from './task.js';
const task = { title: 'Have fun', isDone: false };
const completedTask = completeTask(task);
The braces in the import follow from the export declaration. A repair rule can address that mismatch directly instead of treating it as a fresh code-generation problem.
Sosic reports that the described fixes handled 90% of errors. He does not specify an evaluation set or denominator, so this should not be read as the percentage of applications that worked, or as a result attributable entirely to heuristics. Wasp also contributes by removing code that could otherwise contain mistakes and concentrating application structure in its high-level configuration.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Spend the stronger model on planning
Sosic reports that typical Mage apps took 2–3 minutes, used 25,000–60,000 tokens, and cost $0.10–$0.20 to generate. These are historical figures for the demonstrated model setup, not current API prices.
The cost reduction comes from assigning GPT-4 and GPT-3.5 to different stages. Sosic estimates that using GPT-4 throughout would have cost ten times more, or $1–$2 per app. The actual division of work is compact:
| Stage | Model | Reason |
|---|---|---|
| Planning | GPT-4 | Most complex and creative decisions |
| Implementation | GPT-3.5 | Faster, cheaper execution of the plan |
Once the plan exists, Wasp's web abstractions provide enough guidance for the cheaper implementation model to do useful work. The architecture reduces how much independent judgment each implementation step requires.
For comparison, Sosic reports a cost range of $0.80–$10 for another, unnamed agent to produce a similar app. That agent takes a freer approach and relies more on GPT itself. The range is an illustrative comparison, with no controlled same-task methodology supplied in the talk.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
A customized CRUD starter
The useful scope is a customized CRUD starter: an application that creates, reads, updates, and deletes data, with its initial structure tailored to the user's description. At that level, Sosic reports almost no or very few errors that users can readily detect and fix. React, Node.js, and Tailwind give developers familiar pieces to continue working with after generation.
Sosic sees this as a direction for SaaS starters: generate a starting point around the actual app instead of asking every developer to adapt generic boilerplate. But the prompt still needs a useful level of specificity. Pushing toward more ambitious applications produces more errors, while underspecifying the behavior also hurts results. “Make Facebook, but yellow” supplies a recognizable reference and a color, but little concrete guidance about what the generator should build.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Beyond the initial prompt
Mage began as an experiment in generating full-stack applications with Wasp. Its simplicity also creates its main product limitation: the user has no interaction with the agent beyond the initial prompt. The proposed next step is a live debugging mode, letting users remain on the web page and request changes or error fixes after seeing the result. That would turn a single generation attempt into an iterative development conversation.
A model fine-tuned for Wasp and web development is another possibility, but its value remains uncertain. Sosic anticipates greater expense and questions how much improvement specialization would bring when Wasp's syntax is already simple and human-readable. Both live debugging and fine-tuning are proposals in this account.
Mage comes from the team behind Wasp, a fully open-source framework for React and Node.js development. Sosic closes by inviting questions and comments through the project's repository and Discord community.
Suggest correction
This note stays in this page until you copy or download it. Nothing is submitted; reloading clears the draft.
Resources
Further reading
- How Mage's code agent worksArticle
The team's original explanation of scaffolding, planning, code generation, repair and model allocation.
Examples and limitations of the initial React, Node.js, Prisma and Wasp generator.
A team-authored comparison using Pong and blogging apps, including prompts, repairs and historical generation costs.
The speaker's account of Mage's origins, launch and adoption.
Updates since the talk
Versioned instructions for generating apps through Mage or the Wasp CLI.
- Mage source archiveRepository
Archived source and setup instructions for Mage, frozen on Wasp 0.23 and no longer maintained.
Full transcript
Loading transcript…