Concrete
Start

Read the starter

Your first look at a workspace — the four files the scaffolder wrote, construct by construct.

Four files hold the whole template. Every one of them is shown here exactly as it is in your workspace — these are the scaffolder's own bytes, not a copy of them.

Goal

Be able to point at any construct in the starter and say what it is for.

Steps

template.ts — the one reserved file

template.ts
// The one file Concrete finds by name. Everything else the template is made of is reached
// from here: the pages it names, the sections they place, the stylesheet, the icon and the
// fixture list.
import { defineTemplate, website } from "@homepages/concrete";

import "./globals.css";
import icon from "./icon.svg";
import { Home } from "./pages/home";

export default defineTemplate({
  // The template's identity on the platform: the name in lowercase kebab-case. Renaming
  // it mints a new template.
  key: "my-template",
  // Two words at most.
  name: "My Template",
  format: website,
  icon,
  // "global" is offered to every customer. An org-private template names its org
  // instead: scope: { org: "<org_id>" }.
  scope: "global",
  // The site map. The object key is the page id, object order is the page order, and
  // exactly one page takes the path "/". Another would be
  // `gallery: { label: "Gallery", path: "/gallery", page: Gallery }`.
  pages: {
    home: { label: "Home", path: "/", page: Home },
  },
  // The dev data `concrete dev` renders and `concrete check` grades with: a list of
  // content fixtures, each on a property document. It never reaches the published template.
  fixtures: "./fixtures/index.json",
});

It is the root of the import graph. The pages it names, the sections those pages place, the stylesheet and the icon are all reached from here by import, and the fixtures by the list it names — which is why it is the only name the framework has to reserve.

  • key is the template's identity on the platform. It is explicit, and renaming it mints a different template rather than renaming this one.
  • name is what a user sees in a template picker. icon is the SVG beside it, imported like any asset.
  • format declares what this template produces. website is a site of pages at URLs; a deck, a social post or a print sheet are other formats, and the types follow the one you name — see pages and composition.
  • scope is the audience. "global" offers the template to every organization; naming organizations instead restricts it to them, and publishing and environments has the rules the platform holds that to.
  • pages is the site map. The object key is the page id, the object order is the page order, and exactly one page takes "/".
  • fixtures names the fixture list, a path relative to template.ts. It is dev data only: nothing it reaches is bundled into the published template.

Nothing here says how two sections relate. A slot that depends on another section declares that on its own source: — the concept is reading another section.

pages/home.tsx — a page places sections

pages/home.tsx
import { Hero } from "@/sections/hero/section";

// A page places sections and nothing else — no host elements, no props. The order
// here is the page's section order; a section placed on two pages is one shared
// instance rendered on both.
export const Home = () => <Hero />;

A page component takes no props, returns sections, and contains nothing else — no <div>, no stray string. It is never rendered for a visitor: a check-time probe evaluates it once to learn which sections sit on which page in what order, and that recording is the template's composition.

Two consequences worth holding on to. Chrome that renders — a header, a footer — is a section, not page markup. And placing the same section value on two pages gives you one instance rendered on both, which is exactly what a header wants: pages and composition.

sections/hero/section.tsx — the section

sections/hero/section.tsx
import { fact, fill, image, Section, section, Slot, text } from "@homepages/concrete";

// A starter section with both kinds of slot. Every slot says where its value comes
// from in `source:`. The headline and the hero image are CONTENT: `fill.write` and
// `fill.pick` tell the platform's AI how to write and choose them, and a fixture states
// them for local runs (fixtures/starter-home.json). The street and city are FACTS:
// `fact.*` binds them to the property the page is filled for, so they are never written
// by hand. Declare more slots
// with the per-kind builders (`text.*`, `number`, `select`, `image`, `video`, `url`,
// `document`, `poi`), `list({ label, source, item })` for anything repeating, and
// `object({ label, fields })` for fields that belong together.
export const Hero = section(
  {
    // The section's identity on the platform. Explicit, never derived from the export
    // or file name, so a refactor cannot mint a new section and orphan its content.
    key: "hero",
    label: "Hero",
    slots: {
      // `cap` is the slot's character budget and the only place it is written — the
      // write inherits it. `reads` is exactly what the model sees beside the brief, and
      // the brief is the whole instruction: what to write, its shape, its tone.
      headline: text.medium({
        label: "Headline",
        cap: 80,
        source: fill.write({
          reads: [fact.property.address, fact.property.description],
          brief: "Name what makes the property worth seeing, in one short, confident sentence.",
        }),
      }),
      // An image is picked from the list its `from` names — by the AI when it fills the
      // slot, and by the user when they replace it: `fact.property.property_media` holds the
      // property's photos, `fact.property.floor_plans` its plans.
      hero_image: image({
        label: "Hero image",
        from: fact.property.property_media,
        source: fill.pick({ brief: "The photo that best shows the front of the property." }),
      }),
      // A slot sourced by a fact writes where the fact is stored: an edit offers to update
      // every page that reads it. These two read parts of the address, which are read-only.
      street: text.short({ label: "Street", source: fact.property.address.street }),
      city: text.short({ label: "City", source: fact.property.address.city }),
    },
  },
  // A pure, server-rendered function of its bindings. Each `Slot.*` renders one value
  // and marks it for the editor. For interactivity, add a "use client" island file
  // beside this one and render it here.
  ({ slot }) => (
    <Section className="bg-white text-neutral-900">
      <div className="mx-auto max-w-3xl px-6 py-24">
        <Slot.Image slot={slot.hero_image} className="aspect-[3/2] w-full rounded-lg" />
        <Slot.Text slot={slot.headline} as="h1" className="mt-10 text-4xl font-semibold tracking-tight" />
        <p className="mt-4 text-lg text-neutral-600">
          <Slot.Text slot={slot.street} as="span" />, <Slot.Text slot={slot.city} as="span" />
        </p>
      </div>
    </Section>
  ),
);

