Skip to main content

forest init

Set up your development environment in your current project directory. This command configures your local Forest environment, linking your codebase to a project on Forest.

Usage

Options

What it does

forest init is an interactive wizard that:
  1. Authenticates you if you are not already logged in
  2. Selects the Forest project to connect to
  3. Configures your local agent endpoint (host and port)
  4. Creates your Development Environment on Forest
  5. Optionally sets up your database connection
  6. Creates or updates your .env file with the required environment variables
forest init is not meant to create a new project from scratch. If you do not have an existing Forest project yet, create one from the UI first.
Run forest init from your project’s root directory, the same directory where your agent code lives.

Interactive prompts

Authentication

If you are not already logged in, forest init will prompt for your credentials. You can also authenticate beforehand with forest login.

Project selection

If your account is linked to multiple projects, you will be asked to select the one matching your current codebase:
If your account has only one project, this step is skipped automatically.

Endpoint configuration

Forest needs to know where your local agent is running to set up the Development Environment:
Press Enter to accept the default (http://localhost:3310) or provide a custom URL.
Your Development Environment is created as soon as you confirm the endpoint. 🎉

Database configuration (optional)

forest init will offer to set up your DATABASE_URL if it is not already configured:
If you accept, you will be guided through entering your database credentials, which will be written to your .env file.

Environment variables

After a successful forest init, the following variables are added to your .env file:
The FOREST_ENV_SECRET uniquely identifies your Development Environment. Keep this value private and do not share it.

Example

Troubleshooting

Not logged in Run forest login first, or let forest init handle authentication interactively. Project not found Ensure your Forest account has access to the project. Contact your project admin if needed. Endpoint unreachable Make sure your local agent is running before confirming the endpoint. Forest will attempt to reach it during setup.