Skip to content

Backups & security

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:

Terminal window
sqlite3 data/sendcrate.db ".backup 'sendcrate-$(date +%F).db'"

To restore:

  1. Stop the Sendcrate server.
  2. Replace data/sendcrate.db with the backup and remove any stale -wal or -shm sibling files.
  3. Start Sendcrate again; any pending schema migrations run automatically on startup.

Cloudflare D1 retains 30 days of point-in-time recovery:

Terminal window
wrangler d1 time-travel restore sendcrate --timestamp 2026-11-28T00:00:00Z

To write a portable SQL dump:

Terminal window
wrangler d1 export sendcrate --output backup.sql

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 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_EMAIL is missing on boot, Sendcrate recreates it automatically.

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 requestId reference.
  • Only set SENDCRATE_ENV=development on local development servers — never on a public deployment, as it includes stack traces and cause chains in unexpected error responses.