Neat paste bin.
version 1.5.0
upgrade dependencies
update cargo.lock to reflect version



You can also use your local clone with git send-email.


Coffeepaste is a pastebin-like service intended to be used from the command line.


Build with cargo build (or cargo build --release for a release build).


The config file config.toml contains config options like data path, page URL, max file size, etc. It's compiled into the binary, so any changes requires a recompile.


The basic usage is to do curl --upload-file <file> <URL> to upload a file, or curl --upload-file - <URL> to upload from stdin. The server will respond with a URL to your content.

The URL's extension doesn't change the content of the file, but might change the way it's presented.

#HTTP endpoints

#GET /, GET /index.html

Get the main page which provides usage information.

#GET /<ID>

Get the raw content of the file with the given ID.

#GET /<ID>.<EXT>

View the contents of the file with the given ID, but displayed in a way determined by the extension.

  • Any extension associated with an image, video or audio file is sent unmodified, but with the appropriate Content-Type header.
  • Other extensions are a bit more complex:
    • If the client doing the request doesn't advertise HTML support, the client is sent the content unmodified.
    • Otherwise, the client is sent an HTML page which adds syntax highlighting and other features, where the syntax highlighting is determined by the extension (or, if the extension is .auto, the syntax highlighting guesses the file type based on content).


Upload a file to the server. The path is ignored (a random ID is generated instead), but if the path has a file extension, the returned URL will have the same file extension.


If you want to host your own version of Coffeepaste, I recommend running it behind something like an nginx reverse proxy. By default, it listens to, which means it's only accessible from the machine it's running on. Coffeepaste has no support for HTTPS and no features for preventing abuse (such as rate limiting or blocking IP addresses), instead relying on your reverse proxy setup for that stuff.

Here's nginx's documentation on setting up a reverse proxy: https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/

The basic idea boils down to:

location / {
	proxy_set_header X-Real-IP $remote_addr;
	proxy_pass http://localhost:<coffeepaste's port>;

You probably want to at least do something to rate limit PUT requests to prevent someone spamming your server with files. There's less documentation about that, but this is basically the gist of how I do it:

limit_req_zone $binary_remote_addr zone=put_request_by_addr:10m rate=10r/s;

server {

	error_page 599 = @putrequest;
	if ($request_method = 'PUT') {
		return 599;

	location / {
		proxy_pass http://localhost:8080;
		proxy_set_header X-Real-IP $remote_addr;
	location @putrequest {
		limit_req zone=put_request_by_addr burst=10;
		proxy_pass http://localhost:8080;
		proxy_set_header X-Real-IP $remote_addr;

I don't know if that's a great way to do it, but it works and seems to be the simplest solution I could find. Basically, it abuses the error page for HTTP error 599 (which is not a real status code) to let us have two different 'location' blocks, one for PUT requests and one for all other requests.

Although inadvisable, if you want to expose Coffeepaste to the internet directly, replace the with in the config.toml.