No description
  • C 96.4%
  • Shell 2.1%
  • Makefile 0.7%
  • HTML 0.6%
  • Dockerfile 0.2%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-05-07 19:56:49 +02:00
assets had to fix the frontend rq, new frontend alert 2026-05-07 19:56:49 +02:00
src remove /config/* endpoints, add filename header to config and bla bla bla 2026-05-07 16:28:40 +02:00
.gitignore Initial Commit 2026-05-02 14:51:11 +02:00
bin2h.sh Initial Commit 2026-05-02 14:51:11 +02:00
docker-compose.yml deprecate some endpoints, add unified config endpoint, add filenames 2026-05-07 14:05:39 +02:00
Dockerfile deprecate some endpoints, add unified config endpoint, add filenames 2026-05-07 14:05:39 +02:00
LICENSE remove some compiler flags, fix help msg, add readme and license 2026-05-02 15:22:03 +02:00
Makefile remove some compiler flags, fix help msg, add readme and license 2026-05-02 15:22:03 +02:00
README.md fix readme 2026-05-02 15:25:51 +02:00

CBin - Pastebin server (C) that's a mildly responsible memory dumpster

CBin is a Unix/Linux only, in-memory pastebin server written in C. It exposes a small REST-ish API and delegates the entire "pretty web experience" to a separate frontend codebase (HTML, TypeScript, CSS), which is maintained by my friend Jan Palma.

It uses FIFO (First in first out) eviction, so older data gets sacrificed to evil demons when the server hits its configured memory limit (default is 1MB * 1000 pastes).


Features

  • Written in C (because fuck memory safety)

  • Uses stb_ds for dynamic data structures (mainly hashmaps)

  • In-memory storage only

  • FIFO eviction policy

  • Unix/Linux only (because I'm using raw sockets and GCC features that aren't standard)

  • Minimal REST-like API (not "REST compliant", just REST-flavored)

  • Designed for a separate frontend


Architecture Overview

This is not a "framework". It's a server that stores text, sometimes throws it out into the abyss.

Core idea:

  • Client submits paste -> server stores it in memory

  • Server assigns an ID

  • Client receives paste via ID

  • When memory limit is reached -> oldest entry is GONE (slow algorithm but idc)


Build

Requirements

  • Linux or some other Unix-like OS

  • GCC or Clang

Compile

make

Run

./build/cbin



usage: ./build/cbin [bind_port] [options]

positional:
  bind_port                Port to bind (default: 8820)

options:
  --bind-port=PORT         Port to bind
  --n-pastes=N             Max number of pastes (default: 1000)
  --max-paste-size=BYTES   Max paste size (default: 1048576)
  --log-level=LEVEL        Log level (default: INFO)

Frontend

Completely separate repository here

This backend:

  • Does not render HTML.

  • Does not care about your CSS.

  • Does send data to the client.

  • Does have a favicon and the compiled frontend


Design Philosophy

  • As long as it works

Contributing

  • Keep it simple

License

MIT License