Backups & security
Backups
Section titled “Backups”Node / Docker (SQLite)
Section titled “Node / Docker (SQLite)”The Node runtime stores all state in a single SQLite file in WAL mode (data/sendcrate.db by default). Use SQLite’s online backup command so backups are consistent while Sendcrate is running:
sqlite3 data/sendcrate.db ".backup 'sendcrate-$(date +%F).db'"To restore:
- Stop the Sendcrate server.
- Replace
data/sendcrate.dbwith the backup and remove any stale-walor-shmsibling files. - Start Sendcrate again; any pending schema migrations run automatically on startup.
Cloudflare Workers (D1)
Section titled “Cloudflare Workers (D1)”Cloudflare D1 retains 30 days of point-in-time recovery:
wrangler d1 time-travel restore sendcrate --timestamp 2026-11-28T00:00:00ZTo write a portable SQL dump:
wrangler d1 export sendcrate --output backup.sqlSecrets at rest
Section titled “Secrets at rest”Bucket access keys and TOTP secrets are stored in plain text in the Sendcrate database because the server must present credentials to S3 providers on every request and neither runtime assumes an external KMS.
Treat the SQLite database file, the D1 database, and every backup as secrets:
- Restrict filesystem and Cloudflare account permissions on the database.
- Encrypt backups before shipping them offsite.
- Scope every bucket’s IAM credentials to least privilege (only the buckets and S3 actions Sendcrate needs).
- Use a strong random
SENDCRATE_SECRET(at least 32 characters, e.g.openssl rand -base64 48).
Authentication & sessions
Section titled “Authentication & sessions”- Authentication runs on Better Auth with scrypt password hashing, 7-day rolling sessions (renewing once per day on activity), and TOTP two-factor authentication with encrypted recovery codes.
- Auth rate limits are stored in the database so they remain consistent across Worker isolates.
- Social logins still require completing MFA when the account has MFA enabled.
- Admin account recovery: if the admin user named in
admin.email/SENDCRATE_ADMIN_EMAILis missing on boot, Sendcrate recreates it automatically.
Error reporting (Sentry)
Section titled “Error reporting (Sentry)”Set SENTRY_DSN (and optionally SENTRY_RELEASE) in the Node environment or Worker secrets to enable error reporting. Without a DSN, failures still go to structured server logs.
- Sendcrate excludes request bodies, URLs, headers, cookies, user payloads, and breadcrumbs from Sentry events.
- Production error responses return safe generic messages and a
requestIdreference. - Only set
SENDCRATE_ENV=developmenton local development servers — never on a public deployment, as it includes stack traces and cause chains in unexpected error responses.