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- Define your config in a
foir.config.tsfile using the helper functions - Run
foir pushto send the config to the platform - 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-cliCreate 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 pushThe 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:
| Resource | Description | Learn More |
|---|---|---|
| Models | Content types with typed fields | Defining Models |
| Operations | HTTP endpoints for custom logic | Defining Operations |
| Hooks | Lifecycle event triggers | Defining Hooks |
| Placements | Custom editor UI panels | Editor Placements |
| Schedules | Cron-based operation triggers | Defining Schedules |
| Segments | Rule-based customer groups | Defining Segments |
| Auth Providers | Authentication providers | Configuration 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
- Configuration Reference — Full API reference for all config types and helpers
- Defining Models — Deep dive into model and field definitions
- Push and Remove — How to deploy and tear down configs