The one exported value that carries both halves of a section: its declaration, then its markup.

The options object. key is the section's identity, explicit for the same reason the template's is — a refactor that renamed the export or moved the file would otherwise mint a new section and orphan every user's content. label is the name the editor shows.

slots is the declaration. Each entry is one piece of content: a builder naming its type, and exactly one answer to where its value comes from.

  • headline and hero_image are content. Each carries a fill — a brief the platform's model reads, under a verb that says what the model does with it. The headline's fill.write says what to write and in what tone, and its reads name the facts the model sees while writing it; the hero image's fill.pick says which photograph to choose out of the property's images, and needs no reads because those images are its candidates. See AI fill. The candidates are the other half: a media slot bound to no fact is picked from the list its from names, of its kind — fact.property.property_media for the property's photos, fact.property.floor_plans for its plans, fact.property.uploads for every image it holds. They are what the model chooses from as well as what the user is offered.

  • street and city are facts. Each source: is a fact ref, binding it to a field of the property itself, so no model writes them and nobody types them. Both are parts of the address, which is stored whole, so an edit to either stays on this page; a slot bound to a stored fact offers its edit back to the property, for every page that reads it. See facts and provenance.

  • cap is the slot's character budget, written once. The fill inherits it, and it is the budget the model writes to — which is why the headline's brief asks for a short sentence: a brief that asks for more than the cap holds will overrun it.

A slot has exactly one source: — a fill or a fact, never both. The builders per kind — text.*, number, select, url, address, image, video, tour, document, poi — with list({ label, source, item }) for anything repeating and object({ label, fields }) for fields that belong together, are slots.

The render function is a pure, server-rendered function of its bindings. It receives slot, a map with one binding per declared slot, and lays them out.

Every value is rendered through a Slot.* primitive rather than read off the binding: Slot.Text, Slot.Image, one per kind. That is not a convenience. The editor never sees your component — only the DOM it produced — so the element carrying a value has to be identifiable in the output, and the primitive is what marks it. Reading the raw value instead gets you a check failure, not a silently broken page. That contract is the marker contract.

Section is the section's own root element, and the className strings are ordinary Tailwind utilities over the tokens in globals.css (styling).

fixtures/starter-home.json — the dev data

fixtures/starter-home.json
{
  "$schema": "../.concrete/schema/content-fixture.schema.json",
  "notes": "Dev data: what `concrete dev` renders and `concrete check` grades the template with; none of it reaches the published template. A fixture is a property plus content. properties/starter/ holds the property (its facts and media, copied from the sample library by `concrete property add starter`), and the hero's street and city come from it. The content states what the AI fill writes on the platform: the headline and the hero image. `concrete property list` shows the other sample properties; copy one in and list a second fixture on it.",
  "property": "properties/starter/property.json",
  "content": {
    "hero-1": {
      "slots": {
        "headline": "A brick colonial on a quiet, tree-lined street",
        "hero_image": { "media": "exterior-front" }
      }
    }
  }
}

A fixture is a property plus content — the two things a deliverable has, stated by hand so concrete dev has something to render and concrete check has something to grade. It is data, not code: nothing evaluates it, and the $schema line points your editor at the schema concrete dev writes, so it completes and checks the document as you type.

property is the property document in fixtures/properties/starter/, a path relative to this file, and it is where the hero's street and city come from. content states what a fill would have written, keyed by the instance the page places — hero-1, the first placement of the section whose key is hero: the headline, and which of the property's photographs the hero image is, named by its upload id. Notice it names only the two filled slots — a slot bound to a fact needs no entry, because the property already answers it.

fixtures/index.json beside it is the fixture list template.ts names: every content fixture, in the order the playground offers them. A second fixture is a second file and one more entry there.

Nothing the list reaches is part of a published template: fixtures.

What you learned

  • What template.ts is for. One reserved file at the root of the import graph, carrying identity, format, audience, the site map and the fixture list — the workspace and versioning.
  • What a page is. A composition read once by a probe, holding sections and nothing else — pages and composition.
  • What a section declares. Slots: a type, and one source of value — sections and slots.
  • Where a value comes from. A fill's brief read by a model (AI fill) or a fact ref bound to the property (facts and provenance).
  • Why the markup goes through Slot.*. The editor sees the DOM, not your component — the marker contract.
  • What a fixture is. A property plus content, for dev only — fixtures.

Next

Add a slot — the loop that all of the rest of the work is made of.

On this page