Create comprehensive backups of your feature flags and configuration
FlagFlow's export functionality allows you to create complete backups of your feature flag configuration, including schemas, values, and metadata. These exports serve multiple purposes: creating backups, migrating between environments, and maintaining version control of your flag configurations.
Complete Data Export: The export includes all flag definitions, schemas, current values, default values, and type-specific constraints in a single JSON file.
When you export your FlagFlow configuration, the system creates a comprehensive snapshot containing:
The easiest way to create an export is through the FlagFlow web interface:
You can also export programmatically using the REST API:
Note: Export functionality is available without authentication - anyone with network access to your FlagFlow instance can download configuration exports.
# Direct download via curl curl -O http://localhost:3000/migration/export # Save to specific filename curl -o my-backup-$(date +%Y%m%d).json \ http://localhost:3000/migration/export
#!/bin/bash # automated-backup.sh FLAGFLOW_URL="http://localhost:3000" BACKUP_DIR="/path/to/backups" DATE=$(date +%Y%m%d-%H%M%S) ENVIRONMENT="production" # Create backup directory if it doesn't exist mkdir -p "$BACKUP_DIR" # Download backup with timestamp FILENAME="flagflow_backup_{ENVIRONMENT}_{DATE}.json" curl -s "$FLAGFLOW_URL/migration/export" -o "$BACKUP_DIR/$FILENAME" if [ $? -eq 0 ]; then echo "✅ Backup created successfully: $FILENAME" # Optional: Clean up old backups (keep last 30 days) find "$BACKUP_DIR" -name "flagflow_backup_*.json" -mtime +30 -delete else echo "❌ Backup failed!" exit 1 fi
FlagFlow exports create JSON files with a standardized structure that includes all necessary information for backup and migration purposes:
{ "environment": "production", "version": "1.0.0", "createdAt": "2024-08-10T14:30:25.123Z", "flags": { "enable_new_feature": { "description": "Enable the new dashboard feature", "type": "BOOLEAN", "defaultValue": false, "valueExists": true, "value": true }, "max_retries": { "description": "Maximum number of retry attempts", "type": "INTEGER", "defaultValue": 3, "valueExists": true, "value": 5, "minValue": 1, "maxValue": 10 }, "theme_selection": { "description": "UI theme options", "type": "ENUM", "defaultValue": "auto", "valueExists": false, "enumValues": ["light", "dark", "auto"] }, "enabled_features": { "description": "List of enabled feature modules", "type": "TAG", "defaultValue": ["core"], "valueExists": true, "value": ["core", "analytics", "notifications"], "enumValues": ["core", "analytics", "notifications", "chat"], "minCount": 1, "maxCount": 4 }, "ab_test_experiment": { "description": "A/B test for new checkout flow", "type": "AB-TEST", "defaultValue": "A", "valueExists": true, "value": "B", "chancePercentB": 25.0 } } }
Export files follow a consistent naming pattern that includes environment and timestamp information:
# Naming pattern flagflow_migration_{ENVIRONMENT}_{YYYYMMDD-HHMMSS}.json # Examples flagflow_migration_production_20240810-143025.json flagflow_migration_staging_20240810-143025.json flagflow_migration_development_20240810-143025.json
Different flag types include specific properties in the export file to preserve all configuration details:
Flag Type | Additional Properties | Example Value |
---|---|---|
BOOLEAN | None (simple true/false) | true |
INTEGER | minValue , maxValue | 42 |
STRING | maxLength , regexPattern | "hello world" |
ENUM | enumValues array | "option1" |
TAG | enumValues , minCount , maxCount | ["tag1", "tag2"] |
AB-TEST | chancePercentB | "A" or "B" |
Set up automated backups to ensure you always have recent copies of your flag configurations:
# Add to crontab for daily backups at 2 AM 0 2 * * * /path/to/automated-backup.sh # Weekly backups with rotation 0 2 * * 0 /path/to/weekly-backup.sh # Pre-deployment backups # Add to your CI/CD pipeline before deployments curl -o "backup-pre-deploy-$(date +%Y%m%d-%H%M%S).json" \ "$FLAGFLOW_URL/migration/export"
#!/bin/bash # verify-backup.sh - Verify backup file integrity BACKUP_FILE=$1 if [ ! -f "$BACKUP_FILE" ]; then echo "❌ Backup file not found: $BACKUP_FILE" exit 1 fi # Check if file is valid JSON if jq empty "$BACKUP_FILE" 2>/dev/null; then echo "✅ Valid JSON format" else echo "❌ Invalid JSON format" exit 1 fi # Check required fields ENVIRONMENT=$(jq -r '.environment' "$BACKUP_FILE") VERSION=$(jq -r '.version' "$BACKUP_FILE") FLAG_COUNT=$(jq '.flags | length' "$BACKUP_FILE") echo "📊 Backup Summary:" echo " Environment: $ENVIRONMENT" echo " Version: $VERSION" echo " Flag Count: $FLAG_COUNT" if [ "$FLAG_COUNT" -gt 0 ]; then echo "✅ Backup verification successful" else echo "❌ No flags found in backup" exit 1 fi
# Encrypt backup files gpg --cipher-algo AES256 --compress-algo 1 --symmetric \ --output backup.json.gpg backup.json # Upload to secure storage aws s3 cp backup.json.gpg s3://my-flagflow-backups/ \ --server-side-encryption AES256 # Decrypt when needed gpg --decrypt backup.json.gpg > restored-backup.json
After creating your backup export files, you can use them for:
Learn more about using these exports in the Migration and Restore documentation.