Skip to main content

Database Backup Guides

This guide set covers an end-to-end flow for backing up databases with the Lighthouse BaaS Go SDK. The reference snippets focus on SQL (PostgreSQL/MySQL), and the Tutorials section adds full, copy-paste recipes for MongoDB, SQLite, Amazon DynamoDB, and Amazon S3.

Requirementsโ€‹

  • Go 1.24+
  • A Lighthouse account and a workspace (you get one free with 5 GB โ€” see Web Portal & Free Workspace)
  • An API key scoped for backup/restore

Install the SDKโ€‹

go get github.com/lighthouse-web3/baas-go-sdk@latest

Imports used throughout these guides:

import (
sdkclient "github.com/lighthouse-web3/baas-go-sdk/client"
sdktypes "github.com/lighthouse-web3/baas-go-sdk/types"
)

End-to-end flowโ€‹

For a solo setup, follow this spine:

  1. Sign in to the portal and use the default free workspace
  2. Create an API key for the Go SDK
  3. Create a database dump (or use the full tutorial for your database)
  4. Upload the dump and manage snapshots

For team setups, add these when needed:

The backup pipelineโ€‹

Backup() runs the full pipeline in one call:

scan โ†’ chunk (FastCDC) โ†’ deduplicate โ†’ compress โ†’ encrypt if configured โ†’ upload packs โ†’ create snapshot

It is incremental โ€” unchanged files reuse existing chunks, so only new data is uploaded (and only new data counts against your storage limit). Restores decrypt encrypted snapshots when you provide the keyfile/passphrase, then reverse the rest of the pipeline and verify integrity against expected chunk hashes before reassembling your files.

Want the fast path?โ€‹

If you just want a working scheduled backup for your database, jump to Tutorials โ†’ Automated backup with scheduling โ€” it combines a dump script, the SDK uploader, and a cron schedule into one automated job.