Skip to content

fcdev day to day

The everyday commands for running the platform on your machine. The tutorial Install and run fcdev covers installing and the first start; the fcdev CLI reference lists every command and flag.

Terminal window
fcdev # same as fcdev start; Ctrl+C stops it
fcdev stop # from another terminal: graceful stop, then the embedded database

fcdev stop reads the PID file fcdev writes while it runs (<data dir>/flowcatalyst/fcdev.pid; --pid-file or FC_DEV_PID_FILE moves it), sends the stop signal, waits up to 20 seconds (--timeout), and only then kills the process. A closed terminal stops fcdev the same way, so the embedded PostgreSQL and the ingestor child are never left running on their own.

Switch parts off when you do not need them, or to keep a laptop quiet:

Terminal window
fcdev --ingestor=false --functions=false # no Java child, no function runner
fcdev --router=false # events are stored and fanned out, nothing is delivered

Every flag has an environment-variable form (FC_INGESTOR_ENABLED, FC_FUNCTIONS_ENABLED, FC_ROUTER_ENABLED, …), which is convenient in a shell profile or a make target.

Each instance needs its own ports, its own data directory and its own PID file:

Terminal window
fcdev --api-port 8180 --metrics-port 9190 --embedded-db-port 15433 \
--functions-port 8195 --functions-public-port 8196 --ingestor-port 8191 \
--embedded-db-path ~/fcdev-b/embedded-pg --pid-file ~/fcdev-b/fcdev.pid

Stop it with fcdev stop --pid-file ~/fcdev-b/fcdev.pid. The fcdev fn credential file is shared between instances (the last one started wins); see isolated runs below.

Terminal window
fcdev init --code orders --name "Orders"

Run in your project directory while fcdev is running. It creates the application, reuses or creates the default client, provisions the application’s service account (role platform:application-service, confined to this application) with an OAuth client, and writes FLOWCATALYST_BASE_URL, FLOWCATALYST_APP_CODE, FLOWCATALYST_CLIENT_ID, FLOWCATALYST_CLIENT_SECRET, FLOWCATALYST_SIGNING_SECRET (the HMAC secret the platform signs its deliveries to the application with), FLOWCATALYST_WEBHOOK_AUTH_TOKEN (the bearer token it sends with them) and FLOWCATALYST_APP_KEY into ./.env. Existing keys are rewritten in place, others appended; a secret that had a different value keeps the old one in a # replaced by fcdev init: comment line above it. The secrets are shown only there, so there is no separate step to fetch the signing secret.

Flag Default Use
--code, --name prompted The application’s code (a URL-safe slug) and name
--app-type APPLICATION INTEGRATION for an application that only moves data (ingestions)
--description, --default-base-url prompted, optional The application’s description and deployed base URL
--client-identifier, --client-name default, Default Client The client to reuse or create
--api-base-url http://localhost:8080 What goes into FLOWCATALYST_BASE_URL
--root . Where the .env is written
--regenerate-signing-secret off For an application that already exists: replace its service account’s signing secret and write the new one to .env
--yes off Never prompt; fail when a required value is missing (for scripts)

init refuses an application code that already exists, and writes nothing. To re-create it, run fcdev fresh --yes first (which removes every application), or pick another code. For an application that exists but whose signing secret is not in .env, use --regenerate-signing-secret: a running copy of the application that verifies with the old secret refuses every delivery until it is restarted with the new one.

Command Removes Keeps
fcdev fresh --yes Every row in FlowCatalyst’s tables Schema, migration history, tables that are not FlowCatalyst’s (an application database on the same server)
fcdev --embedded-db-reset The whole database cluster, every database in it Downloaded binaries and caches
fcdev db upgrade The cluster, after moving it to a timestamped backup (unless --no-backup) The backup

fcdev fresh runs the seed again, so you can sign in as the bootstrap administrator straight away. Because it removes applications and their service accounts, run fcdev init again afterwards and update .env. Run fresh while fcdev is stopped, or pass --database-url to work on a running database.

An application writes its events, dispatch jobs and audit rows to an outbox_messages table in its own database. fcdev outbox is the relay that sends those rows to the platform; you run it beside the application, in development and in production. It polls PostgreSQL, or MySQL 8.0+ and MariaDB 10.6+. See the transactional outbox for how it claims, orders and retries rows.

Terminal window
fcdev outbox create-table # once: create outbox_messages (Postgres or MySQL; see below)
fcdev outbox # run the relay

Both read ./.env first (--env-file names another file); variables already in the environment win over the file, and flags win over both.

Setting Flag Variable Default
Application database --source-db-url FC_OUTBOX_SOURCE_DB_URL required: a PostgreSQL URL, or a mysql:// or mariadb:// URL or Go MySQL DSN that names the database
Platform URL --target-url FC_OUTBOX_PLATFORM_URL http://localhost:8080
Service-account credentials --client-id, --client-secret FC_OUTBOX_CLIENT_ID / FC_OUTBOX_CLIENT_SECRET, falling back to FLOWCATALYST_CLIENT_ID / FLOWCATALYST_CLIENT_SECRET from fcdev init’s .env
Token endpoint --token-url FC_OUTBOX_TOKEN_URL <platform URL>/oauth/token
Narrower token scope --scope FC_OUTBOX_SCOPE none
Static token instead of credentials --auth-token FC_OUTBOX_PLATFORM_AUTH_TOKEN none
Rows per poll, requests in flight, idle poll interval --batch-size, --max-in-flight, --poll-interval-ms FC_OUTBOX_BATCH_SIZE, FC_OUTBOX_MAX_IN_FLIGHT, FC_OUTBOX_POLL_INTERVAL_MS the relay’s defaults
Largest request body --max-request-bytes FC_OUTBOX_MAX_REQUEST_BYTES 8 MiB
Create the table at start --init-schema FC_OUTBOX_INIT_SCHEMA true
Leader election --leader, --leader-lease-ms FC_OUTBOX_LEADER, FC_OUTBOX_LEADER_LEASE_MS true, 5000
Health endpoint --health-addr FC_OUTBOX_HEALTH_ADDR 127.0.0.1:9180 (off disables it)

