Project bundle workflows
Project bundles provide a portable way to package a project with its media and move it between workspaces. The repository supports two exchange forms: a .freecut.zip bundle for a complete project transfer and a lightweight .freecut.json snapshot for project structure, inspection, and limited sharing. These workflows connect project data, media storage, validation, and the editor UI without treating local media paths as portable identifiers.
Exchange formats
The exchange layer separates complete project transfer from project-data exchange. A ZIP bundle carries the files needed to restore a working local project. A JSON snapshot carries project data and media descriptions but does not carry media content.
Project bundle format
The project bundle is a versioned archive with a manifest, project data, media files, and optional project extras. The manifest records the project identity, media entries, format version, and integrity checksum. Timeline items refer to media through bundle references instead of keeping local preview paths, so an import can create new local media records and rebuild the links. Optional cover art and saved animation presets travel with the archive when present.
The archive uses content hashes as part of media paths. This gives the bundle a stable way to identify file content and helps avoid collisions when different files share a name. The exported filename uses the project name with the .freecut.zip extension.
References: src/…/bundle.ts• L23-87 src/…/bundle-export-service.ts• L102-121 src/…/bundle-export-service.ts• L189-227
Project snapshot format
The project snapshot is a versioned JSON record for exchanging project structure without copying media files. It contains the project, optional media metadata references, the editor version, and an optional checksum. The snapshot is useful when the receiver already has the media or when an engineer needs to inspect or reproduce project state.
References: src/…/snapshot.ts• L11-47 src/…/json-export-service.ts• L24-86
Bundle export workflow
Bundle export starts from the current project and produces a self-contained archive for later import. The editor saves pending changes before export, then shows progress while the export service gathers project data, collects media, packages the archive, and reports the result.
Archive creation
The export service reads the project and its associated media from local storage. It records media metadata and content hashes in the manifest, converts timeline media links to portable references, and adds project data to the archive. A cover image and animation presets are optional additions.
The editor supports two delivery paths. In browsers with the File System Access API, it asks for a save location before opening the export dialog and streams the archive to that file. Otherwise, it builds an in-memory download and offers it from the completed dialog. Both paths use the same bundle contract and progress stages.
References: src/…/bundle-export-service.ts• L73-97 src/…/bundle-export-service.ts• L126-183 src/…/bundle-export-service.ts• L189-227 src/…/editor.tsx• L621-650 src/…/bundle-export-dialog.tsx• L102-163 src/…/bundle-export-service.ts• L257-267 src/…/bundle-export-service.ts• L453-467
Bundle import workflow
Bundle import restores a project into a user-selected local folder. The projects page separates file selection from folder selection so the browser can grant write access during a user action. The import then validates the archive, extracts media, creates new records, rebuilds project links, and opens the restored project in the editor.
This diagram shows how a complete bundle moves from the editor to a new local project.
flowchart LR
A[Current project] --> B[Save pending changes]
B --> C[Create bundle]
C --> D[Select bundle and destination]
D --> E[Validate archive]
E --> F[Write media files]
F --> G[Create new project and media records]
G --> H[Relink timeline media]
H --> I[Open restored project]
Destination selection
The projects page accepts files with the .freecut.zip naming pattern, including browser-added duplicate suffixes. Before import starts, the user selects a writable destination and can place the project under a FreeCutProjects folder. The final project folder uses a safe project name and becomes the root folder for the imported project.
References: src/…/index.tsx• L60-89 src/…/index.tsx• L106-135 src/…/index.tsx• L137-185 src/…/file-system-service.ts• L16-55
Archive restoration
The import service first checks the archive manifest and its required project data. It verifies the manifest checksum and confirms that declared media files exist. It then writes each available media file to the destination, creates new media identifiers, keeps the bundled content hash, and creates thumbnails when possible. A missing thumbnail does not stop the import.
References: src/…/bundle-import-service.ts• L46-73 src/…/bundle-import-service.ts• L75-169 src/…/bundle-import-service.ts• L262-323
Project relinking
After media import, the service creates a new project with a new project identifier and maps each old media identifier to its new local identifier. It applies that map to the main timeline and nested compositions, then associates the new media records with the project. This keeps the restored project independent from the source workspace.
The importer restores the cover image when it is available. It also restores saved animation presets only when the manifest declares the sidecar file. A malformed preset file is ignored after a warning, so optional extras do not make an otherwise usable project unavailable.
References: src/…/bundle-import-service.ts• L172-194 src/…/bundle-import-service.ts• L196-227 src/…/bundle-import-service.ts• L229-243 src/…/bundle-timeline.ts• L6-16 src/…/bundle-timeline.ts• L19-59 src/…/bundle.ts• L39-60
Snapshot workflow
JSON snapshots provide a smaller exchange path for project data. They can be downloaded as files, copied to the clipboard, or imported from either source through the editor's debug tools and debug API. Snapshot import creates a new project by default and tries to connect its media references to media already present in the workspace.
Snapshot validation
Validation checks the JSON shape, project fields, timeline data, media references, and supported snapshot version. It returns errors that block import and warnings that describe compatibility, migration, or checksum concerns. The project schema is also used by headless processing, which keeps project data checks consistent across interactive and non-interactive use.
References: src/…/project-schema.ts• L735-749 src/…/project-schema.ts• L813-821 src/…/project-schema.ts• L838-863 src/…/project-schema.ts• L913-919 src/…/main.ts• L27-37
Snapshot import
Snapshot import can upgrade older project data before it saves the new project. It generates new project and timeline identifiers by default, then matches media in a clear order: exact identifier, content hash, and finally filename with size and type. Matched media links are restored. Unmatched references remain warnings because the snapshot does not contain the missing files.
References: src/…/json-import-service.ts• L134-175 src/…/json-import-service.ts• L177-268 src/…/json-import-service.ts• L276-375
Snapshot exchange points
The debug panel exposes snapshot download, clipboard copy, file import, clipboard import, and validation actions. The debug API exposes the same capabilities to scripts or diagnostic tools, which makes snapshots useful for support and investigation without making them the main media-transfer path.
References: src/…/project-debug-panel.tsx• L110-175 src/…/project-debug.ts• L201-257 src/…/json-import-service.ts• L378-464
Cross-workflow boundaries
The two exchange forms share project validation and storage concepts but have different guarantees. Use a bundle when the destination needs the media files and local file handles. Use a snapshot when the goal is to carry project structure or match it to media that already exists.
| Need | Exchange form | Result |
|---|---|---|
| Move a project with its local media | .freecut.zip bundle | New project and new local media records are created from archive files. |
| Inspect or share project structure | .freecut.json snapshot | Project data and media descriptions move without media content. |
| Reuse media already in a workspace | JSON snapshot import | Existing media can be linked by identifier, hash, or file metadata. |
| Protect a complete archive from silent edits | ZIP manifest checksum | The import rejects a changed manifest or missing declared file. |
For the wider project lifecycle, see Project lifecycle. For the storage model that receives imported projects and media, see Project data and storage.
Change checklist
When these files or sections are changed, remember to consider these:
- Keep the bundle timeline media-reference mapping aligned with the project timeline shape. A renamed media link field can leave imported clips without media even when archive files are present.
- Keep manifest entries and archive paths aligned. The checksum covers the manifest, while the importer separately requires every declared media and declared preset sidecar file.
- Keep snapshot schema fields aligned with migration rules. A schema that accepts data the migration path cannot normalize can turn a warning into an import failure.
- Keep media matching fields stable across export and import. Changes to content hashes, filenames, sizes, or MIME types can change whether a snapshot reuses existing media.
- Keep the browser file-picker flow aligned with the import and export UI. Moving a native picker into a modal can prevent the browser from granting the required folder or file permission.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| The bundle manifest or required project file is missing | Import stops before creating a project. | Archive validation requires both manifest and project data. |
| The manifest checksum does not match | Import rejects the archive as changed or corrupt. | Recompute the checksum before extraction. |
| A declared media file is absent | The archive is invalid or that media cannot be imported. | Validate declared paths and report skipped media during restoration. |
| The user cancels folder selection or lacks write access | Import does not start or cannot write media. | Require a selected writable directory and surface picker errors. |
| A snapshot has invalid structure or cannot be migrated | Snapshot import stops without saving the project. | Run schema validation and migration before project creation. |
| Snapshot media cannot be matched | The project imports with missing media links and a warning. | Match by exact ID, hash, then file metadata. |
| Thumbnail or preset restoration fails | The project still imports without that optional extra. | Treat cover and preset restoration as non-blocking. |
Key files
| File | Why to read it |
|---|---|
| src/…/bundle.ts | Defines the portable archive contract, progress states, and import/export results. |
| src/…/snapshot.ts | Defines the lightweight JSON exchange contract and its media matching options. |
| src/…/bundle-export-service.ts | Shows how a project and its media become a ZIP archive through memory or streaming output. |
| src/…/bundle-import-service.ts | Shows how validation, file extraction, media creation, relinking, and project creation form one restore flow. |
| src/…/bundle-timeline.ts | Defines the boundary between local media links and portable bundle references. |
| src/…/project-schema.ts | Defines the structural checks shared by project and snapshot validation. |
| src/…/json-export-service.ts | Shows the snapshot export and checksum model. |
| src/…/json-import-service.ts | Shows snapshot validation, migration, media matching, and import results. |
| src/…/index.tsx | Shows the user-facing bundle import flow and destination selection. |
| src/…/editor.tsx | Shows how the editor saves before bundle export and chooses the output path. |
| src/…/bundle-export-dialog.tsx | Shows export progress, completion, and error states. |
| src/…/file-system-service.ts | Defines the local folder and file operations used during bundle import. |