Guides/How to use Moon templates with ChatGPT Codex
Beginner5 min read·ChatGPT CodexVibe coding

How to use Moon templates with ChatGPT Codex

ChatGPT Codex is OpenAI's AI coding agent. Adding a Moon template gives Codex a production-quality visual baseline so it spends your session on your product logic, not inventing layout and typography from scratch.

How to use Moon templates with ChatGPT Codex

ChatGPT Codex is OpenAI's AI coding agent, built into ChatGPT. It reads and writes files, runs terminal commands, and can scaffold a full project from a single natural language description. When you give it a Moon template, it uses the design as a fixed reference and generates all your product code around it — rather than inventing its own layout from scratch.

Step 1: copy a Moon template

Browse the Moon gallery and open the section you want to use. Click "Copy code." The full self-contained HTML is now on your clipboard — no framework, no external dependencies, nothing to install before you paste it.

Step 2: open ChatGPT Codex and paste the template into your prompt

Start a new Codex session and paste the Moon template alongside your product description. A prompt structure that works well looks like this:

Build a landing page for a B2B analytics SaaS for operations teams. Use the hero section below as the top of the page. Replace the headline with "See every workflow, all in one place." Keep all the design from the template exactly as provided — the typography, the spacing, the animations. Add a features section below the hero with three columns.

[paste Moon template here]

Codex treats the pasted HTML as a hard design constraint and builds everything else in the session consistent with that baseline.

Step 3: write to a file for multi-session projects

For a project that spans more than one session, ask Codex to write the Moon template to a file in your project on the first run: "Save the hero section HTML to reference/hero.html and build the homepage component from it." In later sessions, you can point Codex to the saved file instead of pasting the template again.

Step 4: lock the design before adding backend logic

Once Codex has rendered the first version, verify the Moon template design is intact before adding routes, data models, or authentication. If any styles have drifted, send a targeted correction before continuing: "Restore the hero section to match the design in reference/hero.html exactly." Then proceed to build out your product logic.

Converting the template to React or Tailwind

Moon templates use inline styles for maximum portability. If your project uses React and Tailwind, include "convert all inline styles to Tailwind classes and wrap in a React component" in your initial instruction. Codex handles the conversion accurately and flags values without a direct Tailwind equivalent so you can add them to your config.

Frequently asked questions

What is ChatGPT Codex and how is it different from the ChatGPT chat interface?

ChatGPT Codex is OpenAI's agentic coding environment. Unlike the standard ChatGPT chat interface, Codex can read and write files in your project, run terminal commands, install dependencies, and execute multi-step coding tasks autonomously. It is designed for building software, not just answering questions about it.

Should I paste the Moon template in the chat or save it to a file first?

For a single session on a single page, pasting the template in the chat is the fastest approach. For a multi-session project or when you need Codex to reference the same design across several tasks, ask Codex to save the template to a reference file on the first run and point to that file in later sessions.

Can ChatGPT Codex convert a Moon template to React and Tailwind?

Yes. Include 'convert all inline styles to Tailwind classes and wrap in a React component' in your instruction. Codex translates the Moon HTML accurately and flags any values that need a custom Tailwind config entry rather than silently dropping them.

Which Moon templates work best with ChatGPT Codex?

Hero templates, SaaS landing page templates, and pricing templates are the highest-value starting points for a Codex session. They define the visual identity of the whole product and are the sections where a concrete design reference saves the most iteration time.

Ready to copy a section?

Browse all vibe coding templates.

Browse Moon

More guides