Overview
Discover what makes Wastebin powerful
Wastebin is a lightweight, self‑hosted paste service written in Rust. It exposes a minimal HTTP API that accepts plain text, optionally encrypted with ChaCha20‑Poly1305, and stores it in a local SQLite database. The application is built around the `axum` web framework, giving developers fine‑grained control over routing and middleware while keeping the binary footprint under 10 MiB. The core logic is split into three layers: request handling, business rules (validation, encryption, expiration), and persistence. Each paste is represented by a UUID key that maps to a compressed (zstd) payload, a MIME type hint, an optional expiry timestamp, and metadata such as creation time and view count.
Language & Runtime
Web Framework
Persistence
Compression
Overview
Wastebin is a lightweight, self‑hosted paste service written in Rust. It exposes a minimal HTTP API that accepts plain text, optionally encrypted with ChaCha20‑Poly1305, and stores it in a local SQLite database. The application is built around the axum web framework, giving developers fine‑grained control over routing and middleware while keeping the binary footprint under 10 MiB. The core logic is split into three layers: request handling, business rules (validation, encryption, expiration), and persistence. Each paste is represented by a UUID key that maps to a compressed (zstd) payload, a MIME type hint, an optional expiry timestamp, and metadata such as creation time and view count.
Architecture
- Language & Runtime: Rust 1.80+, leveraging async/await and Tokio for high concurrency.
- Web Framework:
axum(layered router, extractor system, graceful shutdown) on top of Hyper/Tokio. - Persistence:
rusqlitedriver against a single SQLite3 file (state.db). All migrations are embedded in the binary; schema versioning is handled via a simplemigrationstable. - Compression: zstd (via the
zstdcrate) for both request payloads and responses, reducing bandwidth for large pastes. - Syntax Highlighting:
syntectprovides on‑the‑fly syntax detection and rendering into HTML/CSS for the UI. The list of supported languages is auto‑generated from Syntect’s bundled grammars. - Encryption: ChaCha20Poly1305 (via
ringorchacha20poly1305) for symmetric encryption, with passwords hashed by Argon2 (argon2crate) to derive the key. - QR Generation:
qrcodecrate generates SVG QR codes for quick mobile access.
The application ships as a single statically linked binary, making it trivial to deploy in containers or on bare metal. The codebase follows a clean separation of concerns: routes for HTTP endpoints, service for business logic, and db for SQLite access.
Core Capabilities
| Feature | Developer Exposure |
|---|---|
Create Paste (POST /api/v1/pastes) | Accepts raw text, optional MIME type, password, expiry. Returns a unique URL and optional QR code link. |
Retrieve Paste (GET /api/:id) | Returns plaintext or HTML with syntax highlighting. Handles decryption if password provided. |
Delete Paste (DELETE /api/:id) | Authenticated by a one‑time password or via owner key. |
List Pastes (GET /api/v1/pastes) | Paginated list of recent pastes with metadata. |
Stats (GET /api/v1/stats) | Global metrics (total pastes, views). |
| Webhooks | None built‑in, but the API is idempotent and can be wrapped by external services. |
| Custom Themes | UI themes are embedded CSS; developers can swap or extend via environment variables. |
All endpoints are documented in the README and automatically generated OpenAPI docs can be enabled by toggling a feature flag.
Deployment & Infrastructure
- Containerization: Official Docker image (
quxfoo/wastebin) is built from scratch, exposing only the binary and a writable/datavolume forstate.db. No shell or package manager is present, reducing attack surface. - Self‑Hosting: Requires a Unix‑like OS with
systemdor Docker. The binary reads environment variables (WASTEBIN_DATABASE_PATH,PORT) for configuration. - Scalability: SQLite is suitable for low‑to‑medium traffic (hundreds of writes per second). For higher load, developers can run multiple instances behind a reverse proxy and share the same database file via NFS or a cloud storage bucket, though SQLite’s write lock will serialize writes.
- High Availability: Pair with a load balancer and sticky sessions to ensure a paste’s URL resolves to the same instance that holds the database file.
- Resource Footprint: Roughly 15 MiB RAM when idle; CPU usage scales linearly with concurrent requests.
Integration & Extensibility
- Plugins: No formal plugin system, but the code is modular; developers can fork and extend routes or add middleware (e.g., rate limiting, JWT auth) without touching the core.
- APIs: RESTful endpoints with JSON payloads. The API can be consumed by any HTTP client, making it easy to integrate into CI/CD pipelines or IDE extensions.
- Webhooks: While not built‑in, the API can be wrapped by a lightweight service that triggers events on paste creation or deletion.
- Customization: Themes, syntax grammar selection, and default expiration can be overridden via environment variables or by compiling a custom binary.
Developer Experience
- Documentation: The README provides a clear quick‑start, while the source code is heavily commented. Inline docs are generated with
rustdoc, exposing function signatures and usage. - Community: The project is maintained on GitHub with an active issue tracker. Contributions are welcome via pull requests; the CI pipeline ensures all tests pass before merging.
- Testing: Unit tests cover business logic, and integration tests spin up an in‑memory
Open SourceReady to get started?
Join the community and start self-hosting Wastebin today
Related Apps in other
Immich
Self‑hosted photo and video manager
Syncthing
Peer‑to‑peer file sync, no central server
Strapi
Open-source headless CMS for modern developers
reveal.js
Create stunning web‑based presentations with HTML, CSS and JavaScript
Stirling-PDF
Local web PDF editor with split, merge, convert and more
MinIO
Fast, S3-compatible object storage for AI and analytics
Weekly Views
Repository Health
Information
Explore More Apps
FeatBit
Self‑hosted feature flag service for safe, targeted releases
Wagtail
Fast, flexible CMS built on Django
WikiDocs
Databaseless markdown flat‑file wiki engine
Vaultwarden
Lightweight Bitwarden-compatible password manager
Bracket
Manage tournaments effortlessly
DocuSeal
Open‑source digital document signing and filling