{"id":31662088,"url":"https://github.com/netgen/storyblok-restore","last_synced_at":"2025-10-07T19:48:19.704Z","repository":{"id":314561702,"uuid":"1050489095","full_name":"netgen/storyblok-restore","owner":"netgen","description":"npx CLI tool for restoring full Storyblok spaces from backup files","archived":false,"fork":false,"pushed_at":"2025-09-26T06:12:22.000Z","size":246,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-26T07:21:14.731Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/netgen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"docs/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-09-04T13:58:16.000Z","updated_at":"2025-09-26T06:37:34.000Z","dependencies_parsed_at":"2025-09-13T09:23:02.086Z","dependency_job_id":"5f397843-e926-41e7-b066-146089d5dc4f","html_url":"https://github.com/netgen/storyblok-restore","commit_stats":null,"previous_names":["netgen/storyblok-restore"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/netgen/storyblok-restore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fstoryblok-restore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fstoryblok-restore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fstoryblok-restore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fstoryblok-restore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netgen","download_url":"https://codeload.github.com/netgen/storyblok-restore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netgen%2Fstoryblok-restore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278837785,"owners_count":26054719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-07T19:48:16.712Z","updated_at":"2025-10-07T19:48:19.696Z","avatar_url":"https://github.com/netgen.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Storyblok Restore\n\n[![npm version](https://img.shields.io/npm/v/storyblok-restore.svg)](https://www.npmjs.com/package/storyblok-restore)\n[![license](https://img.shields.io/github/license/netgen/storyblok-restore)](https://github.com/netgen/storyblok-restore/blob/main/LICENSE)\n\nA powerful CLI tool to restore entire [Storyblok CMS](https://www.storyblok.com) spaces from backup files created by [storyblok-backup](https://github.com/webflorist/storyblok-backup).\n\nThis tool handles the complete restoration process including dependency resolution, ID/UUID mapping, reference fixing, and intelligent conflict resolution across all Storyblok resource types.\n\n## Features\n\n- 🔄 **Complete Space Restoration** - Restore entire Storyblok spaces from backup folders\n- 🎯 **Selective Resource Restoration** - Choose specific resource types to restore\n- 🔗 **Dependency Resolution** - Automatically handles resource dependencies and restoration order\n- 🆔 **ID/UUID Mapping** - Manages cross-resource references and ID mappings\n- ⚡ **Smart Conflict Resolution** - Intelligent upsert logic (create-first, update-on-conflict)\n- 📁 **Asset File Support** - Restores both asset metadata and actual files\n- 🔍 **Verbose Logging** - Detailed progress tracking and debugging information\n\n## Prerequisites\n\n- Node.js (v16 or higher)\n- A Storyblok account with Management API access\n- OAuth token from your Storyblok account settings\n- Backup files created by [storyblok-backup](https://github.com/webflorist/storyblok-backup)\n\n## Installation\n\n### Global Installation (Recommended)\n```bash\nnpm install -g storyblok-restore\n```\n\n### Local Installation\n```bash\nnpm install storyblok-restore\n```\n\n### Using npx (No Installation Required)\n```bash\nnpx storyblok-restore\n```\n\n## Usage\n\n### Basic Space Restore\n```bash\nstoryblok-restore space-restore \\\n  --backup-path ./backup \\\n  --token YOUR_OAUTH_TOKEN \\\n  --space YOUR_SPACE_ID\n```\n\n### Environment Variables\nYou can set credentials via environment variables:\n\n```bash\nexport STORYBLOK_OAUTH_TOKEN=\"your_oauth_token\"\nexport STORYBLOK_SPACE_ID=\"your_space_id\"\nexport STORYBLOK_REGION=\"eu\"  # Optional: eu, us, ap, ca, cn\n\nstoryblok-restore space-restore --backup-path ./backup\n```\n\n### Command Options\n\n| Option | Description | Required |\n|--------|-------------|----------|\n| `--backup-path` | Path to the backup folder | ✅ |\n| `--token` | Storyblok OAuth token | ✅* |\n| `--space` | Storyblok space ID | ✅* |\n| `--region` | Region (eu, us, ap, ca, cn) | ❌ |\n| `--resource-types` | Comma-separated list of resource types | ❌ |\n| `--verbose` | Enable detailed logging | ❌ |\n\n*Required unless set via environment variables\n\n## Examples\n\n### Complete Space Restoration\n```bash\n# Restore all resources from backup\nstoryblok-restore space-restore \\\n  --backup-path ./my-backup \\\n  --token $STORYBLOK_OAUTH_TOKEN \\\n  --space $STORYBLOK_SPACE_ID \\\n  --verbose\n```\n\n### Selective Resource Restoration\n```bash\n# Restore only specific resource types\nstoryblok-restore space-restore \\\n  --backup-path ./my-backup \\\n  --token $STORYBLOK_OAUTH_TOKEN \\\n  --space $STORYBLOK_SPACE_ID \\\n  --resource-types \"stories,components,assets\"\n```\n\n### Multi-Region Restoration\n```bash\n# Restore to US region space\nstoryblok-restore space-restore \\\n  --backup-path ./my-backup \\\n  --token $STORYBLOK_OAUTH_TOKEN \\\n  --space $STORYBLOK_SPACE_ID \\\n  --region us\n```\n\n## Supported Resource Types\n\nThe tool can restore the following Storyblok resource types:\n\n- **`webhooks`** - Webhook configurations (secrets must be manually re-added)\n- **`access-tokens`** - API access tokens\n- **`collaborators`** - Space collaborators and permissions\n- **`component-groups`** - Component organization groups\n- **`components`** - Reusable content components\n- **`datasources`** - External data sources\n- **`datasource-entries`** - Data source entries and content\n- **`asset-folders`** - Asset organization folders\n- **`assets`** - Media assets and files\n- **`stories`** - Content pages and entries\n\n## Expected Backup Structure\n\nThe tool expects backup folders created by [storyblok-backup](https://github.com/webflorist/storyblok-backup) with this structure:\n\n```\nbackup/\n├── space-{space_id}.json         # Space configuration\n├── webhooks/                     # Webhook configurations\n│   └── *.json\n├── access-tokens/                # API access tokens\n│   └── *.json\n├── collaborators/                # Space collaborators\n│   └── *.json\n├── component-groups/             # Component groups\n│   └── *.json\n├── components/                   # Content components\n│   └── *.json\n├── datasources/                  # Data sources\n│   └── *.json\n├── datasource-entries/           # Data source entries\n│   └── *.json\n├── asset-folders/                # Asset folders\n│   └── *.json\n├── assets/                       # Asset metadata\n│   └── *.json\n├── asset-files/                  # Actual asset files\n│   └── *.*\n└── stories/                      # Content stories\n    └── *.json\n```\n\n## How It Works\n\n1. **Backup Analysis** - Scans the backup folder structure and validates resources\n2. **Dependency Resolution** - Determines the correct restoration order based on resource dependencies\n3. **Smart Restoration** - Uses intelligent upsert logic:\n   - Attempts to create new resources (fast path for 99.9% of cases)\n   - Detects conflicts and automatically switches to update mode\n   - Finds existing resources and updates them with new data\n4. **Reference Fixing** - Updates cross-resource references and ID mappings\n5. **Asset Handling** - Uploads asset files and links them to asset metadata\n6. **Progress Tracking** - Provides detailed logging and error reporting\n\n## Configuration\n\n### Using .env File\nCreate a `.env` file in your project root:\n\n```env\nSTORYBLOK_OAUTH_TOKEN=your_oauth_token_here\nSTORYBLOK_SPACE_ID=123456\nSTORYBLOK_REGION=eu\n```\n\n## Troubleshooting\n\n\n### Getting Help\n\n- Use the `--verbose` flag for detailed logging\n- Check that your backup structure matches the expected format\n- Ensure all required dependencies are included in the backup\n\n## Acknowledgments\n\nThis tool is designed to work with backups created by [storyblok-backup](https://github.com/webflorist/storyblok-backup) by [@webflorist](https://github.com/webflorist). Special thanks for creating the comprehensive backup solution that makes this restoration tool possible.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](docs/CONTRIBUTING.md) for development setup and guidelines.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetgen%2Fstoryblok-restore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetgen%2Fstoryblok-restore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetgen%2Fstoryblok-restore/lists"}