Export and Import
Run these commands from a Jant project directory where `@jant/core` is installed. In a site created with `create-jant`, that usually means the project root.
Choose the Right Tool
| Need | Use this |
|---|---|
| Move content into another Jant site | site export and site import |
| Create a portable static archive | site export |
| Restore content with the same internal IDs and storage keys | site snapshot export and site snapshot import |
| Export raw database SQL | db export |
site export is for portability.
site snapshot is for recovery.
They are not the same thing.
Site Export
site export produces a Zola-compatible export as a ZIP file or directory.
Use it when you want to:
- move content to another Jant site
- inspect a static export locally
- keep a portable archive of your published structure
By default, Jant localizes referenced media into the export so the archive is more self-contained.
When the export comes from Jant, config.toml also keeps Jant-specific metadata for round-trip imports, including header navigation and the collections directory structure (collection order, dividers, and custom links).
Export the Local Site
npx jant site export --output ./jant-site-export.zip
Export directly to a directory when you want to inspect the generated site:
npx jant site export --directory ./jant-site
cd ./jant-site && zola serve
Export a Remote Site
Create an API token in Settings > API Tokens, then:
export JANT_API_TOKEN=jnt_your_token
npx jant site export --url https://your-site.example --output ./jant-site-export.zip
You can also pass --token, but JANT_API_TOKEN is easier to reuse.
Site Import
site import reads a site export directory or ZIP and imports it into Jant.
Use it when you want to:
- migrate from one Jant site to another
- restore content from a portable export
- preview an import before touching a real site
Important rules:
- import expects an empty target site
- slug or alias conflicts stop the import
--dry-runvalidates the archive without writing anything
Dry Run an Import
npx jant site import --path ./jant-site-export.zip --dry-run
Import into the Local Site
npx jant site import --path ./jant-site-export.zip
Import into a Remote Site
export JANT_API_TOKEN=jnt_your_token
npx jant site import --url https://your-site.example --path ./jant-site-export.zip
Skip media transfer when you only want post and collection data:
npx jant site import --path ./jant-site-export.zip --skip-media
Site Snapshots
site snapshot export and site snapshot import preserve Jant's internal IDs, storage keys, and object files.
Use snapshots when you want round-trip-safe recovery rather than content migration.
What a Snapshot Includes
A snapshot includes the content and presentation data Jant needs to restore a site's published structure, including:
- posts
- collections
- collection directory items
- navigation items
- media records
- path registry entries
- the referenced storage objects themselves
Snapshot import does not replace auth and shell data such as users, sessions, and API tokens.
Export a Snapshot
Local:
npx jant site snapshot export --output ./jant-site-snapshot.zip
Remote Cloudflare D1:
npx jant site snapshot export --remote --config ./wrangler.toml --output ./jant-site-snapshot.zip
Import a Snapshot
Snapshot import currently requires --replace.
Local:
npx jant site snapshot import --path ./jant-site-snapshot.zip --replace
Remote Cloudflare D1:
npx jant site snapshot import --remote --config ./wrangler.toml --path ./jant-site-snapshot.zip --replace
Remapping Site IDs
In single-site mode, Jant automatically remaps a snapshot to the only initialized site.
If you intentionally want to load one site's content into another existing site container, use:
npx jant site snapshot import --path ./jant-site-snapshot.zip --replace --remap-site
Use --remap-site only in trusted workflows where you understand the consequences.
Database Export
db export writes raw SQL for the current database.
Use it when you want to:
- inspect the database contents
- keep a SQL dump alongside other backups
- move data into your own operational tooling
Local:
npx jant db export --output ./jant-export.sql
Remote Cloudflare D1:
npx jant db export --remote --output ./jant-remote.sql
A raw SQL export is not a full Jant backup by itself. You still need your media files.
Related Reading
- GitHub Sync — automatic content backup and bidirectional editing via a GitHub repository
- Backups and Recovery
- API Reference