Skip to content
SHC Docs

Export module

Source: modules/export/.

CLI
Subcommands2
HTTP endpointssee the route reference
Events emitted
Error codessee the error code reference
Service classesExporterLoader, ExportService, ImportService
Cross-module depsapp, job, node, stack
modules/export/
├── archive.go
├── command.go
├── errors.go
├── router.go
├── runner.go
├── service.go
├── types.go
└── commands/

Routes are listed in the generated route reference; request/response notes live in the API reference.

Typed errors are catalogued in the error code reference with HTTP statuses and message templates.

The export module owns selective, schema-driven data export and import — taking a declared subset of a stack’s state (configs, secrets, app data) out to a transportable archive, and bringing it back in somewhere else.

ExportService builds the archive; ExporterLoader discovers the *.exporter.yaml files that describe what to export. This is distinct from backup (which is a Restic-based full-data snapshot with deduplication) and from clone (which is an orchestrated stack duplication). export is the lightweight, typed, human-curated option.

AR archive structure:

{id}.exp (AR archive)
├── metadata.json # ExportMetadata
└── data.tar.gz # Exported files
FieldDescription
idUnique artifact identifier
exporterName of the exporter used
stackSource stack name
tenantTenant name
environmentEnvironment name
timestampCreation time (ISO 8601)
versionFormat version
paramsExporter-specific parameters
data.checksumSHA256 of data.tar.gz
data.sizeSize of data.tar.gz in bytes

The --wrap flag allows importing external files as artifacts without running an export:

Terminal window
# Import a Keycloak realm export
shc import mystack /path/to/realm.json --wrap keycloak/realms
# Import a database dump
shc import mystack /backup/dump.sql --wrap postgres/dump

Wrapped artifacts include additional tracking fields:

FieldDescription
source"wrapped" (vs "exported" for normal)
wrapped_fromOriginal file/directory path
wrapped_byUser who created the wrap
wrapped_atWrap timestamp (ISO 8601)

See Backup Module - Wrap Import for full details.