Skip to content

About

Self-hosted, self-destructing messages and files, encrypted in the browser with AES-256-GCM and deleted after reading. Built with Bun, React and Docker.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Latest commit

 

History

63 Commits

Folders and files

Repository files navigation

CipherDrop

CipherDrop creates private, self-expiring messages. Message text and attachments are encrypted in the browser before they are sent to the server. Share the link and password separately.

Stack

  • Backend: Bun, Express, TypeScript, PostgreSQL and Redis
  • Frontend: React, Vite and TypeScript, built with Bun and served by Nginx
  • Encryption: browser Web Crypto (AES-GCM, PBKDF2 and HKDF) for new messages; CryptoJS remains for opening legacy messages

Run with Docker Compose

  1. Install Docker Compose and Bun (Bun is needed for local frontend development; the container build includes it).
  2. Copy .env.example to the repository root as .env.
  3. Set SESSION_SECRET to a random value with at least 32 characters, set a long DB_PASSWORD, and point BASE_URL at the public site address.
  4. Run docker compose up --build -d.
  5. Open http://localhost:8001.

The site and its service ports are bound to localhost by default. COOKIE_SECURE=false is set for the local HTTP example; change it to true behind HTTPS before exposing the site publicly. When upgrading an existing Postgres volume, keep its current database password in .env so the application can reconnect.

Production settings

Variable Default Purpose
TRUST_PROXY 1 Number of reverse proxies in front of the backend. The bundled Nginx counts as one; set 2 when another HTTPS proxy (Caddy, Traefik, …) sits in front, otherwise all clients share one rate limit. Also accepts true/false or a comma-separated list of proxy addresses.
UPLOAD_QUOTA_BYTES 104857600 (100 MB) Upload volume per hour for each anonymous IP address.
USER_UPLOAD_QUOTA_BYTES 524288000 (500 MB) Upload volume per hour for each account.
REDIS_MAXMEMORY 512mb Memory cap for Redis. When it is reached, new temporary messages are rejected with HTTP 503 instead of evicting existing ones.

Anonymous callers can create 20 messages per 15 minutes, logged-in users 100. Both containers run as unprivileged users; the web container listens on port 8080 internally and sends a strict Content Security Policy.

Administrators

There is no sign-up path for administrators. Register a normal account, then promote it in Postgres and log in again:

docker compose exec db psql -U cipherdrop -d cipherdropdb \
  -c "UPDATE users SET isadmin = TRUE WHERE username = 'your-name';"

Tests

Run bun test in backend and frontend. Backend integration tests need PostgreSQL and Redis and are skipped unless TEST_INTEGRATION=1 is set; they use DB_HOST=localhost, DB_PASSWORD=cipherdrop and REDIS_URL=redis://localhost:6379 unless overridden. Use disposable databases: the tests create users and change Redis settings temporarily.

docker run -d --rm --name cd-test-pg -e POSTGRES_USER=cipherdrop -e POSTGRES_PASSWORD=cipherdrop -e POSTGRES_DB=cipherdropdb -p 55432:5432 postgres:15-alpine
docker run -d --rm --name cd-test-redis -p 56379:6379 redis:7-alpine
cd backend && TEST_INTEGRATION=1 DB_PORT=55432 REDIS_URL=redis://localhost:56379 bun test

Local development

Run PostgreSQL and Redis, then configure the backend variables from .env.example in .env (use DB_HOST=localhost and REDIS_URL=redis://localhost:6379). Start the backend with bun run dev from backend.

For the frontend, run bun install and bun run dev from frontend. Vite proxies /api requests to http://localhost:8000; override this with API_PROXY_TARGET if needed.

API compatibility

Existing routes remain available. Secret reads can use the original GET /secrets/:id?controlmessage=… route or the safer POST /secrets/:id route with { "controlmessage": "…" } in the JSON body. The React app uses POST so the control value is not exposed in the URL. GET /secrets/exists/:id now also returns the encryption version and public salt needed by the browser to read new messages.

New messages use a versioned authenticated encryption format. Existing CryptoJS-encrypted messages remain readable and are not rewritten by the server.

License

MIT. See LICENSE.

About

Self-hosted, self-destructing messages and files, encrypted in the browser with AES-256-GCM and deleted after reading. Built with Bun, React and Docker.

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages