MCPSERV.CLUB
pacebin

pacebin

Self-Hosted

Minimalist self-hosted paste and file hosting service

Stale(40)
0stars
0views

Overview

Discover what makes pacebin powerful

**pacebin** is a lightweight, self‑hosted paste and file hosting service written entirely in **C**. It uses the embedded HTTP server library **Mongoose** to expose a REST‑style API and simple web UI. The application stores every paste as an individual file in a designated directory, making persistence trivial and eliminating the need for a relational or NoSQL database. The codebase is intentionally minimal—just under 100 KiB—which keeps the binary small, reduces attack surface, and simplifies auditability.

File‑system backed storage

RESTful API

Optional authentication

Expiration & size limits

Overview

pacebin is a lightweight, self‑hosted paste and file hosting service written entirely in C. It uses the embedded HTTP server library Mongoose to expose a REST‑style API and simple web UI. The application stores every paste as an individual file in a designated directory, making persistence trivial and eliminating the need for a relational or NoSQL database. The codebase is intentionally minimal—just under 100 KiB—which keeps the binary small, reduces attack surface, and simplifies auditability.

Key Features

  • File‑system backed storage – each paste or upload is a plain file; metadata such as expiration, size limits, and access tokens are encoded in the filename or a lightweight JSON sidecar.
  • RESTful API – endpoints for creating, retrieving, and deleting pastes (/api/paste, /api/file) support JSON payloads and standard HTTP status codes.
  • Optional authentication – a simple token‑based system can be enabled via configuration, allowing fine‑grained access control without adding a full auth framework.
  • Expiration & size limits – configurable per‑paste TTL and maximum upload size are enforced at request time, with a background cleaner routine that removes stale files.

Technical Stack

LayerTechnology
RuntimeC (C99) compiler, POSIX APIs
Web ServerMongoose embedded HTTP/HTTPS server (MIT‑licensed)
ConfigurationPlain text .conf file; environment variables for overrides
PersistenceNative filesystem (POSIX open, stat, unlink)
Build SystemGNU Make (Makefile); no external dependencies beyond Mongoose headers
TestingMinimal unit tests written in C; integration tests via curl scripts

Core Capabilities

  • API Endpoints
    • POST /api/paste – submit raw text or JSON; returns a unique URL.
    • GET /api/paste/<id> – fetch paste content; supports Accept: text/plain or application/json.
    • DELETE /api/paste/<id> – remove paste (token required if auth enabled).
    • POST /api/file – upload a file; optional content‑type detection and size checks.
  • Webhooks – developers can hook into paste creation or deletion events via a simple callback URL configurable in the pacebin.conf.
  • Extensibility – the Mongoose request handler can be forked; adding new routes or middleware is a matter of extending the C source.
  • Security – HTTPS support with automatic Let's Encrypt integration via a bundled script; optional HTTP Basic Auth and per‑paste access tokens.

Deployment & Infrastructure

  • Self‑Hosting – run the binary on any POSIX system (Linux, macOS, FreeBSD). No database server or runtime is required.
  • Containerization – a ready‑made Dockerfile exists; the image is under 30 MiB and uses Alpine Linux as a base.
  • Scalability – for high‑traffic scenarios, deploy multiple instances behind a load balancer (e.g., Nginx or HAProxy) and share the storage directory over NFS or a distributed filesystem.
  • Resource Footprint – typical usage consumes < 10 MB RAM and a single CPU core; the event loop is non‑blocking thanks to Mongoose’s asynchronous API.

Integration & Extensibility

  • Plugin System – while not a full plugin framework, developers can compile additional C modules that register new request handlers with Mongoose.
  • API Hooks – the server exposes a callback interface (pacebin_on_paste_created, pacebin_on_file_uploaded) that can be overridden to trigger external services (e.g., Slack notifications, CI pipelines).
  • Custom Frontend – the static assets are bundled in a directory; replace or extend them without touching the server code.

Developer Experience

  • Configuration – a single pacebin.conf file with clear comments; supports environment variable overrides for CI/CD pipelines.
  • Documentation – the README contains API usage examples, build instructions, and a FAQ; inline code comments aid comprehension.
  • Community & Support – the project is actively maintained (last commit 2025‑09‑06), with an issue tracker for feature requests and bug reports.
  • Licensing – MIT license ensures unrestricted commercial use, making it safe for internal tooling or public services.

Use Cases

ScenarioWhy pacebin fits
Developer tooling – quick sharing of code snippets, logs, or config files within a team.Zero‑configuration server; file‑system persistence is ideal for local dev environments.
CI/CD artifacts – expose build logs or test results temporarily.API can push logs directly; TTL ensures cleanup without manual intervention.
Internal knowledge base – lightweight documentation hub for transient information.Simple UI, optional auth; no database overhead.
Educational projects – teaching HTTP servers or C networking.Minimal codebase; students can modify request handlers in a few lines.

Advantages Over Alternatives

  • Zero‑dependency – no database or external services; deployment is as simple as copying a binary.
  • Performance – native C code with an event‑driven server delivers low latency and high throughput.
  • Auditability – small source tree makes security reviews straightforward; all data is plain files.

Open SourceReady to get started?

Join the community and start self-hosting pacebin today