{"id":13674608,"url":"https://github.com/matze/wastebin","last_synced_at":"2025-12-25T18:52:11.620Z","repository":{"id":37545681,"uuid":"497728416","full_name":"matze/wastebin","owner":"matze","description":"wastebin is a pastebin 📝","archived":false,"fork":false,"pushed_at":"2024-10-26T20:21:44.000Z","size":1250,"stargazers_count":320,"open_issues_count":19,"forks_count":27,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-10-29T18:31:50.144Z","etag":null,"topics":["axum","pastebin","rust","self-hosted","sqlite"],"latest_commit_sha":null,"homepage":"https://bin.bloerg.net","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matze.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2022-05-29T23:02:01.000Z","updated_at":"2024-10-28T10:46:39.000Z","dependencies_parsed_at":"2023-02-12T09:31:05.873Z","dependency_job_id":"c4b0f0ff-7e8c-4acb-8775-b71c004748bd","html_url":"https://github.com/matze/wastebin","commit_stats":null,"previous_names":[],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matze%2Fwastebin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matze%2Fwastebin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matze%2Fwastebin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matze%2Fwastebin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matze","download_url":"https://codeload.github.com/matze/wastebin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248590942,"owners_count":21129916,"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":["axum","pastebin","rust","self-hosted","sqlite"],"created_at":"2024-08-02T11:00:54.906Z","updated_at":"2025-12-25T18:52:11.612Z","avatar_url":"https://github.com/matze.png","language":"Rust","readme":"# \u003cimg width=\"24px\" height=\"24px\" style=\"position: relative; top: 2px;\" src=\"assets/favicon.png\"/\u003e wastebin\n[![Rust](https://github.com/matze/wastebin/actions/workflows/rust.yml/badge.svg)](https://github.com/matze/wastebin/actions/workflows/rust.yml)\n\n## \u003cstrong\u003e\u003ca href=\"https://war.ukraine.ua/support-ukraine/\"\u003esupport 🇺🇦\u003c/a\u003e • \u003ca href=\"https://commission.europa.eu/strategy-and-policy/state-union/state-union-2022/defending-eu-values\"\u003edefend 🇪🇺\u003c/a\u003e\u003c/strong\u003e\n\nA minimal pastebin with a design shamelessly copied from\n[bin](https://github.com/WantGuns/bin).\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/matze/wastebin/master/assets/screenshot.webp\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cstrong\u003e\u003ca href=\"https://bin.bloerg.net\"\u003eDEMO\u003c/a\u003e\u003c/strong\u003e (resets every day)\u003c/p\u003e\n\nYou are reading the documentation for an **unreleased version**. You can refer\nto released versions here:\n\n**[3.4.0](https://github.com/matze/wastebin/tree/c9d717329a6e357e8a13a324bfa9a53d41ae9b35)** •\n[3.3.0](https://github.com/matze/wastebin/tree/a297749b932ed9ff32569f3af7ee8e4a5b499834) •\n[3.2.0](https://github.com/matze/wastebin/tree/3fdec3abde4f32b92323864ffea51577ce1e625e) •\n[3.1.0](https://github.com/matze/wastebin/tree/e404ecec61eaafa1187b8d6b45282d72b076563d) •\n[3.0.0](https://github.com/matze/wastebin/tree/14a30bb540110e76da6a6045cd0e83fd2218cdd7) •\n[2.7.1](https://github.com/matze/wastebin/tree/85a519ef9079c4618f851cce575b5a84334a6f42)\n\n## Features\n\n* [axum](https://github.com/tokio-rs/axum) and [sqlite3](https://www.sqlite.org) backend\n* comes as a single binary with low memory footprint\n* compresses pastes using [zstd](https://github.com/facebook/zstd)\n* syntax highlighting for \u003e 170 languages with [syntect](https://github.com/trishume/syntect)\n* comes with [eight color themes](https://matze.github.io/wastebin/) in light and dark mode\n* encrypts entries using ChaCha20Poly1305 and argon2 hashed passwords\n* allows deletion after expiration, after reading or by anonymous owners\n* shows QR code to browse a paste's URL on mobile devices\n\n### Non-features\n\n* user authentication and admin functionality\n* arbitrary file uploads\n* mitigations for all kinds of DoS attack vectors\n\n\u003e [!CAUTION]\n\u003e Due to lack of authentication and further DoS mitigations, it is not advised\n\u003e to run wastebin facing the internet _as is_. If you plan to do so, you are\n\u003e strongly advised to rate limit inbound requests via iptables rules or a\n\u003e properly configured reverse proxy of your choice.\n\n\n## Installation\n\n### Run pre-built binaries\n\nYou can download pre-built, statically compiled [Linux and MacOS\nbinaries](https://github.com/matze/wastebin/releases). After extraction run the\ncontained `wastebin` binary.\n\n### Run a Docker image\n\nAlternatively, you can run a pre-built Docker image pushed to\n`quxfoo/wastebin:\u003cVERSION\u003e` and `quxfoo/wastebin:latest` respectively. To\npersist the database as `state.db` via the `WASTEBIN_DATABASE_PATH` environment\nvariable use a bind mount to `/path/for/storage` like this\n\n```bash\ndocker run \\\n    -e WASTEBIN_DATABASE_PATH=/data/state.db \\\n    -v /path/for/storage:/data \\\n    -u $(id -u):$(id -g) \\\n    quxfoo/wastebin:latest\n```\n\n\u003e [!NOTE]\n\u003e The image is based on scratch which means it neither comes with a shell nor\n\u003e with `TMPDIR` being set. If database migrations fail with an extended sqlite\n\u003e error code 6410, pass `TMPDIR` pointing to a location sqlite can write to.\n\n\n### Run with docker-compose\n\n```yaml\nservices:\n  wastebin:\n    restart: always\n    environment:\n      - WASTEBIN_DATABASE_PATH=/data/state.db\n    ports:\n      - \"8088:8088\"\n    volumes:\n      - './data:/data'\n    image: 'quxfoo/wastebin:latest'\n```\n\nMake sure the `./data` folder is writable by the user 10001.\n\n\n### Run with Nix\n\nFor Nix users, a `flake.nix` is also provided. Build and execute it directly\nwith:\n\n```bash\nnix run 'github:matze/wastebin#wastebin'\n```\n\nOr install the provided `wastebin` package like you normally would.\n\n\n### Build from source\n\nInstall a Rust 2024 toolchain containing Rust 1.85 with\n[rustup](https://rustup.rs) and run the server binary with\n\n```bash\ncargo run --release\n```\n\n\n### Build a container image\n\nIt is possible to build a container image using Docker or Podman. The\n`Dockerfile` is designed to be run on an x86_64 host but capable of building\nimages for both x86_64 and aarch64 via the `--target` flag:\n\n```bash\n# Docker\ndocker build -t wastebin:v3.0.0 -f Dockerfile --target amd64 .\ndocker build -t wastebin:v3.0.0 -f Dockerfile --target arm64 .\n\n# Podman\npodman build -t wastebin:v3.0.0 -f Dockerfile --target amd64\npodman build -t wastebin:v3.0.0 -f Dockerfile --target arm64\n```\n\nNote that you *cannot* build aarch64 images on aarch64 hosts with it.\n\nTo interact with a running wastebin instance the bundled `wastebin-ctl` tool can\nbe used, e.g.:\n\n```bash\npodman exec -e RUST_LOG=debug -it wastebin /app/wastebin-ctl\n```\n\n## Usage\n\n### Browser interface\n\nWhen viewing a paste, you can use\n\n* \u003ckbd\u003er\u003c/kbd\u003e to view the raw paste,\n* \u003ckbd\u003en\u003c/kbd\u003e to go the index page,\n* \u003ckbd\u003ey\u003c/kbd\u003e to copy the current URL to the clipboard,\n* \u003ckbd\u003ec\u003c/kbd\u003e to copy the content to the clipboard,\n* \u003ckbd\u003eq\u003c/kbd\u003e to display the current URL as a QR code,\n* \u003ckbd\u003ep\u003c/kbd\u003e to view the formatted paste and\n* \u003ckbd\u003ew\u003c/kbd\u003e to toggle line wrapping on and off (off by default)\n* \u003ckbd\u003e?\u003c/kbd\u003e to view the list of keybindings.\n\nTo paste some text you can also use the \u003ckbd\u003ectrl\u003c/kbd\u003e+\u003ckbd\u003es\u003c/kbd\u003e key\ncombination.\n\n\n### Configuration\n\nThe following environment variables can be set to configure the server and\nrun-time behavior:\n\n| Variable                          | Description                                                   | Default               |\n| --------------------------------- | ------------------------------------------------------------- | --------------------- |\n| `WASTEBIN_ADDRESS_PORT`           | Address and port to bind the server to.                       | `0.0.0.0:8088`        |\n| `WASTEBIN_BASE_URL`               | Base URL for the QR code display.                             |                       |\n| `WASTEBIN_CACHE_SIZE`             | Number of rendered items to cache. Disable with 0.            | `128`                 |\n| `WASTEBIN_DATABASE_PATH`          | Path to the sqlite3 database file.                            | `:memory:`            |\n| `WASTEBIN_HTTP_TIMEOUT`           | Maximum number of seconds a request is processed until wastebin responds with 408. | `5` |\n| `WASTEBIN_MAX_BODY_SIZE`          | Number of bytes to accept for POST requests.                  | `1048576`, i.e. 1 MB  |\n| `WASTEBIN_PASSWORD_SALT`          | Salt used to hash user passwords used for encrypting pastes.  | `somesalt`            |\n| `WASTEBIN_PASTE_EXPIRATIONS`      | Possible paste expirations as a comma-separated list of seconds or values with duration magnitudes (`s`, `m`, `h`, `d`, `M`, `y` for seconds, minutes, hours, days, months and years respectively). Appending `=d` to one of the value makes it the default selection. | see [here](https://github.com/matze/wastebin/blob/eb61c78506a165605f145e8374ed64822405eda0/crates/wastebin_server/src/env.rs#L166) |\n| `WASTEBIN_SIGNING_KEY`            | Key to sign cookies. Must be at least 64 bytes long.          | Random key generated at startup, i.e. cookies will become invalid after restarts and paste creators will not be able to delete their pastes. |\n| `WASTEBIN_THEME`                  | Theme colors, one of `ayu`, `base16ocean`, `catppuccin`, `coldark`, `gruvbox`, `monokai`, `onehalf`, `solarized`. See [this page](https://matze.github.io/wastebin/) for a preview. | `ayu` |\n| `WASTEBIN_TITLE`                  | HTML page title.                                              | `wastebin`            |\n| `WASTEBIN_UNIX_SOCKET_PATH`       | Path to a Unix socket to accept connections from.             |                       |\n| `RUST_LOG`                        | Log level. Besides the typical `trace`, `debug`, `info` etc. keys, you can also set the `tower_http` key to a log level to get additional request and response logs. |  |\n\n\u003e [!NOTE]\n\u003e `WASTEBIN_ADDRESS_PORT` and `WASTEBIN_UNIX_SOCKET_PATH` are mutually\n\u003e exclusive, which means that setting both will lead to an error. Setting\n\u003e neither will implicitly bind via TCP on `0.0.0.0:8088`.\n\n\n### API endpoints\n\nPOST a new paste to the `/` endpoint with the following JSON payload:\n\n```\n{\n  \"text\": \"\u003cpaste content\u003e\",\n  \"extension\": \"\u003cfile extension, optional\u003e\",\n  \"title\": \"\u003cpaste title, optional\u003e\",\n  \"expires\": \u003cnumber of seconds from now, optional\u003e,\n  \"burn_after_reading\": \u003ctrue/false, optional\u003e,\n  \"password\": \u003cpassword for encryption optional\u003e,\n}\n```\n\nAfter successful insertion, you will receive a JSON response with the path to\nthe newly created paste:\n\n```json\n{\"path\":\"/Ibv9Fa.rs\"}\n```\n\nTo retrieve the raw content, make a GET request on the `/raw/:id` route. In case\nthe paste was encrypted, pass the password via the `wastebin-password` header.\n\nTo delete a paste, make a DELETE request on the `/:id` route with the `uid`\ncookie set that was sent back in the `Set-Cookie` header of the redirect\nresponse after creation.\n\n\n### wastebin-ctl command line tool\n\n`wastebin-ctl` is a command line tool to interact directly with the wastebin\ndatabase. It can be used to `list` all entries, `purge` entries which have\nexpired or `delete` specific entries. To specify the database either use the\n`--database` option or set the `WASTEBIN_DATABASE_PATH` environment variable as\nusual.\n\n\n### Paste from neovim\n\nUse the [wastebin.nvim](https://github.com/matze/wastebin.nvim) plugin and paste\nthe current buffer or selection with `:WastePaste`.\n\n\n### Paste from clipboard\n\nTo paste clipboard data from the command line you can use the aforementioned API\ncalls together with `xclip`, `curl` and `jq`. Define the following function in\nyour `.bashrc` and you are good to go:\n\n```bash\nfunction paste_from_clipboard() {\n    local API_URL=\"https://wastebin.tld\"\n    local URL=$(\\\n        jq -n --arg t \"$(xclip -selection clipboard -o)\" '{text: $t}' | \\\n            curl -s -H 'Content-Type: application/json' --data-binary @- ${API_URL}/ | \\\n            jq -r '. | \"'${API_URL}'\\(.path)\"' )\n\n    xdg-open $URL\n}\n```\n\nFor wayland users, consider replace the `xclip ...` with `wl-paste` from `wl-clipboard`.\n\n### Paste from stdin\n\nTo paste from stdin use the following function in your `.bashrc`:\n\n```bash\nfunction paste_from_stdin() {\n    local API_URL=\"https://wastebin.tld\"\n    jq -Rns '{text: inputs}' | \\\n        curl  -s -H 'Content-Type: application/json' --data-binary @- ${API_URL}/ | \\\n        jq -r '. | \"'${API_URL}'\\(.path)\"'\n}\n```\n\nIt can be handy for creating pastes from logs or the output of commands, e.g.\n`cat file.log | paste_from_stdin`.\n\n\n## License\n\n[MIT](./LICENSE)\n","funding_links":[],"categories":["Install from Source","Software","Rust","sqlite","self-hosted"],"sub_categories":["Pastebins"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatze%2Fwastebin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatze%2Fwastebin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatze%2Fwastebin/lists"}