MCPSERV.CLUB
Rustypaste

Rustypaste

Self-Hosted

Minimal file upload and pastebin service in Rust

Active(92)
995stars
0views
Updated 9 days ago

Overview

Discover what makes Rustypaste powerful

Rustypaste is a lightweight, self‑hosted pastebin built entirely in Rust. Its core purpose is to expose a simple HTTP API that accepts file uploads, optionally generates short URLs or pet‑name style identifiers, and serves the content back with optional expiration semantics. The service is intentionally minimalistic: it eschews heavyweight frameworks, persistence layers, or templating engines in favor of a single binary that can be dropped into any environment. For developers looking for an embeddable paste solution or a custom file‑sharing endpoint, Rustypaste offers a clean, type‑safe codebase with comprehensive documentation on the `rustypaste` crate.

Language

Web framework

Storage

Authentication

Overview

Rustypaste is a lightweight, self‑hosted pastebin built entirely in Rust. Its core purpose is to expose a simple HTTP API that accepts file uploads, optionally generates short URLs or pet‑name style identifiers, and serves the content back with optional expiration semantics. The service is intentionally minimalistic: it eschews heavyweight frameworks, persistence layers, or templating engines in favor of a single binary that can be dropped into any environment. For developers looking for an embeddable paste solution or a custom file‑sharing endpoint, Rustypaste offers a clean, type‑safe codebase with comprehensive documentation on the rustypaste crate.

Technical Stack & Architecture

  • Language: Rust 1.70+ (stable) – guarantees memory safety and zero‑cost abstractions.
  • Web framework: Actix‑web, chosen for its high throughput and mature async ecosystem.
  • Storage: Local filesystem by default; the API accepts a configurable root directory and supports optional SQLite or PostgreSQL backends via feature flags for metadata (e.g., expiration timestamps).
  • Authentication: Basic HTTP auth, configurable through environment variables or a .htpasswd‑style file.
  • Testing & Coverage: Uses Cargo’s built‑in test harness with integration tests; CI pipelines run on GitHub Actions and publish coverage via Codecov.
  • Packaging: Provides prebuilt binaries, a Docker image (orhunp/rustypaste), and a Cargo crate (rustypaste) for embedding.

The application follows a classic request–response pipeline: an incoming POST / with multipart/form-data triggers the upload handler, which writes the file to disk and returns a JSON payload containing the public URL. Subsequent GET /<id> requests stream the file back, optionally applying a MIME type based on the extension. Expiration logic runs in a background task that periodically scans for files older than their TTL and deletes them.

Core Capabilities & API Surface

  • File Upload: POST / with multipart/form-data (file=@...). Supports arbitrary file sizes up to a configurable limit.
  • URL Shortening: Automatic generation of short, collision‑free identifiers. Options include pet names (capital-mosquito.txt) or random alphanumeric strings.
  • Remote Paste: POST /paste can fetch a file from a remote URL, store it locally, and return the short link.
  • Expiration: Per‑file TTLs (e.g., 24h) and global auto‑expiration. Exposed via query parameters (?expires=86400) or environment variables.
  • One‑Shot URLs: Flags to invalidate a URL after the first download, ensuring single‑use access.
  • Listing & Deletion: /list endpoint (protected by auth) returns JSON metadata for all stored files; DELETE /<id> removes a file.
  • CLI Interface: The binary can be invoked as a CLI tool (rustypaste upload <file>) for scripting or local usage.

Deployment & Infrastructure

Rustypaste is designed for straightforward self‑hosting:

  • Containerization: A ready‑to‑use Dockerfile builds a minimal Alpine‑based image; the container exposes port 80 by default and accepts configuration via environment variables.
  • Scaling: The stateless nature of the service allows horizontal scaling behind a load balancer. For high‑volume scenarios, mount a shared NFS or cloud storage bucket as the root directory.
  • High Availability: Pair with a reverse proxy (NGINX, Traefik) to enable TLS termination and HTTP/2 support.
  • Resource Footprint: A single instance consumes <10 MiB of RAM and a few hundred milliseconds per request, making it suitable for edge deployments or small VPS.

Integration & Extensibility

While Rustypaste offers a minimal feature set, its open‑source nature and well‑structured codebase encourage extension:

  • Custom Storage: Implement the Storage trait to plug in S3, GCS, or a database backend without touching request handlers.
  • Webhook Support: Expose an optional POST /webhook endpoint that triggers on upload or deletion, allowing integration with CI pipelines or monitoring tools.
  • Plugin Hooks: Feature flags (expiring, auth, db) enable or disable modules; developers can compile a lean binary tailored to their environment.
  • API Documentation: The crate exposes type‑safe client structs; docs.rs provides in‑depth API references and examples.

Developer Experience

  • Documentation: The rustypaste crate is fully documented on docs.rs, with inline examples and type signatures. The README contains concise usage snippets.
  • Community & Support: Maintained on GitHub with active issue handling, a dedicated discussion forum, and frequent CI checks. The license (MIT) removes any usage constraints.
  • Configuration: Environment‑driven, with sensible defaults (e.g., /tmp/rustypaste for storage). No complex YAML or JSON config files are required.

Use Cases

  • Internal DevOps: Quick sharing of logs, config snippets, or build artifacts within a team without exposing them publicly.
  • CI/CD Artifacts: A pipeline step that uploads test reports or coverage files to a private pastebin, then passes the URL downstream.
  • Edge Computing: Deploy on a CDN edge node to provide fast, local file access for transient data.
  • Educational Platforms: Use as a teaching aid for networking or Rust programming, given its simple

Open SourceReady to get started?

Join the community and start self-hosting Rustypaste today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
other
License
MIT
Stars
995
Technical Specs
Pricing
Open Source
Database
None
Docker
Official
Supported OS
LinuxFreeBSD
Author
orhun
orhun
Last Updated
9 days ago