Skip to main content

Configuration Files

Lightfold uses three configuration files:

Main Config (~/.lightfold/config.json)

Target-based configuration storing deployment settings.

API Tokens (~/.lightfold/tokens.json)

Secure API token storage (0600 permissions).
Manage tokens:

State Files (~/.lightfold/state/<target>.json)

Per-target deployment state tracking.

Target Configuration

Creating Targets

Targets are created automatically during first deployment:
Or create explicitly:

Target Naming

Use descriptive target names for different environments:
  • myapp-prod - Production
  • myapp-staging - Staging
  • myapp-dev - Development

Multiple Targets

Deploy the same project to multiple environments:
Each target has independent configuration and state.

Provider Configuration

DigitalOcean

Vultr

Hetzner Cloud

BYOS (Bring Your Own Server)

Domain Configuration

Add Domain

Configuration:

Remove Domain

Reverts to IP-based access.

Deployment Configuration

Environment Variables

Set environment variables in config:
Or use .env file in project root:
Note: .env file is automatically loaded during deployment.

Custom Build Commands

Override auto-detected build commands:

Skip Build

Skip build step (for pre-built apps):

Custom Health Checks

Define custom health check endpoint:

Builder Configuration

Force Builder

Specify builder in config:
Or use flag:
Available builders:
  • native - Traditional build with nginx
  • nixpacks - Railway’s Nixpacks (auto-detected)
  • dockerfile - Use existing Dockerfile (coming soon)

Builder Priority

Auto-selection order:
  1. Flag (--builder)
  2. Config ("builder": "nixpacks")
  3. Auto-detect (Dockerfile → nixpacks → native)

SSH Configuration

SSH Keys

Auto-generated for provisioned servers:
Or specify custom key:

SSH Username

Default username: deploy Override in config:

Config Commands

List Targets

Set Token

Get Token

View Status

Sync Config

Recover from bad state:

Best Practices

Name targets by environment: myapp-prod, myapp-staging, myapp-dev
Never commit .env files to git. Use .gitignore.
Don’t mix production and development on same server.
Config is stored in ~/.lightfold/. Back it up regularly.
If state gets corrupted, run lightfold sync to recover.

Config File Locations

Manual Editing

You can manually edit config files, but use caution:
Tip: Use lightfold sync after manual edits to ensure consistency.