{"id":13674603,"url":"https://github.com/lukewhrit/spacebin","last_synced_at":"2025-09-21T17:38:41.146Z","repository":{"id":38086066,"uuid":"256933210","full_name":"lukewhrit/spacebin","owner":"lukewhrit","description":"🔭  spacebin: text sharing for the final frontier","archived":false,"fork":false,"pushed_at":"2025-09-15T06:19:20.000Z","size":57982,"stargazers_count":125,"open_issues_count":16,"forks_count":12,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-19T06:08:22.533Z","etag":null,"topics":["go","go-chi","hastebin","pastebin","postgresql","selfhosted","spacebin"],"latest_commit_sha":null,"homepage":"https://spaceb.in","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukewhrit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"lukewhrit","patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"lfx_crowdfunding":null,"polar":null,"buy_me_a_coffee":null,"custom":null}},"created_at":"2020-04-19T06:46:57.000Z","updated_at":"2025-09-17T13:54:32.000Z","dependencies_parsed_at":"2024-09-17T04:14:50.959Z","dependency_job_id":"1daa8478-49e4-41a9-895b-c7056c7868c8","html_url":"https://github.com/lukewhrit/spacebin","commit_stats":null,"previous_names":["spacebin-org/spirit","orca-group/spirit"],"tags_count":10,"template":false,"template_full_name":null,"purl":"pkg:github/lukewhrit/spacebin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewhrit%2Fspacebin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewhrit%2Fspacebin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewhrit%2Fspacebin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewhrit%2Fspacebin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukewhrit","download_url":"https://codeload.github.com/lukewhrit/spacebin/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukewhrit%2Fspacebin/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276183650,"owners_count":25599223,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-20T02:00:10.207Z","response_time":63,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","go-chi","hastebin","pastebin","postgresql","selfhosted","spacebin"],"created_at":"2024-08-02T11:00:54.805Z","updated_at":"2025-09-21T17:38:41.137Z","avatar_url":"https://github.com/lukewhrit.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\n    \u003cimg\n        width=\"600\"\n        src=\"https://raw.githubusercontent.com/lukewhrit/spacebin/main/.github/assets/spacebin-text-logo/Spacein%20Text.svg\"\n        alt=\"spacebin - hastebin fork focused on stability and maintainability\"\n    /\u003e\n\u003c/p\u003e\n\n# 🚀 Spacebin\n\n[![codecov](https://codecov.io/gh/lukewhrit/spacebin/graph/badge.svg?token=NNZDS74DB1)](https://codecov.io/gh/lukewhrit/spacebin) [![GitHub license](https://img.shields.io/github/license/lukewhrit/spacebin?color=%20%23e34b4a\u0026logoColor=%23000000)](LICENSE) [![Build](https://github.com/lukewhrit/spacebin/actions/workflows/build.yml/badge.svg?branch=develop)](https://github.com/lukewhrit/spacebin/actions/workflows/build.yml)\n[![Go report card](https://goreportcard.com/badge/github.com/lukewhrit/spacebin)](https://goreportcard.com/report/github.com/lukewhrit/spacebin)\n\nSpacebin is a modern Pastebin server implemented in Go and is capable of serving notes, novels, code, or any other form of text.\n\nSpacebin 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.\n\nPastebins 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](https://en.wikipedia.org/wiki/Pastebin).\n\n\u003e [!IMPORTANT]\n\u003e **Try our public online version at [https://spaceb.in](https://spaceb.in)**!\n\n**Features:**\n\n-   [x] 99% self-contained: only requires a database to run.\n-   [x] Raw text and code uploading\n-   [x] Phrase and random string identifiers.\n-   [x] Custom named documents that are always available.\n-   [x] Configurable ratelimiting, expiration, compression, etc.\n-   [x] Modern, JavaScript-free user interface\n-   [x] Syntax highlighting for all the most popular languages and Raw text mode\n-   [x] SQLite, MySQL, and PostgreSQL Support\n-   [x] Basic Auth for private instances\n-   [ ] Password-protected encrypted pastes\n-   [ ] Paste collections\n-   [ ] Reader view mode (Markdown is formatted and word wrapping is enabled)\n-   [ ] QR Codes\n\n**Vote on future features: [Image/file uploading](https://github.com/lukewhrit/spacebin/discussions/446), [Account system](https://github.com/lukewhrit/spacebin/discussions/447)**\n\nLooking for a URL shortener too? Try [redeyes](https://github.com/lukewhrit/redeyes).\n\n## Table of Contents\n\n- [🚀 Spacebin](#-spacebin)\n  - [Table of Contents](#table-of-contents)\n  - [Documentation](#documentation)\n    - [Self-hosting](#self-hosting)\n      - [Using Docker](#using-docker)\n      - [Docker Compose](#docker-compose)\n      - [Manually](#manually)\n      - [Environment Variables](#environment-variables)\n        - [Database Connection URI](#database-connection-uri)\n    - [Usage](#usage)\n      - [On the Web](#on-the-web)\n      - [CLI](#cli)\n    - [API](#api)\n  - [Credits](#credits)\n  - [Vulnerabilities](#vulnerabilities)\n  - [License](#license)\n\n## Documentation\n\n\u003e [!TIP]\n\u003e Need support? Visit our [Discussions](https://github.com/lukewhrit/spacebin/discussions) tab to get help from the community.\n\n### Self-hosting\n\n#### Using Docker\n\n```sh\n# Pull and run docker image on port 80\n$ sudo docker pull spacebinorg/spirit\n$ sudo docker run -d -e SPIRIT_CONNECTION_URI=\"sqlite://database.sqlite\" -p 80:9000 spacebinorg/spirit\n```\n\n#### Docker Compose\n\nUse the following config file to host Spacebin via Docker Compose:\n\n```yml\nservices:\n  spacebin:\n    image: spacebinorg/spirit:latest\n    restart: always\n    environment:\n      - SPIRIT_CONNECTION_URI=postgres://spacebin:password@postgres:5432/spacebin?sslmode=disable\n    ports:\n      - 9000:9000\n    depends_on:\n      - postgres\n  postgres:\n    image: postgres:16.3-alpine\n    restart: always\n    environment:\n      - POSTGRES_USER=spacebin\n      - POSTGRES_PASSWORD=password\n      - POSTGRES_DB=spacebin\n    volumes:\n      - postgres:/var/lib/postgresql/data\n\nvolumes:\n  postgres:\n```\n\n#### Manually\n\n\u003e [!IMPORTANT]\n\u003e **Requires: [Git](https://git-scm.com/downloads), [Go 1.22.4](https://go.dev/doc/install), [GNU Makefile](https://www.gnu.org/software/make/#download), and a SQLite, MySQL, or [PostgreSQL](https://www.postgresql.org/download/) [server](https://m.do.co/c/beaf675c3e00).**\n\n```sh\n# Clone the Github repository\n$ git clone https://github.com/lukewhrit/spacebin.git\n$ cd spacebin\n\n# Build the binary\n$ make spirit\n\n# Start Spacebin\n$ SPIRIT_CONNECTION_URI=\"sqlite://database.sqlite\" ./bin/spirit # SQLite\n$ SPIRIT_CONNECTION_URI=\"mysql://\u003cyour instance URI\u003e?parseTime=true\" ./bin/spirit\n$ SPIRIT_CONNECTION_URI=\"postgres://\u003cyour PostgreSQL instance URI\u003e\" ./bin/spirit # PostgreSQL\n\n# Success! Spacebin is now available at port 9000 on your machine.\n```\n\n#### Environment Variables\n\n| Variable Name           | Type                  | Default      | Description                                                                                                                      |\n| ----------------------- | --------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------- |\n| `SPIRIT_HOST`           | String                | `0.0.0.0`    | Host address to listen on                                                                                                        |\n| `SPIRIT_PORT`           | Int                   | `9000`       | HTTP port to listen on                                                                                                           |\n| `SPIRIT_RATELIMITER`    | String                | `200x5`      | Requests allowed per second before the user is ratelimited                                                                       |\n| `SPIRIT_CONNECTION_URI` | String                | **Required** | Database connection URI                                                                                                          |\n| `SPIRIT_HEADLESS`       | Bool                  | `False`      | Enables/disables the web interface                                                                                               |\n| `SPIRIT_ANALYTICS`      | String                | `\"\"`         | `\u003cscript\u003e` tag for analytics (leave blank to disable)                                                                            |\n| `SPIRIT_ID_LENGTH`      | Int                   | `8`          | Length for document IDs                                                                                                          |\n| `SPIRIT_ID_TYPE`        | `\"key\"` or `\"phrase\"` | `key`        | Format of IDs: `key` is a random string of letters and [`phrase` is a combination of words](https://github.com/lukewhrit/phrase) |\n| `SPIRIT_MAX_SIZE`       | Int                   | `400000`     | Max allowed size of a document in bytes                                                                                          |\n| `SPIRIT_EXPIRATION_AGE` | Int64                 | `720`        | Amount of time to expire documents after                                                                                         |\n| `SPIRIT_DOCUMENTS`      | []String              | `[]`         | List of any custom documents to serve                                                                                            |\n\n\u003e [!WARNING]\n\u003e Environment variables for Spacebin are prefixed with `SPIRIT_`. They will be updated to `SPACEBIN_` in the next major version.\n\n##### Database Connection URI\n\nSpacebin supports two database formats: **SQLite** and **Postgres**\n\n-   For SQLite, use either the scheme `file://` or `sqlite://` and a file name.\n    -   Example: `file://database.db`\n-   For PostgreSQL, use [the standard PostgreSQL URI format](https://stackoverflow.com/questions/3582552/what-is-the-format-for-the-postgresql-connection-string-url#20722229).\n-   For MySQL, use the [DSN format](https://github.com/go-sql-driver/mysql?tab=readme-ov-file#dsn-data-source-name) prefixed with `mysql://` or `mariadb://`\n    -   You must set the `parseTime` option to true; append `?parseTime=true` to the end of the URI\n\n### Usage\n\n#### On the Web\n\nTo use Spacebin on the web, our team provides a web app. You can access the web app at **[spaceb.in](https://spaceb.in)**. You must use `https://spaceb.in/api` to access the API routes.\n\nA version of spacebin that is built directly from the `develop` branch is also available at [staging.spaceb.in](https://staging.spaceb.in).\n\n#### CLI\n\nSince 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.\n\n**To upload a string of text:**\n\n```sh\ncurl -v -F content=\"Hello, world!\" https://spaceb.in/ | jq payload.id\n```\n\n**To upload from a file:**\n\n```sh\ncurl -v -F content=\"$(cat helloworld.txt) https://spaceb.in/ | jq payload.id\n```\n\n### API\n\nThere are three primary API routes to: create a document, fetch a documents text content in JSON format, and fetch a documents **plain text** content.\n\n-   `/api/`: Create Document\n    -   Accepts JSON and multipart/form-data\n    -   For both formats, include document content in a `content` field\n    -   Only accepts POST requests\n    -   Instances are able to specify a maximum document length.\n        -   `spaceb.in` uses a 4MB maximum size.\n    -   Successful requests return a JSON body with the following format:\n\n```json\n{\n    \"error\": \"\",\n    \"payload\": {\n        \"id\": \"WfwKGJfs\",\n        \"content\": \"hello\",\n        \"created_at\": \"2023-08-06T00:01:33.143532-04:00\",\n        \"updated_at\": \"2023-08-06T00:01:33.143532-04:00\"\n    }\n}\n```\n\n-   `/api/{document}`: Fetch Document\n    -   `{document}` = Document ID\n    -   Document ID lengths vary between instances. For `spaceb.in`, they will be exactly **8** characters.\n    -   Upon successful request, returns a JSON body with the following format:\n\n```json\n{\n    \"error\": \"\",\n    \"payload\": {\n        \"id\": \"WfwKGJfs\",\n        \"content\": \"hello\",\n        \"created_at\": \"2023-08-06T00:01:33.143532-04:00\",\n        \"updated_at\": \"2023-08-06T00:01:33.143532-04:00\"\n    }\n}\n```\n\n-   `/api/{document}/raw`: Fetch Document - Raw\n    -   `{document}` = Document ID\n    -   Document ID lengths vary between instances. For `spaceb.in`, they will be exactly 8 characters\n    -   Returns a `plain/text` file containing the content of the document.\n\n\u003e [!TIP]\n\u003e There are two additional non-API routes: `/ping`: returns a 200 OK if the service is online, and `/config`: returns a JSON body with the instances configuration settings.\n\n## Credits\n\nSpacebin is a project designed and maintained by Luke Whritenour. Spacebin started out as a fork of [hastebin](https://github.com/toptal/haste-server). Although it no longer contains _any_ code from the original, we'd like to acknowledge our roots regardless.\n\nSpacebin itself is built using Go and various libraries (i.e. [Chi](https://github.com/go-chi/chi), [pq](https://github.com/lib/pq), [Ozzo Validation](https://github.com/go-ozzo/ozzo-validation), [Cron](https://github.com/robfig/cron), [env](https://github.com/caarlos0/env)).\n\nA full list of code contributors is available [on Github](https://github.com/lukewhrit/spacebin/graphs/contributors). We'd also like to thank [@jackdorland](https://github.com/jackdorland) for designing our logo/brand.\n\n## Vulnerabilities\n\nThe Spacebin team takes security very seriously. If you detect a vulnerability please contact us via email (\u003chello@spaceb.in\u003e) or create a vulnerability report via Github. 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.\n\n## License\n\nSpacebin is licensed under the Apache 2.0 license. A copy of this license can be found within the [`LICENSE`](LICENSE) file.\n","funding_links":["https://github.com/sponsors/lukewhrit"],"categories":["Software","Go"],"sub_categories":["Pastebins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewhrit%2Fspacebin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukewhrit%2Fspacebin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukewhrit%2Fspacebin/lists"}