Skip to Content

Getting started

Example store

Photo Studio, a live Shopify print shop on Next.js that reads every page from Content: the model in Git, drafts on the canvas, editing on the site, webhooks and A/B tests in its pages. With its source.

3 min read

Photo Studio is a print shop for a fictional photographer: six series of photographs, each print in several sizes, papers and frames. Shopify sells the prints; Content holds every page around them and the story behind each series and print. It is a real, running storefront, and its source is public (MIT), so every step in these docs can be read in working code.

What Content does there

  • The pages: home, About and Printing are page entries, served at their path.
  • A page per series and per print: a seriesPage picks a Shopify collection and a printPage a Shopify product with a Shopify field. The store's collection and product routes look up the entry by that field and render its story under Shopify's title, price and variants.
  • Blocks that mix both: intro, text, image and quote blocks, and featuredSeries and featuredPrint, where an editor picks collections or a product and the site fills in the live image and price from Shopify.
  • A/B tests in the content: the home page's intro is an improve block, the home-intro test, written by an editor and decided before the first paint on a prerendered page.
  • Click rates on the canvas: every block carries its _uid as data-numbers-id, so Numbers counts its clicks and the canvas shows them on the block.

Where to look in the code

FileWhat it shows
content/content-model.jsonThe model in Git; content/content-types.ts is generated from it with npx content types
.github/workflows/content-model.ymlPlans model changes on a pull request and applies them to develop on merge
lib/cms/server.tsPublished reads in Next's cache under one cms tag, a series or print page found by its Shopify field, and drafts only with an editor's own token
components/cms/cms-entry.tsxThe published entry in the static shell; a draft swaps in only for a request that carries an editor's token
components/cms/cms-body-client.tsxThe block renderer: useLiveEntry and editable for the canvas, the improve block, click tracking per block
components/cms/cms-body.tsxReads the Shopify products and collections featured blocks need on the server
components/cms/cms-bridge.tsxContentBridge, which lets the canvas follow and edit the page
app/cms/[...path]/route.tsEditing on the site: sign-in turns on Next's draft mode
app/api/webhooks/content/route.tsA webhook that expires the cms tag, so a publish shows at once
next.config.tsframe-ancestors allows content.obelism.studio, so the canvas can show the site

Its AGENTS.md describes the same split for coding agents: which product owns which part of the store, and the rules each part keeps.

Run it on your own space

  1. Clone the repository, then npm install and cp .env.example .env.local (npm 11 and Node.js 26).
  2. Create a space and give it the store's model: with a management token in CONTENT_MANAGEMENT_TOKEN, npx content model apply creates the content types from content/content-model.json.
  3. Put a delivery token, the space id and the environment in CONTENT_DELIVERY_TOKEN, CONTENT_SPACE_ID and CONTENT_ENVIRONMENT, and the Storefront API credentials of a Shopify store in the SHOPIFY_* values.
  4. npm run dev, then set the environment's preview URL to http://localhost:3000 to edit the pages on the canvas, or sign in on the site at /cms/login.
  5. Add a webhook to /api/webhooks/content with CONTENT_WEBHOOK_SECRET, so publishing refreshes the deployed site.

The README has the rest: seeding the Shopify catalog, and the values that turn Numbers and Improve on.

The other products on the same store

  • Improve assigns every test before the page paints, in code and in Content's pages.
  • Numbers counts page views, block clicks and the shop's events, through to paid orders.
  • Media holds the photographs and puts them on the Shopify products with one product rule.

On this page

Marks in the margin

  • Note
  • Watch out
  • Updated

Scribes marked doubtful lines in the margin. That practice is called obelism.