Data Management
Data management provides complete export and import for the current SQLite system. It does not maintain a server-side history of backups.
- Restore is supported only for the same backend implementation, application version, and database schema.
- A file exported by Python can only be imported by Python, and the same applies to Java.
- Exports include every business table, including password hashes, system configuration, AI API keys, SMTP passwords, and audit logs.
- Runtime
app_stateis excluded so old session epochs and layout-lock versions are not restored.
Archive Layout
Section titled “Archive Layout”manifest.jsonschema.sqlchecksums.sha256data/menu_groups.jsonldata/permissions.jsonldata/menu_items.jsonldata/roles.jsonldata/role_permissions.jsonldata/users.jsonldata/system_config.jsonldata/ai_models.jsonldata/ai_model_presets.jsonldata/audit_logs.jsonlmanifest.json records the format version, application version, schema version, backend type, tables, columns, row counts, and checksums. schema.sql is for inspection and audit; import does not execute it directly.
Export Flow
Section titled “Export Flow”- The backend obtains a consistent SQLite snapshot.
- Tables are streamed as JSONL and SHA-256 checksums are generated.
- A cryptographically secure random one-time password is generated.
- The archive is encrypted with AES-256.
- The browser downloads the file and displays the password.
The password is never written to the database, logs, or browser storage. It cannot be displayed again after the dialog closes. If it is lost, generate a new export.
Import Flow
Section titled “Import Flow”- Verify permission and upload the ZIP.
- Validate password, structure, versions, tables, columns, row counts, checksums, and decompression limits.
- Create a one-time
jobTokenand return202. - Every ordinary request returns
503except the import status endpoint. - Restore all business tables in dependency order inside one database transaction.
- Require at least one valid administrator account in the archive.
- Rotate
app_state.session_epochand commit. - Release the freeze; every existing login session is now invalid.
Failure rolls back the transaction and releases the freeze without rotating the session epoch. Success requires everyone to log in again.
Import Status
Section titled “Import Status”Old login tokens are invalid once the database commit completes, so status polling uses the one-time token returned when the job was created:
| Method | Path | Description | Auth |
|---|---|---|---|
| POST | /api/data/export |
Download an encrypted full export | data_management.export |
| POST | /api/data/import |
Upload and create an import job | data_management.import |
| GET | /api/data/import/:id |
Query job status | X-Import-Job-Token |
Large Files and Storage
Section titled “Large Files and Storage”- Export and import use streaming file processing and batch writes rather than loading the full database into memory.
- The default upload limit is 1 GB, with a separate total-uncompressed limit.
- Temporary snapshots, uploads, and archives live under the data directory’s
tmpsubdirectory. - Reserve at least roughly three times the database size in the data volume.
- The generated Nginx configuration disables proxy buffering and relaxes large-file upload and timeout settings.
Security Boundary
Section titled “Security Boundary”The archive contains sensitive credentials and must be protected as a high-sensitivity file. Do not distribute it through chat, email, or public storage. The current design has no server-side backup history, cross-version migration, or cross-backend conversion.
Frontend Pages
Section titled “Frontend Pages”- React:
src/pages/settings/data-management/index.tsx - Vue:
src/pages/settings/DataManagement/index.vue