Skip to content

Extend a built-in Noun

Add properties and Verbs to a Noun the Startup inherits, such as Customer, with one file named for it, and keep every built-in Interface working.

A file in nouns/ named for an inherited Noun refines it. Its properties and Verbs add to the built-in ones, and everything that reads the built-in shape keeps working.

Prerequisites

  • A project from npm create startups with npx startup-builder dev running. The examples use leaseline.app, which sells lease-renewal tracking to small property managers at $29 a month.

Steps

  1. Create nouns/Customer.mdx. The file name is the inherited Noun's name, so it refines Customer instead of declaring a new Noun:

    nouns/Customer.mdx
    ---
    properties:
      units: number
      noticeDays: number
      software: string
    ---
    A Customer is a property manager: the units they manage, their notice lead time, and the software that holds their leases.
  2. Save. The dev server merges the three properties over the built-in ones. $.Customer, the API, the CLI and the MCP tools show them on the preview.

  3. Read a Customer back, own and inherited properties together:

    Terminal
    npx startup-builder show /customers/customer_1
  4. To set a default, write it on the property, noticeDays: { type: number, default: 60 }. Existing Customers read the default until a write sets their own value.

  5. Merge and deploy the Change once its checks pass. Records keep their history: the new properties start empty and never rewrite a past state.

Result

Every Customer carries units, noticeDays and software on every Interface, beside billingEmail, taxIds and the other built-in properties. The billing portal, checkout and Stripe's copy of the Customer read the built-in shape and keep working.

A refining file only adds. It cannot remove or retype an inherited property, and a property with an inherited name fails the parse check with the file and line.

Next steps

  • Nouns: every key a Noun file takes.
  • Naming: how the new properties are spelled on each Interface.
  • Verb functions: the code behind a Verb the file declares.
  • Ship my changes: review, merge and deploy.