With credentials it mints and refreshes its own token (the start-up log says auth=client_credentials); with neither credentials nor a token it runs unauthenticated and the platform refuses its batches. The kind of database is read from the URL; FC_OUTBOX_DB_TYPE=postgres|mysql overrides it. create-table creates the table for either (--db-type postgres|mysql), and also the MongoDB collection and the SQLite table (--db-type mongodb|sqlite) for applications whose rows the fc-server outbox subsystem sends (FC_OUTBOX_BACKEND=postgres|mysql|mongo|sqlite); fcdev outbox itself does not poll those two.

Any number of fcdev outbox relays may run against one outbox, for example one beside each task of the application. By default (FC_OUTBOX_LEADER=true) they elect a leader through a lock held in the source database: only the leader claims and sends, and the others stand by and take over within seconds when it goes, so a message group’s order is kept. --leader=false turns the election off, for a deployment that guarantees one relay some other way. On MySQL or MariaDB every relay must reach the same server (the primary).

  • Health. Each relay serves GET /health on --health-addr (default 127.0.0.1:9180), and fcdev outbox health asks it and exits 0 when healthy and 1 when not, which suits a container health check (["CMD", "/fcdev", "outbox", "health"]). Two relays on one machine need different --health-addr values, or off: a port that is taken is a start-up error. A relay that cannot carry on exits with status 1.
  • The table comes from the application. When the application’s own migrations create outbox_messages, start the relay with --init-schema=false: it then runs no DDL and waits for the table. Otherwise a relay started beside the application can create the table first and the application’s first migration fails with relation "outbox_messages" already exists.
  • Large rows. --max-request-bytes caps a request body (default 8 MiB). Keep it at or under half the platform’s FC_INGEST_BATCH_MAX_BYTES.
  • Image. The release workflow builds the fcdev binary alone as ghcr.io/flowcatalyst/fcdev (docker run -e FC_OUTBOX_SOURCE_DB_URL=... -e FC_OUTBOX_PLATFORM_URL=... ghcr.io/flowcatalyst/fcdev outbox), for an application whose own image has no fcdev. A package pushed by the workflow is private until its owner makes it public, so log in to ghcr.io if the pull is refused.

fcdev updates publishes and manages over-the-air updates of Expo phone apps (signing keys, updates, rollouts, Android binaries and install links). See ship over-the-air updates to a phone app.

fcdev logs JSON lines to standard error, one object per line, at info by default. Set FC_LOG_LEVEL to debug, warn or error to change the level:

Terminal window
FC_LOG_LEVEL=debug fcdev 2> fcdev.log
jq -r 'select(.level=="ERROR") | "\(.time) \(.msg) \(.err // "")"' fcdev.log

Useful places to look besides the log:

  • the console’s Events, Dispatch jobs and Audit log pages, and each dispatch job’s attempts;
  • emails (password resets, invitations, PINs), which are written to the log when no SMTP server is configured;
  • fcdev ingestor status, which shows the ingestor runtime’s Java, jar, process and health; its own log is in its state directory under <data dir>/flowcatalyst/fcdev-ingestor/;
  • metrics at http://localhost:9090/metrics.

fcdev creates a local, read-only MCP credential on every start, so an AI coding agent can browse your event types, schemas and subscriptions:

Terminal window
fcdev mcp # stdio transport, for agents that start the server themselves
fcdev mcp --http 127.0.0.1:8090 # streamable HTTP
fcdev --mcp # or run the HTTP server inside fcdev

See MCP server and MCP tools.

Terminal window
fcdev upgrade # download and replace the binary when a newer release exists
fcdev upgrade --check # only report
fcdev upgrade --force # reinstall the current release
fcdev --version

upgrade uses the same release archives as the install scripts, checks the SHA-256, and replaces the binary in place. Stop fcdev first and start it again afterwards; the new version applies its migrations on start.

When the embedded PostgreSQL changes major

Section titled “When the embedded PostgreSQL changes major”

A new fcdev can embed a newer PostgreSQL major version (it embeds PostgreSQL 18 today). A cluster created by an older major cannot be opened by a newer server, and fcdev stops with a message saying so instead of starting. Then:

Terminal window
fcdev stop
fcdev db upgrade # backs up the old cluster, initialises a new one, migrates and seeds
fcdev

The embedded distribution ships no pg_dump or pg_upgrade, so db upgrade does not copy data across: the new cluster starts with the seed only. A development database is meant to be reproducible from migrations, seed and your own scripts. To recover something specific, point a PostgreSQL of the old major at the backup directory.

fcdev start writes local credential files that other fcdev commands read (the fcdev fn CLI credential and the MCP credential, in the user cache directory). A second, throwaway fcdev (for end-to-end tests, say) would overwrite them. Give such a run its own HOME (or its own FC_FN_CLI_CREDENTIALS_PATH and FC_MCP_CREDENTIALS_PATH) as well as its own ports and data directory. Run an isolated platform for end-to-end tests covers the full recipe.