{"id":49869189,"url":"https://github.com/suhlig/sqlite-vault","last_synced_at":"2026-05-15T04:38:06.823Z","repository":{"id":353798779,"uuid":"1218314131","full_name":"suhlig/sqlite-vault","owner":"suhlig","description":"Encrypted SQLite backup to S3-compatible storage with scheduled retention","archived":false,"fork":false,"pushed_at":"2026-04-25T15:53:09.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-25T17:19:52.981Z","etag":null,"topics":["age-encryption","backup","restore","retention","sqlite"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suhlig.png","metadata":{"files":{"readme":"README.markdown","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-22T18:47:23.000Z","updated_at":"2026-04-25T15:08:56.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/suhlig/sqlite-vault","commit_stats":null,"previous_names":["suhlig/sqlite-vault"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/suhlig/sqlite-vault","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhlig%2Fsqlite-vault","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhlig%2Fsqlite-vault/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhlig%2Fsqlite-vault/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhlig%2Fsqlite-vault/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suhlig","download_url":"https://codeload.github.com/suhlig/sqlite-vault/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suhlig%2Fsqlite-vault/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33054106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-13T13:14:54.681Z","status":"online","status_checked_at":"2026-05-15T02:00:06.351Z","response_time":103,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["age-encryption","backup","restore","retention","sqlite"],"created_at":"2026-05-15T04:38:05.846Z","updated_at":"2026-05-15T04:38:06.809Z","avatar_url":"https://github.com/suhlig.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQLite Vault\n\nEncrypted SQLite backup to S3-compatible storage with scheduled retention.\n\n# Overview\n\nSQLite Vault provides a simple, secure way to backup SQLite databases with:\n\n- **Encryption**: Uses [age](https://github.com/FiloSottile/age) with scrypt for symmetric encryption\n- **S3-Compatible Storage**: Stores encrypted backups in any S3-compatible object store (AWS S3, MinIO, Backblaze B2, etc.)\n- **Smart Retention**: Automatically creates hourly, daily, weekly, and yearly backups with intelligent naming\n- **Scheduled Backups**: Built-in scheduler for running backups at configurable intervals\n\n# Features\n\n- Backup SQLite databases using `VACUUM INTO` for consistent snapshots\n- Encrypt backups with age (scrypt passphrase-based encryption)\n- Upload to S3-compatible storage via MinIO client\n- Automatic cleanup of temporary files\n- Context-aware operations with timeouts\n- Structured logging via `log/slog`\n\n# Installation\n\n```bash\ngo get github.com/suhlig/sqlite-vault\n```\n\n# Quick Start\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"log\"\n\t\"time\"\n\n\t\"github.com/minio/minio-go/v7\"\n\t\"github.com/minio/minio-go/v7/pkg/credentials\"\n\t\"github.com/suhlig/sqlite-vault\"\n)\n\nfunc main() {\n\tminioClient, err := minio.New(\"s3.amazonaws.com\", \u0026minio.Options{\n\t\tCreds:  credentials.NewStaticV4(\"ACCESS_KEY\", \"SECRET_KEY\", \"\"),\n\t\tRegion: \"us-east-1\",\n\t\tSecure: true,\n\t})\n\nif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tstore, err := backup.NewMinioStore(minioClient, \"my-backups\")\n\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tsvc := backup.NewService(\"file:mydb.sqlite\", store).\n\t\tWithObjectPrefix(\"myapp\").\n\t\tWithObjectPrefix(\"backups\")\n\n\n  svc, err = svc.WithPassphrase(\"my-secret-passphrase\")\n\n  if err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tscheduler := backup.NewScheduler(svc.BackupFunc)\n\n  if err := scheduler.Start(context.Background()); err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tselect {} // block exiting unless something else already is\n}\n```\n\n# Backup Naming Convention\n\nBackups are automatically named based on when they are created:\n\n| Time | Example Name |\n|------|--------------|\n| Hourly (any hour except 4 AM) | `myapp.hourly-09.db.age` |\n| Daily (4 AM, Mon-Sat) | `myapp.daily-Monday.db.age` |\n| Weekly (4 AM on Sunday) | `myapp.weekly-10.db.age` |\n| Yearly (4 AM on last Sunday of year) | `myapp.yearly-2024.db.age` |\n\n# Retention\n\nThe backup system uses a naming scheme that automatically manages retention by overwriting the last backup in the cycle:\n\n- **Daily Backups**: Files are named with the day of the week (e.g., `Monday.db`, `Tuesday.db`, etc.). This ensures that there's always a backup for each of the last 7 days. When a new backup is created on a given day, it overwrites the backup from the previous week.\n\n- **Weekly Backups**: Files are named with the ISO week number (e.g., `week-01.db`, `week-02.db`, ..., `week-53.db`). This maintains a backup for each of the last 53 weeks. When a new year begins and week numbers restart, the previous year's weekly backup for that week number is overwritten.\n\nThis naming strategy provides a simple and effective retention policy without requiring explicit deletion of old backups. Recent data has daily granularity, while older data is preserved with weekly granularity for up to a year.\n\nMake sure the S3 bucket has versioning disabled; otherwise backups would not be replaced, but kept forever.\n\n# Configuration\n\n## S3 Bucket\n\nHere are example commands for Backblaze B2:\n\n1. Create the bucket\n\n    ```command\n    b2 bucket create sqlite-vault-demo-backup allPrivate --lifecycle-rule '{\"daysFromHidingToDeleting\":1,\"daysFromUploadingToHiding\":null,\"fileNamePrefix\":\"\"}'\n    ```\n\n1. Create the application key:\n\n    ```command\n    b2 key create --bucket sqlite-vault-demo-backup sqlite-vault-demo-backup-writer listFiles,readFiles,writeFiles\n    ```\n\n    Be sure to save the output; it's not going to be shown again.\n\n# Restore\n\n1. Download the `.age` file from S3, e.g. using\n\n    ```command\n    $ b2 file download --no-progress b2://sqlite-vault-demo-backup/myapp.hourly-09.db.age myapp.db.age\n    ```\n\n1. Decrypt with\n\n    ```command\n    rage --decrypt --output myapp.db myapp.db.age\n    ```\n\n    You may use any other age-compatible implementation instead of rage.\n\n1. Check if your data is accessible with\n\n    ```command\n    sqlite3 myapp.db\n    ```\n\n## Dependencies\n\n- [age](https://github.com/FiloSottile/age) - Modern encryption tool\n- [minio-go](https://github.com/minio/minio-go) - S3-compatible client\n- [modernc.org/sqlite](https://pkg.go.dev/modernc.org/sqlite) - Pure Go SQLite driver\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhlig%2Fsqlite-vault","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuhlig%2Fsqlite-vault","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuhlig%2Fsqlite-vault/lists"}