Skip to content

Configuration ​

Use .env to change how the App runs. Use .goforj.yml to select components and configure the development loop.

Change a Runtime Setting ​

In the Project from Quickstart, stop forj dev and set the default App's HTTP port in .env.

dotenv
API_HTTP_PORT=3001

Start only the HTTP runtime.

bash
forj api

In another terminal, verify the listener returns 200 on the new port.

bash
curl -fsS -o /dev/null -w '%{http_code}\n' http://localhost:3001/-/health
# 200

The HTTP runtime reads the port at startup. Restart it after changing that value. For a running deployment, use maintenance mode to pause HTTP traffic through the live control commands.

Choose the Right Layer ​

ChangeOwnerWhat to do next
Port, URL, secret, active driver, or connection value.env or process environmentRestart the affected process.
Supported driver set or named generated resourceEnvironment configuration plus generated codeRun forj build, then restart.
Selected component, starter kit, additional App, or render option.goforj.ymlRender or build as directed by the feature guide.
Local build, runtime, or watch command.goforj.yml under dev.apps or dev.watchesRestart forj dev.

Edit Local Environment ​

Keep local values and secrets in .env or .env.host. A full render regenerates .env.local. Commit .env.example as the key inventory and .env.testing as the test profile. Process environment variables take precedence. See Environment File Resolution for the exact load order and behavior.

forj dev and forj build initialize a missing .env from .env.example and generate fresh local values for framework signing and diagnostic keys. Use the hidden prompt to enter a local secret.

bash
forj env:set DISCORD_TOKEN

The next build adds the new key to the committed files with a blank value. Add safe shared defaults directly to .env.example. Run forj env:check in CI and review changes to committed environment files for secrets. The Configuration Reference also covers upgrades from an unmanaged .env.testing.

Select a Driver ​

With the cache component enabled, set its supported drivers and choose one at startup.

dotenv
CACHE_SUPPORTED_DRIVERS=memory,redis
CACHE_DRIVER=memory

CACHE_SUPPORTED_DRIVERS determines which cache drivers are compiled into the app. CACHE_DRIVER chooses one of those drivers at startup.

Restart after changing CACHE_DRIVER to a driver already compiled into the App. Run the build when you change CACHE_SUPPORTED_DRIVERS so GoForj can update the generated imports.

bash
forj build

The same pattern applies to storage, queues, events, mail, and databases. See Environment Reference for the complete contract.

Change the Project ​

Keep the Project's existing components when you enable another one. For example, this configuration adds scheduler to the SQLite App.

yaml
render:
  components: [cli, web_api, database_sqlite, scheduler]

Follow Task Scheduling to apply the change and register a task. See Local Development to configure which commands run under forj dev.

When to Rebuild or Restart ​

forj dev rebuilds and restarts configured Apps when it sees relevant source or environment changes. Restart the development loop after changing its own command configuration. Use forj build to rebuild explicitly outside that loop. Build the App explains which changes affect compiled code.

Next Steps ​