The frontend code lives in 05-building-a-chatgpt-app/note-taking-app/frontend in the materials repo. It’s a standard React app bundled with Vite, designed to run in ChatGPT’s iframe. Direct database access is impossible due to sandboxing, so all communication flows through the host via window.openai—the bridge injected by ChatGPT.
Prerequisites: Ensure the backend is configured (from the previous section). This project ships with a prebuilt dist/index.html, so you can preview via the backend’s /dashboard route right away. Only run npm run build if you change the React code and need to regenerate the bundle.
Think of window.openai as a secure portal: It provides data injection, tool calling, and state persistence, but with restrictions for security (e.g., no arbitrary network access without CSP).
The Bridge Object
When rendering the widget, ChatGPT injects window.openai into the iframe. You abstract it with React hooks in hooks/useOpenAi.js for easy subscription and re-renders.
This content was released on Apr 10 2026. The official support period is 6-months
from this date.
Explore the React frontend of the application. This lesson focuses on the window.openai object, which acts as the bridge between your iframe and the ChatGPT host, handling data synchronization and tool execution.
Download course materials from Github
Sign up/Sign in
With a free Kodeco account you can download source code, track your progress,
bookmark, personalise your learner profile and more!
Previous: The Backend: Serving Resources
Next: Server & Tunnel Setup
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.