GPT-5 Coding Examples

repository·main·Indexed 23 days ago

https://github.com/openai/gpt-5-coding-examples

A collection of demo applications generated from single GPT-5 or GPT-5.2 prompts, including the Tea Dunkability Simulator, Weather Theatre, and Pixel Paint ’99. The repository provides examples of how natural-language descriptions can scaffold full websites, games, and interactive UIs using React, Canvas, and Next.js.

Tokens
2.7K
Snippets
5
Records
22
Agent score
84%

What's inside gpt-5-coding-examples

  1. Understand the Weather Theatre technical implementation

    main

    Weather Theatre is built as a self-contained React + Canvas application with the following characteristics:

    • Rendering: All visuals are drawn to an HTML Canvas, driven by React state. The canvas automatically adjusts for the device pixel ratio.
    • Visual Logic: The spotlight, fog, rain, and color blending are determined by the combination of mood slider values.
    • Data: No external APIs are used. React is loaded via CDN and the weather forecast data is mocked.
    • Determinism: The scene is deterministic per page load using a seed, though refreshing the page will vary the skyline and cloud layouts.
  2. How Weather Theatre works

    main

    Weather Theatre is a deterministic React + Canvas application. It uses React state to drive all visuals drawn to an HTML Canvas, which automatically adjusts for the device pixel ratio.

    Key technical characteristics:

    • Data: No external APIs are used; the weather forecast is mocked.
    • Visuals: The spotlight, fog, rain, and color palettes are blended dynamically based on the combination of mood slider values.
    • Layout: The skyline and cloud layouts are deterministic per page load using a seed, but refreshing the page will vary the layout.
  3. Understand the Tea Dunkability simulation model

    main

    The simulation uses a qualitative model tuned for feel rather than scientific accuracy.

    Risk Factors: Risk of crumbling increases based on:

    • Higher tea temperature
    • Longer dunk time
    • More fragile or porous biscuit types
    • Lower structural integrity

    Mathematical Model: Absorption is modeled using the formula: 1 - e^{-k t}, where parameters are driven by the user-controlled sliders.

  4. Run the GPT-5 Coding Examples demo locally

    main

    To explore the curated collection of demo applications locally, clone the repository and execute the following commands within the front-end directory. The application will be served at http://localhost:3000.

    cd front-end
    npm install
    npm run dev
  5. Run the Tea Dunkability Simulator

    main

    The Tea Dunkability Simulator is a single-page React experience that simulates biscuit dunkability using sliders for tea temperature, dunk time, biscuit type, and structural integrity. It features a looping teacup animation, a live 'Crumble-o-meter' graph, and crumb particle effects.

    To run the simulator, simply open the index.html file in any modern web browser. No build step or installation is required as the project uses React 18 and Babel via CDN.

  6. Build apps in the browser using ChatGPT and GPT-5

    main

    Non-developers can build and preview single-page applications entirely in the browser using ChatGPT with GPT-5:

    1. Copy a prompt from the examples for inspiration and customize it.
    2. Let GPT-5 generate the HTML/CSS/JavaScript code.
    3. Use the Canvas preview feature to see the application run live.
    4. Download or copy the generated HTML for use in other environments.
  7. Use Codex CLI with GPT-5 to scaffold applications

    main

    For a seamless terminal-based coding experience, use the Codex CLI. When provided with a prompt and the --full-auto flag, the CLI will generate code, execute it in a sandbox, install necessary dependencies, and provide a live preview. Use the --model gpt-5 flag to specify the model.

    codex --model gpt-5 --full-auto "Build a simple photobooth application with camera access in a single HTML file"
  8. Run the Weather Theatre experience

    main

    Weather Theatre is a single-file React + Canvas experience that requires no build step or installation. To run it, simply open the index.html file in any modern web browser (such as Chrome, Edge, Firefox, or Safari).

    Once running, you can interact with the experience using the following controls:

    • Mood Sliders: Adjust the sliders for Cosy, Eerie, and Heroic to reshape the weather into different parallax backdrops, spotlight sweeps, and velvet curtain reveals.
    • Raise Curtain: Click this button to reveal the scene.
    • Matinée/Night Toggle: Switch between these modes to change the palette and ambience (time of day).
    • Mouse Movement: Move your mouse over the stage to trigger subtle parallax effects.