LLM Notice: This documentation site supports content negotiation for AI agents. Request any page with Accept: text/markdown or Accept: text/plain header to receive Markdown instead of HTML. Alternatively, append ?format=md to any URL. All markdown files are available at /md/ prefix paths. For all content in one file, visit /llms-full.txt
Skip to main content

Initialize Configuration

The flow init command creates a new Flow project with a basic flow.json configuration file. This is the first step to set up any Flow project.

Basic usage


_10
flow init

This command will:

  • Create a new flow.json configuration file.
  • Set up default networks (emulator, testnet, mainnet).
  • Create an emulator service account.
  • Generate a basic project structure with cadence/ directories.
  • Give you options for project scaffolding.

Project structure

After you run flow init, you'll have:


_10
my-project/
_10
├── flow.json
_10
├── emulator-account.pkey
_10
└── cadence/
_10
├── contracts/
_10
├── scripts/
_10
├── transactions/
_10
└── tests/

Configuration only

If you only want to generate the flow.json file, but not create the full project structure, use the --config-only flag:


_10
flow init --config-only

This is useful when:

  • You already have a project structure.
  • You want to add Flow configuration to a current project.
  • You want to set up configuration for a specific environment.

Global configuration

You can create a global flow.json file that applies to all Flow projects on your system:


_10
flow init --global

Global configuration locations:

  • macOS/Linux: ~/flow.json
  • Windows: C:\Users\$USER\flow.json

Priority order:

  1. Local flow.json (highest priority)
  2. Global flow.json (lowest priority)

Local configuration files will override global settings for properties that overlap.

Error handling

If a flow.json file already exists, you'll see this error:


_10
❌ Command Error: configuration already exists at: flow.json

Solutions:

  • Delete the current flow.json file first.
  • Initialize in a different directory.
  • Use --config-only to create a new config in a different location.

Flags

Configuration only


_10
flow init --config-only

Creates only the flow.json file without project structure.

Global flags

The following global flags are also available:


_10
# Log level
_10
flow init --log debug
_10
_10
# Output format
_10
flow init --output json
_10
_10
# Approve prompts automatically
_10
flow init --yes

Available log levels: debug, info, error, none

Next Steps

After you initialize the configuration:

  1. Review the generated flow.json - Understand the default setup
  2. Add your contracts - Use flow config add contract
  3. Create accounts - Use flow accounts create or flow config add account
  4. Configure deployments - Use flow config add deployment
  5. Start developing - Run flow emulator start