Configuration
GoForj separates Project configuration from runtime environment configuration.
.goforj.ymldescribes what the Project contains and how local development runs it..envfiles and process environment variables describe how an app behaves when it starts.
Most first changes belong in .env. Change .goforj.yml when you are changing the Project itself.
Change a Runtime Setting
Set the default app's HTTP port in .env:
API_HTTP_PORT=3001Start the HTTP runtime:
forj apiIn another terminal, verify the change:
curl http://localhost:3001/-/healthExpected result: the API listens on port 3001 and the health request succeeds.
Runtime settings are read during startup. Restart a running app after changing its environment; this port change does not require regeneration or a rebuild.
Choose the Right Layer
| Change | Owner | What to do next |
|---|---|---|
| Port, URL, secret, active driver, or connection value | .env or process environment | Restart the affected process. |
| Supported driver set or named generated resource | Environment configuration plus generated code | Run forj build, then restart. |
| Selected component, starter kit, additional-app metadata, or render option | .goforj.yml | Render or build as directed by the feature guide. |
| App development lifecycle | .goforj.yml under dev.apps | Restart forj dev. |
| Independent local watch command | .goforj.yml under dev.watches | Restart forj dev. |
Use configuration for deployment policy and infrastructure choices. Keep business behavior in services, routes, jobs, schedules, or lifecycle hooks.
Edit Local Environment
A Project can include:
.envfor the main local configuration.env.localfor local environment overrides.env.hostfor host-specific local infrastructure values.env.examplefor the safe, committed inventory
Local environment files are ignored by Git; .env.example is the deliberate exception. Commit that inventory with secrets blank or replaced by safe placeholders, and supply deployment secrets through the process environment or a secret manager.
The Environment Reference owns the complete variable list and naming rules. Configuration Reference defines file precedence and process-environment behavior.
Select a Driver
Driver-backed resources separate compiled support from the active runtime choice:
CACHE_SUPPORTED_DRIVERS=memory,redis
CACHE_DRIVER=memoryCACHE_SUPPORTED_DRIVERS determines which cache drivers are compiled into the app. CACHE_DRIVER chooses one of those drivers at startup.
Changing only CACHE_DRIVER to a driver already in the supported set needs a restart, not regeneration. Adding a driver to CACHE_SUPPORTED_DRIVERS changes generated imports and requires:
forj buildThe same pattern applies to storage, queues, events, mail, and databases. See Environment Reference for the complete contract.
Change the Project
.goforj.yml records durable Project choices such as selected components and additional-app metadata:
render:
starter_kit: none
components: [cli, web_api, database_mysql, scheduler, jobs]It also owns forj dev lifecycle configuration. Do not copy watcher or lifecycle recipes from this beginner page: use forj dev for the workflow and Configuration Reference for every accepted key.
When to Rebuild or Restart
Use this rule:
- Restart when a startup-time value changes.
- Rebuild when the change affects generated Go code, compiled drivers, named generated accessors, or Wire inputs.
- Restart
forj devwhen its.goforj.ymllifecycle graph changes.
During a normal forj dev session, configured app builds run automatically after matching source or environment changes. Use forj build when working outside that loop or when you want one explicit generation, Wire, API index, and binary build.
Next Steps
- Configuration Reference lists
.goforj.yml, environment resolution, and build-time configuration behavior. - Environment Reference lists every public environment variable.
- forj dev explains local build, frontend, runtime, and custom-watch lifecycles.
- Code Generation explains generated ownership and rebuild boundaries.