{"id":13674606,"url":"https://github.com/wantguns/bin","last_synced_at":"2025-04-07T10:23:06.243Z","repository":{"id":41849248,"uuid":"325404652","full_name":"wantguns/bin","owner":"wantguns","description":"highly opinionated, minimal pastebin","archived":false,"fork":false,"pushed_at":"2024-04-09T16:09:36.000Z","size":9345,"stargazers_count":256,"open_issues_count":15,"forks_count":25,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T08:12:21.215Z","etag":null,"topics":["file-upload","pastebin","rocket","rust","self-hosted"],"latest_commit_sha":null,"homepage":"https://basedbin.fly.dev","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wantguns.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"copying","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-29T23:01:40.000Z","updated_at":"2025-03-28T01:24:39.000Z","dependencies_parsed_at":"2024-06-19T03:03:26.381Z","dependency_job_id":"3e0927ea-67f9-48bd-8d58-b2fbaae7a3c3","html_url":"https://github.com/wantguns/bin","commit_stats":null,"previous_names":[],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantguns%2Fbin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantguns%2Fbin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantguns%2Fbin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wantguns%2Fbin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wantguns","download_url":"https://codeload.github.com/wantguns/bin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247632474,"owners_count":20970166,"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","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":["file-upload","pastebin","rocket","rust","self-hosted"],"created_at":"2024-08-02T11:00:54.879Z","updated_at":"2025-04-07T10:23:06.195Z","avatar_url":"https://github.com/wantguns.png","language":"Rust","readme":"# Bin \nA minimal pastebin which also accepts binary files like Images, PDFs and ships\nmultiple clients. \n\nIt does not require you to host a SQL server and everything is self-contained in\na statically linked binary (the docker image runs on scratch !), which makes it\nextremely easy to deploy.\n\nTry it out on: https://basedbin.fly.dev\n\n## Clients\n\n### Web\n\nYou can paste\n\n- Normal Text\n\n- Paste Images from clipboard:  \n![clipboard-paste](.github/files/image_clipboard.gif)\n\n- Files by drag and drop:  \n![drag_n_drop](.github/files/drag_n_drop.gif)\n\n### CLI\n\n[![cli-usage](https://asciinema.org/a/khcEtveMAbjqJccySdmWuPe1l.svg)](https://asciinema.org/a/khcEtveMAbjqJccySdmWuPe1l)\n\n#### Installation\n\nGet the client from [this repository](contrib/cli/client) or from my deployed paste:\n\n```bash\ncurl -o pst https://bin.wantguns.dev/client\nchmod +x pst\n```\n\nor manually copy the following at a file in your path.\n\n```bash\n#!/bin/bash\n\n# Change the url accordingly\nURL=\"https://basedbin.fly.dev\"\n\nFILEPATH=\"$1\"\nFILENAME=$(basename -- \"$FILEPATH\")\nEXTENSION=\"${FILENAME##*.}\"\n\nRESPONSE=$(curl --data-binary @${FILEPATH:-/dev/stdin} --url $URL)\nPASTELINK=\"$URL$RESPONSE\"\n\n[ -z \"$EXTENSION\" ] \u0026\u0026 \\\n    echo \"$PASTELINK\" || \\\n    echo \"$PASTELINK.$EXTENSION\"\n```\n\nYou have the option to remove the `/client` description / help in the\nlanding page. To show the `/client` description, run the `bin` binary\nwith either `BIN_CLIENT_DESC` env variable or a `-c` flag. More on\narguments later\n\n#### Usage\n\nIt just works.\n\n```bash\n$ pst somefile.txt\n$ cat someimage.png | pst\n```\n\n### (Neo)Vim\n\n#### Installation\n\n1. Install the CLI client\n2. Append this to your init.vim / vimrc\n\n```vim\nnnoremap \u003cleader\u003ep :!pst %\u003cCR\u003e\n```\n#### Usage\n\nUse `\u003cleader\u003e + p` paste.\n\n\n## Server Deployment\n\nCurrently, builds for the following target triples are shipped:\n- x86_64-unknown-linux-gnu (amd64)\n- aarch64-unknown-linux-gnu (arm64)\n\nThe builds shipped are statically linked, so you don't even need a libc to run\nthe binary !  \nThe docker manifest labelled\n[`wantguns/bin:latest`](https://hub.docker.com/layers/wantguns/bin/latest/images/sha256-34c19b59d098bd1420fc48f6b1f01dc250d3d8787a3786f5425efb4e74cc17f2?context=repo)\nincludes the images for both amd64 and arm64 images.\n\n### Docker\n\n```bash\n$ docker run -p 6162:6162 wantguns/bin\n```\n\n### Docker Compose\n\n```yaml\nversion: '3.3'\nservices:\n  pastebin:\n    image: wantguns/bin\n    container_name: pastebin\n    ports:\n      - 127.0.0.1:6163:6163\n    environment:\n      - BIN_PORT=6163 # Defaults to 6162\n      - BIN_LIMITS={form=\"16 MiB\"}\n      - BIN_CLIENT_DESC=placeholder\n    volumes:\n      - ./upload:/upload  # upload folder will have your pastes\n```\n\n### Manual\n\n- Grab a copy of the binary from GH releases   \nOR\n- Build on your own:\n```bash\n# A statically linked build\n$ cargo build --release\n```\n\n- Execute the binary as is, no extra shenanigans needed:\n```bash\n$ ./bin\n```\n\n#### Usage\n\n```txt\nUSAGE:\n    bin [OPTIONS]\n\nOPTIONS:\n    -a, --address \u003cADDRESS\u003e\n            Address on which the webserver runs [default: 127.0.0.1]\n\n    -b, --binary-upload-limit \u003cBINARY_UPLOAD_LIMIT\u003e\n            Binary uploads file size limit (in MiB) [default: 100]\n\n    -c, --client-desc\n            Include client description [env: CLIENT_DESC=]\n\n    -h, --help\n            Print help information\n\n    -p, --port \u003cPORT\u003e\n            Port on which the webserver runs [default: 6162]\n\n    -u, --upload \u003cUPLOAD\u003e\n            Path to the uploads folder [default: ./upload]\n\n    -V, --version\n            Print version information\n```\n\n#### Configuration\n\nThis pastebin utilizes a custom configuration provider from Rocket. Apart from\nthe essential arguments, you can also use environment variables, which have the\nhighest preference in order.\n\nEverything from the [official Rocket\ndoc](https://rocket.rs/v0.5/guide/configuration/#overview) is supported,\njust that you have to prefix the env variable with \"BIN_\":\n```txt\nBIN_PORT=6163\nBIN_ADDRESS=0.0.0.0\nBIN_LIMITS={form=\"16 MiB\"}\nBIN_WORKERS=8\nBIN_IDENT=false\n...\n```\n\n\n## API\n\n`GET /\u003cid\u003e`  \n  Get raw pastes\n\n`GET /p/\u003cid\u003e`  \n  Get highlighted pastes \n\n`GET /p/\u003cid\u003e.\u003cext\u003e `  \n\n  Get syntax highlighted pastes.  \n  E.g. https://basedbin.fly.dev/p/foobaz.cpp should return a C++ syntax\n  highlighted paste\n\n`POST /`  \n  Post binary data\n\n## Design Decisions\n\nThis pastebin: \n\n- does not use a database. It lacks non-essential features like\n  password-protection / automatic deletion as a result of which, it can do\n  completely fine with flat filesystems. As an upside (opinionated), it makes\n  deploying it easier.\n- uses server sided highlighting, which ensures that everything stays light and\n  snappy at the client side.\n- uses very minimal frontend because a pastebin does not need it. It focuses\n  (or atleast tries to) on getting things done in minimum amount of clicks.\n\n## Hacking\n\n- If you want to ensure your pushed refs will pass CI, add the prepush script\n  to your Git hooks:\n\n  ```bash\n  $ cp -a tools/prepush .git/hooks/pre-push\n  ```\n\n  Alternately, just run `./tools/prepush` yourself before pushing.\n\n- The Cargo configuration for this project is set for statically compiled\n  builds. You can check out the [config file](.cargo/config.toml) to know more.\n- Read the [buildci](.github/workflows/buildci.yml) to know how the project is\n  statically compiled for two architectures.\n","funding_links":[],"categories":["self-hosted","Software","Rust"],"sub_categories":["Pastebins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwantguns%2Fbin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwantguns%2Fbin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwantguns%2Fbin/lists"}