Spacebin is a modern Pastebin server implemented in Go and maintained by Luke Whritenour. It is capable of serving notes, novels, code, or any other form of text! Spacebin was designed to be fast and reliable, avoiding the problems of many current pastebin servers. Spacebin features JavaScript-based text highlighting, but works completely fine with JS disabled. Besides text highlighting, we have many more features in the works. It is entirely self-hostable, and available in a Docker image.
Pastebins are a type of online content storage service where users can store plain text document, e.g. program source code. For more information and the history of Pastebin see Wikipedia's article on them.
Using Docker
# Pull and run docker image on port 80
$ sudo docker pull spacebinorg/spirit
$ sudo docker run -d -p 80:9000 spacebinorg/spirit
Manually
WIP
To use Spacebin on the web, our team provides a web app. You can access the web app at spaceb.in. You must use https://spaceb.in/api
to access the API routes.
Since Spirit supports multipart/form-data
uploads, it's extremely easy to use on the command line via curl
. The scripts also use jq
so that you can get a machine-readable version of the document's ID, instead of a lengthy JSON object.
To upload a string of text:
curl -v -F content="Hello, world!" https://spaceb.in/ | jq payload.id
To upload from a file:
curl -v -F content=@helloworld.txt https://spaceb.in/ | jq payload.id
There are three primary API routes to: create a document, fetch a documents text content in JSON format, and fetch a documents plain text content.
/api/
: Create Document- Accepts JSON and multipart/form-data
- For both formats, include document content in a
content
field - Only accepts POST requests
- Instances are able to specify a maximum document length.
spaceb.in
uses a 4MB maximum size.
- Successful requests return a JSON body with the following format:
{
"error": "",
"payload": {
"id": "WfwKGJfs",
"content": "hello",
"created_at": "2023-08-06T00:01:33.143532-04:00",
"updated_at": "2023-08-06T00:01:33.143532-04:00"
}
}
/api/{document}
: Fetch Document{document}
= Document ID- Document ID lengths vary between instances. For
spaceb.in
, they will be exactly characters. - Upon successful request, returns a JSON body with the following format:
{
"error": "",
"payload": {
"id": "WfwKGJfs",
"content": "hello",
"created_at": "2023-08-06T00:01:33.143532-04:00",
"updated_at": "2023-08-06T00:01:33.143532-04:00"
}
}
/api/{document}/raw
: Fetch Document - Raw{document}
= Document ID- Document ID lengths vary between instances. For
spaceb.in
, they will be exactly 8 characters - Returns a
plain/text
file containing the content of the document.
There are two additional non-API routes that are documented: /ping
: returns a 200 OK if the service is online, and /config
: returns a JSON body with the instances configuration settings.
Spacebin (and all other associated programs) is a project designed and maintained by Luke Whritenour. Spirit was forked from hastebin by John Crepezzi (now managed by Toptal), and although it no longer contains any code from the original we'd like to thank him regardless. Spirit itself is built using Chi, and pq, Ozzo Validation, Cron, env, and (of course) Go itself!
You can see a full list of code contributors to Spirit here, on Github.
Additionally, we'd like to thank @jackdorland for designing our logo/brand.
The Spacebin team takes security very seriously. If you detect a vulnerability please contact us: hello@spaceb.in. We request that you hold of on publishing any vulnerabilities until after they've been patched, or at least 60 days have passed since you reported it.
Spirit is licensed under the Apache 2.0 license. A copy of this license can be found within the LICENSE
file.