MCPSERV.CLUB
Wastebin

Wastebin

Self-Hosted

A minimal, fast paste‑sharing service with encryption and QR codes

Active(90)
654stars
0views
Updated 5 days ago

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: rusqlite driver against a single SQLite3 file (state.db). All migrations are embedded in the binary; schema versioning is handled via a simple migrations table.
  • Compression: zstd (via the zstd crate) for both request payloads and responses, reducing bandwidth for large pastes.
  • Syntax Highlighting: syntect provides 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 ring or chacha20poly1305) for symmetric encryption, with passwords hashed by Argon2 (argon2 crate) to derive the key.
  • QR Generation: qrcode crate 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

FeatureDeveloper 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).
WebhooksNone built‑in, but the API is idempotent and can be wrapped by external services.
Custom ThemesUI 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 /data volume for state.db. No shell or package manager is present, reducing attack surface.
  • Self‑Hosting: Requires a Unix‑like OS with systemd or 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

Weekly Views

Loading...
Support Us

Featured Project

$30/month

Get maximum visibility with featured placement and special badges

Repository Health

Loading health data...

Information

Category
other
License
MIT
Stars
654
Technical Specs
Pricing
Open Source
Database
SQLite
Docker
Official
Supported OS
LinuxmacOSDocker
Author
matze
matze
Last Updated
5 days ago