Skip to Content
Core ConceptsEntity System

Entities

Everything in Foir is an entity. Pages, blog posts, menus, product descriptions - they’re all entities with different types of content.

What is an Entity?

An entity is a piece of content with:

  • Fields - The actual content (text, images, etc.)
  • Variants - Different versions for different audiences
  • Version history - Track changes and publish when ready

Entity Types

Your project comes with built-in entity types, and you can create custom ones:

Built-in Types

TypeWhat it’s for
PageWeb pages with URL routing
MenuNavigation menus
TemplatePage layouts with content zones

Custom Entity Types

Create your own entity types in Settings > Entity Types:

  1. Give it a name and key (e.g., “Blog Post” / blog-post)
  2. Add fields for your content
  3. Configure how it behaves

Fields

Each entity type has a schema that defines its fields:

Blog Post ├── Title (text, required) ├── Slug (text, required) ├── Featured Image (image) ├── Content (rich text) ├── Author (reference to user) └── Published Date (date)

See Field Types for all available types.

Variants

Every entity can have multiple variants for different audiences:

Homepage ├── Default variant ├── Mobile variant (simplified layout) ├── VIP variant (exclusive offers) └── Holiday variant (seasonal content)

Each variant has its own content and version history. See Variants for details.

Version History

Changes are saved as versions:

  1. Edit - Make changes (saved as draft)
  2. Preview - See how it looks
  3. Publish - Make it live

You can always go back to a previous version or schedule publishing for later.

Reusable Components

Some entity types can be embedded inside other entities. For example, create a “Hero Banner” type with heading, image, and button fields, then use it on any page.

See Inline Schemas for details.

Creating Entities

In the Admin UI

  1. Go to the content section (Pages, Blog Posts, etc.)
  2. Click Create New
  3. Fill in the fields
  4. Click Save Draft or Publish

Via API

mutation { createEntity(input: { modelKey: "blog-post" naturalKey: "my-first-post" content: { title: "My First Post" slug: "my-first-post" content: "..." } }) { id } }

Next Steps

Last updated on