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).
State Files (~/.lightfold/state/<target>.json)
Per-target deployment state tracking.
Target Configuration
Creating Targets
Targets are created automatically during first deployment:Target Naming
Use descriptive target names for different environments:myapp-prod- Productionmyapp-staging- Stagingmyapp-dev- Development
Multiple Targets
Deploy the same project to multiple environments:Provider Configuration
DigitalOcean
Vultr
Hetzner Cloud
BYOS (Bring Your Own Server)
Domain Configuration
Add Domain
Remove Domain
Deployment Configuration
Environment Variables
Set environment variables in config:.env file in project root:
.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:native- Traditional build with nginxnixpacks- Railway’s Nixpacks (auto-detected)dockerfile- Use existing Dockerfile (coming soon)
Builder Priority
Auto-selection order:- Flag (
--builder) - Config (
"builder": "nixpacks") - Auto-detect (Dockerfile → nixpacks → native)
SSH Configuration
SSH Keys
Auto-generated for provisioned servers: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
Use descriptive target names
Use descriptive target names
Name targets by environment:
myapp-prod, myapp-staging, myapp-devKeep secrets in .env files
Keep secrets in .env files
Never commit
.env files to git. Use .gitignore.Use different servers per environment
Use different servers per environment
Don’t mix production and development on same server.
Backup your config
Backup your config
Config is stored in
~/.lightfold/. Back it up regularly.Use sync to recover
Use sync to recover
If state gets corrupted, run
lightfold sync to recover.Config File Locations
| File | Path | Purpose |
|---|---|---|
| Main Config | ~/.lightfold/config.json | Target configuration |
| API Tokens | ~/.lightfold/tokens.json | Provider API tokens |
| State Files | ~/.lightfold/state/<target>.json | Per-target state |
| SSH Keys | ~/.lightfold/keys/ | Generated SSH keys |
Manual Editing
You can manually edit config files, but use caution:lightfold sync after manual edits to ensure consistency.