← All guidesCodex for Backend Engineering · Future with Shivank
Hands-on guide

7. Create Auctions & Bids Site

The warm-up is over. In this guide you throw away the practice project, read the rules file that will steer Codex for the rest of the course, add ~/codex-course/workshop as your Codex project, and get Part 1 of the real auction app running at http://localhost:5101. Every later guide starts from here.

Part 1 · run it≈ 20–30 minNo prompts, setup only

What you'll do

Before you start

⚙ Codex settings for this guide
Project / folderworkshop (~/codex-course/workshop)
ModelGPT-5.6 Sol
ReasoningMedium
ApprovalsApprove for me
AlsoWork in: Local, on your current branch (no worktree)
1

Stop the throwaway site

The Vite server from guide 5 is probably still running in the throwaway chat's bottom panel. A running server holds on to its port, and leaving old servers running is the number one cause of “port already in use” errors later. So we stop it cleanly first.

In Codex, click the throwaway chat in the sidebar, open the bottom panel with the toggle bottom panel icon (top-right), click inside the terminal and press Ctrl+C. Ctrl+C is the universal “stop the program running in this terminal” key; it is not Copy on a terminal. Also close the Playwright Chrome window from guide 6 if it is still open.

✓ You should see

The Vite output stops and you get your shell prompt back (a line ending in % or $). Nothing is listening on port 5173 any more, so http://localhost:5173 now shows a “can't connect” page in Chrome. That is what we want.

💡 Tip

If you cannot find that terminal, quitting Codex completely (Cmd+Q) and reopening it stops every terminal Codex was running, including this one.

2

Remove the throwaway project from Codex

In the left sidebar, under the Projects heading, move your mouse over auctionhouse throwaway. A small … (three dots) button appears at the right end of that row. Click it and choose Remove project from the menu.

✓ You should see

The menu offers Pin, Edit, Reveal in Finder, Archive chats and Remove project. After you click Remove project, the project and all its chats disappear from the sidebar, and the main page goes back to What should we build? with no project selected.

💡 Tip

Remove project only takes the project out of Codex's list. The folder and its files are still on your disk. We delete those in the next step, so you do not end up with a forgotten half-gigabyte node_modules folder lying around.

3

Delete the throwaway folder

The practice project did its job: you learned how to prompt, install skills, review a diff and curate an AGENTS.md. We do not need it any more, so we remove it completely and start fresh in the workshop. Open the Terminal app and run:

❯Run in TerminalTerminal app · any folder
rm -rf ~/codex-course/auctionhouse-throwaway
ls ~/codex-course
ls ~/.agents/skills

