Push and Remove
The foir push and foir remove commands manage the lifecycle of your config on the platform. Push creates or updates resources; remove tears them down.
foir push
Reads your config file, sends it to the platform, and creates or updates all declared resources (models, operations, hooks, placements, schedules, segments).
foir pushHow Discovery Works
By default, foir push looks for a config file in the current directory. It checks the following file names in order:
foir.config.tsfoir.config.jsfoir.config.mjsfoir.config.json
The first file found is loaded and pushed.
Specifying a Config File
Use the --config flag to point to a specific file:
foir push --config ./path/to/my-config.tsForce Reinstall
The --force flag deletes the existing config and all its resources, then recreates everything from scratch:
foir push --forceUse --force when you need a clean slate — for example, if you have renamed model keys or need to reset all records. Without --force, push performs an incremental update.
What Happens on Push
When you run foir push:
- The CLI loads and validates your config file (must have
keyandnamefields) - The config is sent to the platform via the
applyConfigAPI - The platform creates new resources or updates existing ones to match the config
- The CLI prints the resulting config ID and key
Loading foir.config.ts...
Pushing config "my-app" to platform...
Config applied successfully.
Config ID: cfg_abc123
Config Key: my-appIdempotent Updates
Pushing the same config multiple times is safe. The platform reconciles the declared state with the current state:
- New resources are created
- Existing resources are updated to match the config
- Resources not in the config are left unchanged (they are not automatically deleted)
To remove a resource, delete it from your config and push, or use foir remove to tear down the entire config.
foir remove
Removes a config and all resources it provisioned (models, operations, hooks, schedules, placements, segments).
foir remove <key>Where <key> is the config key (the key field from your foir.config.ts).
Confirmation Prompt
By default, foir remove asks for confirmation before deleting:
? Remove config "My App" (my-app)? This will delete all its models, operations,
hooks, and schedules. (y/N)Skipping Confirmation
Use the --force flag to skip the confirmation prompt (useful in CI/CD):
foir remove my-app --forceConfig Lifecycle
A typical config lifecycle follows this pattern:
1. Create
Write your foir.config.ts and push it for the first time:
foir pushAll declared resources are created on the platform.
2. Update
Modify your config (add fields, change operations, add hooks) and push again:
foir pushThe platform updates existing resources to match. New resources are created.
3. Iterate
Continue modifying and pushing as your project evolves. Each push is an incremental update.
4. Remove
When you no longer need the config and its resources:
foir remove my-appAll provisioned resources are deleted.
CI/CD Integration
Use foir push in your deployment pipeline to keep platform resources in sync with your codebase:
# .github/workflows/deploy.yml
name: Deploy Config
on:
push:
branches: [main]
paths: ['foir.config.ts']
jobs:
push-config:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
- run: npm install -g @eide/foir-cli
- name: Push config
env:
FOIR_API_KEY: ${{ secrets.FOIR_API_KEY }}
run: foir pushAuthentication
Both foir push and foir remove require authentication. Use either:
- Interactive login: Run
foir loginandfoir select-projectfirst - API key: Set the
FOIR_API_KEYenvironment variable
See Using Foir CLI for full authentication details.
Next Steps
- Config System Overview — What you can define in a config
- Configuration Reference — Full config API reference
- Using Foir CLI — CLI installation, authentication, and commands