mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
7.2 KiB
7.2 KiB
Package Import/Export Guide
Overview
The MetaBuilder Package Import/Export system allows you to package and share complete applications, features, or database snapshots as ZIP files. This enables modular development and easy distribution of pre-built functionality.
Features
Export Capabilities
-
Custom Package Export
- Create reusable packages with selected components
- Include or exclude specific data types
- Add metadata (name, version, author, description, tags)
- Automatic README generation
-
Database Snapshot Export
- Complete backup of entire database
- One-click export with timestamp
- Includes all schemas, pages, workflows, scripts, and configurations
-
Selective Export Options
- ✅ Data schemas
- ✅ Page configurations
- ✅ Workflows
- ✅ Lua scripts
- ✅ Component hierarchies
- ✅ Component configurations
- ✅ CSS classes
- ✅ Dropdown configurations
- ✅ Seed data
- ✅ Assets (images, videos, audio, documents)
Import Capabilities
-
Package Installation
- Import packages from ZIP files
- Automatic validation of package structure
- Merge with existing data
- Asset restoration
-
Safety Features
- Package validation before import
- Non-destructive merging (adds to existing data)
- Import warnings and confirmations
ZIP Package Structure
package-name-1.0.0.zip
├── manifest.json # Package metadata
├── content.json # Database content
├── README.md # Auto-generated documentation
└── assets/ # Asset files
├── asset-manifest.json
├── images/
│ └── *.png, *.jpg, *.svg
├── videos/
│ └── *.mp4, *.webm
├── audios/
│ └── *.mp3, *.wav
└── documents/
└── *.pdf, *.txt
manifest.json
{
"id": "pkg_1234567890",
"name": "My Package",
"version": "1.0.0",
"description": "Package description",
"author": "Your Name",
"category": "social",
"icon": "📦",
"screenshots": [],
"tags": ["tag1", "tag2"],
"dependencies": [],
"createdAt": 1234567890,
"updatedAt": 1234567890,
"downloadCount": 0,
"rating": 0,
"installed": false
}
content.json
{
"schemas": [...],
"pages": [...],
"workflows": [...],
"luaScripts": [...],
"componentHierarchy": {...},
"componentConfigs": {...},
"cssClasses": [...],
"dropdownConfigs": [...],
"seedData": {...}
}
Usage
Exporting a Package
- Navigate to Level 4 (God Panel) or Level 5 (Super God Panel)
- Open Package Manager
- Click Export button
- Choose export type:
- Custom Package: Configure metadata and select what to include
- Full Snapshot: Export everything instantly
- For custom packages:
- Fill in package name (required)
- Add version, author, description
- Add tags for searchability
- Select export options (checkboxes)
- Click Export Package
- ZIP file will download automatically
Importing a Package
- Navigate to Level 4 (God Panel) or Level 5 (Super God Panel)
- Open Package Manager
- Click Import button
- Click the upload area or drag a ZIP file
- Package will be validated and imported
- Success message shows what was imported
- Refresh the page if needed to see new content
Pre-Built Packages
The system comes with several pre-built packages in the Package Catalog:
1. Classic Forum 💬
- Discussion threads and categories
- User profiles and moderation
- Schema: ForumCategory, ForumThread, ForumPost
2. Retro Guestbook 📖
- 90s-style visitor messages
- Custom backgrounds and GIFs
- Schema: GuestbookEntry
3. Video Platform 🎥
- Video upload and streaming
- Comments, likes, subscriptions
- Schema: Video, VideoComment, Subscription, Playlist
4. Music Streaming Platform 🎵
- Artists, albums, tracks
- Playlists and playback
- Schema: Artist, Album, Track, MusicPlaylist
5. Retro Games Arcade 🕹️
- Game collection with high scores
- Leaderboards and achievements
- Schema: Game, HighScore, Achievement, UserAchievement
6. E-Commerce Store 🛒
- Product catalog and inventory
- Shopping cart and orders
- Schema: Product, Cart, Order
Best Practices
For Package Authors
- Descriptive Naming: Use clear, descriptive package names
- Versioning: Follow semantic versioning (major.minor.patch)
- Documentation: Add comprehensive descriptions and tags
- Dependencies: List any required packages
- Testing: Test your package before distribution
- Assets: Include all necessary assets in the package
For Package Users
- Backup First: Export a database snapshot before importing new packages
- Review Contents: Check package contents in Package Manager before installing
- Test in Development: Test new packages in a development environment first
- Check Conflicts: Be aware of potential schema or page ID conflicts
- Documentation: Read the package README for setup instructions
API Reference
Export Functions
import { exportPackageAsZip, downloadZip } from '@/lib/package-export'
// Export a custom package
const blob = await exportPackageAsZip(manifest, content, assets, options)
downloadZip(blob, 'package-name.zip')
// Export database snapshot
const blob = await exportDatabaseSnapshot(
schemas,
pages,
workflows,
luaScripts,
componentHierarchy,
componentConfigs,
cssClasses,
dropdownConfigs,
assets
)
Import Functions
import { importPackageFromZip } from '@/lib/package-export'
// Import from ZIP file
const { manifest, content, assets } = await importPackageFromZip(zipFile)
Troubleshooting
Import Fails
- Invalid ZIP: Ensure the ZIP file has the correct structure
- Missing manifest.json: Package must include a manifest file
- Missing content.json: Package must include content data
- Corrupted File: Try re-downloading or re-exporting the package
Export Fails
- No Package Name: Package name is required for custom exports
- No Data: Ensure your database has data to export
- Browser Memory: Large exports may fail on low-memory devices
Assets Not Working
- Path Issues: Asset paths are preserved from the original location
- Missing Files: Ensure all assets were included during export
- Format Support: Only specific formats are supported (see structure above)
Future Enhancements
Planned features for future versions:
- 🔄 Package versioning and updates
- 🔍 Package marketplace/registry
- 🔐 Package signing and verification
- 📦 Dependency resolution
- 🎨 Custom package icons
- 📸 Package screenshots
- 💬 Package reviews and ratings
- 🔗 Remote package installation via URL
- 📊 Package analytics
Support
For issues or questions:
- Check the console for error messages
- Verify ZIP file structure
- Ensure you have the latest version of MetaBuilder
- Review this documentation for proper usage
Note: The import/export system is designed to be non-destructive. Imported data is merged with existing data rather than replacing it. Always backup your database before major imports.