Skip to Content
Config SystemOverview

Config System

The Foir config system lets you define your project’s resources as code in a foir.config.ts file. Instead of clicking through the admin UI to create models, operations, hooks, and placements one by one, you declare them all in a single TypeScript file and push them to the platform with one command.

Why Config-as-Code?

  • Reproducible — Your entire project setup lives in version control. Spin up identical environments by pushing the same config.
  • Reviewable — Changes go through pull requests just like application code.
  • Portable — Share configs across teams, copy between projects, or publish as extensions.
  • Type-safe — Full TypeScript support with IntelliSense and compile-time validation.

How It Works

foir.config.ts ── foir push ── Platform creates/updates resources
  1. Define your config in a foir.config.ts file using the helper functions
  2. Run foir push to send the config to the platform
  3. The platform creates or updates the models, operations, hooks, placements, schedules, and segments declared in your config

If you later change the config and push again, existing resources are updated to match. To tear everything down, use foir remove <key>.

Quick Start

Install the CLI and create a config file:

npm install -D @eide/foir-cli

Create a foir.config.ts in your project root:

import { defineConfig } from '@eide/foir-cli/configs'; export default defineConfig({ key: 'my-app', name: 'My App', models: [ { key: 'page', name: 'Page', fields: [ { key: 'title', type: 'text', label: 'Title', required: true }, { key: 'slug', type: 'text', label: 'Slug', required: true }, { key: 'body', type: 'content', label: 'Body' }, ], }, ], });

Push it to the platform:

foir push

The platform creates a page model with the declared fields. You can now create records against that model in the editor or via the API.

What You Can Define

A config can include any combination of these resources:

ResourceDescriptionLearn More
ModelsContent types with typed fieldsDefining Models
OperationsHTTP endpoints for custom logicDefining Operations
HooksLifecycle event triggersDefining Hooks
PlacementsCustom editor UI panelsEditor Placements
SchedulesCron-based operation triggersDefining Schedules
SegmentsRule-based customer groupsDefining Segments
Auth ProvidersAuthentication providersConfiguration Reference

Import Path

All helper functions are available from a single import:

import { defineConfig, defineModel, defineField, defineOperation, defineHook, definePlacement, defineSchedule, defineSegment, defineAuthProvider, } from '@eide/foir-cli/configs';

Next Steps

Last updated on