Line by line:

  • rm -rf ~/codex-course/auctionhouse-throwaway deletes the folder and everything inside it. -r means recursive (go into every subfolder), -f means force (don't ask for confirmation). This command is permanent; there is no Trash to recover from. Check the path before pressing Enter.
  • ls ~/codex-course lists what is left in the course folder, so you can confirm you deleted the right thing.
  • ls ~/.agents/skills lists your installed skills. The skills were installed globally in guide 5 (into your home folder, not into the project), so deleting the project must not affect them. This line proves it.
✓ You should see

The second line prints reference workshop: only the two course folders remain. The third line prints domain-modeling grill-me grill-with-docs grilling, the four skills untouched.

4

Open the workshop in VS Code and read the root AGENTS.md

In guide 6 you learned that AGENTS.md is sent with every prompt. The workshop already ships with one at its top level, and I want you to read it top to bottom before you send a single prompt in this project. Everything Codex does in the next twenty guides, from how many questions it asks to how it slices the work, comes from this file. If you later wonder “why did Codex do that?”, the answer is usually here.

❯Run in TerminalTerminal app · any folder
code ~/codex-course/workshop

VS Code opens with the workshop folder in the Explorer. Click the AGENTS.md at the top level, directly under the folder name, not the one inside part-1-foundation. Press Cmd+K then V for the formatted preview, as in guide 6.

📘 Concept: vertical slice

A vertical slice is one thin, complete piece of a feature that cuts through every layer of the app: a bit of database, a bit of API, a bit of UI, all working together end to end. The opposite is building horizontally: finish the whole database first, then the whole API, then the whole frontend, and only see anything work at the very end. Slices are better with an agent because after each slice you can open the browser and check real behaviour, catch a wrong assumption early, and correct it before it spreads. Our AGENTS.md tells Codex to build every part in 2–4 slices and to stop after each one for you to look.

📘 Concept: PostgreSQL tables and migrations

PostgreSQL (often just “Postgres”) is the database we use. It stores data in tables: a table is like a spreadsheet with fixed columns (id, title, current_bid) and one row per record (one row per auction, one row per bid). A migration is a small, numbered script that changes the shape of the database: create a table, add a column, add an index. Migrations are saved in the project and run in order, so every developer, every test run and the production server end up with exactly the same database structure. The rule “keep DB changes in explicit migrations” means Codex must never alter the database by hand; it must write a migration file we can read and review.

✓ You should see

A section # Project Guidelines that tells Codex to:

  • work in one specific numbered part- directory, and ask if it is unclear which one
  • stay within the core stack: TypeScript, PostgreSQL, Docker Compose, Fastify (the Node.js web framework our API uses), Zod (a library that checks incoming data has the right shape), React/Vite
  • keep each part self-contained, and read the part's own AGENTS.md and CONTEXT.md before working
  • use strict types, validate all inputs, and keep database changes in explicit migrations
  • run tests after changes, and start services only through the documented npm and Docker commands

Then a section ## Workshop specific stuff that covers:

  • draw Mermaid diagrams (text-based diagrams that render as pictures) with emoji after grilling
  • “use Chrome/Edge, not the built-in browser”
  • Playwright always runs headed, so you can watch
  • screenshots go in a temp directory, not in the repo
  • grilling uses grill-with-docs, with 8–10 questions per round, 2 rounds max
  • then build in 2–4 vertical slices, confirmed with you first, stopping after each one so you can check in the browser
💡 Tip

The Chrome/Edge rule and the headed-Playwright rule already suit your API-key setup, so you do not need to edit anything. If your copy ends with a short quotation, ignore it; it changes nothing. Also open part-1-foundation/AGENTS.md: that is Part 1's own file, with its ports (API 3101, web 5101) and its commands. Each part has one, and Codex reads the root file plus the part's file together.

5

Add the workshop as a Codex project

Now we point Codex at the workshop folder. This is the same dialog you used in guide 5, so it will feel familiar:

  1. In Codex, click New chat at the top of the left sidebar. Then click Choose project, the grey bar just above the message box, and pick + New project at the bottom of the list.
  2. In the Create project dialog, type the project name from the first box below.
  3. Under Source folders, click Add folders Codex can read and edit. A Finder window opens. Press Cmd+Shift+G (Go to Folder), paste the path from the second box, press Enter, then click Open.
  4. Click Create project.
⚙ Codex settings
Project / folderworkshop
ModelGPT-5.6 Sol
ReasoningMedium
ApprovalsApprove for me
≡Project nameCreate project → name
workshop
≡Folder pathFinder → Cmd+Shift+G
~/codex-course/workshop

Why the whole workshop and not just part-1-foundation? Because the root AGENTS.md lives at the workshop level, and because Codex will need to read Part 1's code while it builds Part 2. Giving it the parent folder lets it see every part, while the “work in one part directory” rule keeps its edits contained.

✓ You should see

Before you click Create, the dialog shows workshop as the name with workshop listed under Source folders. After creating it: workshop appears under Projects in the sidebar, the page asks What should we build in workshop?, and the bar above the message box now shows three chips: workshop · Local · master. The third chip is your Git branch name; yours may say main instead of master, depending on your Git defaults. Both are fine.

💡 Tip

Check the two buttons under the message box still say Approve for me and 5.6 Sol Medium. Project settings are remembered per project, so a fresh project sometimes comes up with different defaults.

6

Leave “Local” and your branch as they are

The throwaway folder was not a Git repository, so you never saw these chips before. Now that the workshop has Git history, Codex offers choices about where it works. Let's look at them once so they do not confuse you later, and then leave them alone.

Click the Local chip to see the “Work in” options, read them, then press Esc to close the menu without changing anything. Next click the branch chip (master or main) to see the branch list, then press Esc again.

📘 Concept: Git branch and Git worktree

A branch is a named line of history inside a Git repo. The default branch (master or main) is where our work goes. A worktree is a second, separate folder on disk that is checked out to a different branch of the same repo. Why would you want that? Because two agents editing the same files in the same folder at the same time would trample each other. With a worktree each agent gets its own folder and its own branch, and you merge the results later. It is a powerful setup for running several Codex tasks in parallel, and I recommend it for real projects, but in this course we keep things simple and stay in one folder on one branch.

✓ You should see

Under Work in: four options: Local ✓, New local worktree, Connect Codex web, Cloud. Under Branches: your single branch with a ✓ next to it, plus “Create and checkout new branch…”. Keep Local and your current branch for the whole course.

💡 Tip

Connect Codex web and Cloud run Codex on OpenAI's servers instead of your Mac. Both need a ChatGPT sign-in, so they will not work with your API key. You lose nothing: everything in this course runs locally.

7

Install Part 1's packages from Codex's terminal

From now on we run the app from the terminal built into Codex, so that the app and the agent live in one window. Click the toggle bottom panel icon (top-right). The terminal opens already inside the workshop root folder. Run:

❯Run in TerminalCodex bottom panel · workshop
ls
cd part-1-foundation
npm install

Line by line:

  • ls lists the workshop root, so you can confirm the terminal is in the right place before you go deeper.
  • cd part-1-foundation moves into Part 1's folder. Every part is its own small project with its own package.json, so commands must be run inside the part, not at the root.
  • npm install reads package.json, downloads every package the project depends on (Fastify, React, Vite, the Postgres driver and so on) and puts them in a node_modules folder. The cloned repo does not include node_modules, because it is huge and can always be rebuilt from the list, so this step is mandatory on a fresh clone.
✓ You should see

ls prints AGENTS.md README.md docker-compose.yml part-1-foundation … part-8-cross-stack-debugging scripts stripe-service. npm install runs for a minute or two and ends with added … packages. A few npm warn lines about deprecated packages are normal; only red npm ERR! lines are a problem.

💡 Tip

If you run the app before installing, you get sh: concurrently: command not found. concurrently is one of the installed packages: it runs the frontend and the backend together in one terminal. No install, no package, no app. That is why npm install always comes first in a fresh folder.

8

Start Part 1

Still inside part-1-foundation, start everything with one command. Use npm start, not npm run dev. The start script does three things in order: it starts the PostgreSQL container through Docker Compose, it creates Part 1's database (auction_part_1) and runs its migrations, and only then does it launch the two development servers (frontend and API).

❯Run in TerminalCodex bottom panel · part-1-foundation
npm start
📘 Concept: Docker Compose services

In guide 1 you met Docker containers. Docker Compose is the tool that starts several containers together from one file, docker-compose.yml at the workshop root. Each entry in that file is a service: a named container with its image, its ports and its settings. Right now the only service we need is postgres. In later guides the same file also gives us Redis, RabbitMQ and Jaeger, each one a service we start with a single command instead of installing anything on the Mac. All eight parts share this one Postgres container, but each part gets its own database inside it, which is why the database is named auction_part_1.

✓ You should see

Three phases of output:

  • Docker lines as the postgres container starts. The very first time, Docker downloads the postgres:16-alpine image (a few hundred MB), so give it a minute. Later starts are instant.
  • A migration line such as 0 migrations applied or 1 migration applied. Either is fine; it just means the database is now at the structure Part 1 expects.
  • Then interleaved lines tagged [web] (the Vite frontend) and [server] (the Fastify API): [web] VITE v7.x ready, [web] ➜ Local: http://localhost:5101/, and [server] … "msg":"Server listening at http://…:3101".

Two ports, two servers: 5101 serves the pages you look at, 3101 answers the data requests those pages make.

💡 Tip

Leave this running for the rest of the guide. If you see “Cannot connect to the Docker daemon”, Docker Desktop is not running: open it, wait for “Engine running”, then run npm start again. You can stop everything any time with Ctrl+C; the Postgres container keeps running in the background, which is fine.

9

Open Part 1 in Chrome

Time to see the real app. You can hold Cmd and click the http://localhost:5101/ link in the terminal, or copy the URL below and paste it into Chrome's address bar.

↗Open in browser
http://localhost:5101

This is the foundation we build on for the whole course. Unlike the throwaway site, which invented luxury lots, this one sells server hardware, and the six items you see are sample rows that the migrations put into the database. Notice how different it looks from the throwaway: this is what a prescriptive AGENTS.md and a planned stack produce.

✓ You should see

Auction House: a search bar, the categories Featured · GPUs · CPUs · Memory · Chassis · Networking · Cooling, the hero line “Serious hardware. Less serious prices.”, and a section Equipment worth watching with six lots: NVIDIA H100 SXM 80GB ($18,450), AMD EPYC 9654 · 96 cores ($4,725), 1.5TB DDR5 ECC memory kit ($6,890), a Supermicro chassis, an NVIDIA Quantum-2 switch and a cooling loop. Click the H100 card to open its page at /items/nvidia-h100-sxm-80gb. The Place bid button does nothing yet. Building bidding is exactly what Part 2 is for, starting in the next guide.

💡 Tip

Open the browser's developer console once (right-click → Inspect → Console tab). It should be empty of red errors. Getting used to glancing at the console now will save you a lot of confusion when Codex's code misbehaves later.

10

Check the API and database are connected

A pretty page does not prove the backend works; a static page would look identical. Part 1's whole purpose is a working path “React → Fastify → Postgres”, so let's prove each link in that chain with the health check endpoint.

📘 Concept: API route (endpoint), request and response

An API is the part of the backend that the frontend talks to. It has no pages, only routes (also called endpoints): URLs that accept a request and return data as a response, usually in JSON format. When the auction page loads, the React code sends a request to a route like GET /api/items, the Fastify server queries Postgres, and sends back a JSON list the page renders. A health route is a special, tiny route whose only job is to answer “I'm alive, and here is whether I can reach my database”. Every production service has one, and monitoring systems call it every few seconds.

↗Open in browser
http://localhost:5101/api/health

Why port 5101 and not 3101? The Vite dev server on 5101 is configured to forward anything starting with /api to the Fastify server on 3101. The browser thinks it is talking to one server; behind the scenes there are two. This is called a proxy, and it is why the frontend code can use simple relative URLs like /api/items.

✓ You should see

Plain JSON text in the browser: {"ok":true,"db":"ok","requestId":"…"}. ok:true means the API answered, db:"ok" means the API could reach Postgres, and requestId is a unique id the server attaches to every request for tracing. You are now at the starting point for the real build: Part 1 running from ~/codex-course/workshop, and Codex open on the workshop project. Leave both exactly as they are for guide 8.

💡 Tip

"db":"down" means the API is running but cannot reach Postgres. Make sure Docker Desktop is running, press Ctrl+C in the terminal, and run npm start again so the compose step gets another chance to bring the container up.

Stuck or got a very different result?

Part 1 in the reference copy is the same starter code you have, so the reference's part-1-foundation is the finished state of Part 1. If you changed or broke your part-1-foundation, replace it with the reference version using the first command, then run npm install and npm start in it again with the second. If you see port 5101 or 3101 “already in use”, an old dev server is still running somewhere: stop it with Ctrl+C in its terminal, or quit and reopen Codex.

❯Run in TerminalTerminal app
cd ~/codex-course/workshop && rm -rf part-1-foundation && cp -R ../reference/part-1-foundation ./ && git add -A && git commit -m "Catch up: part 1 from reference"

That one line does four things: moves into the workshop, deletes your Part 1, copies the reference Part 1 in its place (cp -R copies a folder with everything inside), and commits the result so your Git history records the catch-up.

❯Then run Part 1 againTerminal app
cd ~/codex-course/workshop/part-1-foundation && npm install && npm start

Key takeaways