{"id":17872196,"url":"https://github.com/sharzyl/pastebin-worker","last_synced_at":"2025-05-15T00:06:48.703Z","repository":{"id":43932541,"uuid":"352382320","full_name":"SharzyL/pastebin-worker","owner":"SharzyL","description":"Pastebin on Cloudflare worker, with friendly CLI usage and rich features","archived":false,"fork":false,"pushed_at":"2025-05-04T03:11:54.000Z","size":899,"stargazers_count":832,"open_issues_count":3,"forks_count":273,"subscribers_count":7,"default_branch":"goshujin","last_synced_at":"2025-05-04T04:19:51.735Z","etag":null,"topics":["cloudflare-worker","pastebin","self-hosted","wrangler"],"latest_commit_sha":null,"homepage":"https://shz.al","language":"TypeScript","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/SharzyL.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2021-03-28T16:40:15.000Z","updated_at":"2025-05-04T03:44:17.000Z","dependencies_parsed_at":"2024-02-08T10:31:53.820Z","dependency_job_id":"0cb30bd3-2d36-4938-bed9-407d96519826","html_url":"https://github.com/SharzyL/pastebin-worker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SharzyL%2Fpastebin-worker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SharzyL%2Fpastebin-worker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SharzyL%2Fpastebin-worker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SharzyL%2Fpastebin-worker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SharzyL","download_url":"https://codeload.github.com/SharzyL/pastebin-worker/tar.gz/refs/heads/goshujin","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254249198,"owners_count":22039029,"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":["cloudflare-worker","pastebin","self-hosted","wrangler"],"created_at":"2024-10-28T10:40:35.000Z","updated_at":"2025-05-15T00:06:48.648Z","avatar_url":"https://github.com/SharzyL.png","language":"TypeScript","readme":"# Pastebin-worker\n\nThis is a pastebin that can be deployed on Cloudflare workers. Try it on [shz.al](https://shz.al).\n\n**Philosophy**: effortless deployment, friendly CLI usage, rich functionality.\n\n**Features**:\n\n1. Share your paste with as short as 4 characters, or even customized URL.\n1. **Syntax highlighting** powered by highlight.js.\n1. Client-side encryption\n1. Render **markdown** file as HTML\n1. URL shortener\n1. Customize returned `Content-Type`\n\n## Usage\n\n1. You can post, update, delete your paste directly on the website (such as [shz.al](https://shz.al)).\n\n2. It also provides a convenient HTTP API to use. See [API reference](doc/api.md) for details. You can easily call API via command line (using `curl` or similar tools).\n\n3. [pb](/scripts) is a bash script to make it easier to use on command line.\n\n## Limitations\n\n1. If deployed on Cloudflare Worker free-tier plan, the service allows at most 100,000 reads and 1000 writes, 1000 deletes per day.\n\n## Deploy\n\nYou are free to deploy the pastebin on your own domain if you host your domain on Cloudflare.\n\n1. Install `node` and `yarn`.\n\n2. Create a KV namespace and R2 bucket on Cloudflare workers dashboard, remember its ID.\n\n3. Clone the repository and enter the directory.\n\n4. Modify entries in `wrangler.toml`. Its comments will tell you how.\n\n5. Login to Cloudflare and deploy with the following steps:\n\n```console\n$ yarn install\n$ yarn wrangler login\n$ yarn build:frontend\n$ yarn deploy\n```\n\n6. Enjoy!\n\n## Auth\n\nIf you want a private deployment (only you can upload paste, but everyone can read the paste), add the following entry to your `wrangler.toml`.\n\n```toml\n[vars.BASIC_AUTH]\nuser1 = \"passwd1\"\nuser2 = \"passwd2\"\n```\n\nNow every access to POST request, and every access to static pages, requires an HTTP basic auth with the user-password pair listed above. For example:\n\n```console\n$ curl example-pb.com\nHTTP basic auth is required\n\n$ curl -Fc=@/path/to/file example-pb.com\nHTTP basic auth is required\n\n$ curl -u admin1:wrong-passwd -Fc=@/path/to/file example-pb.com\nError 401: incorrect passwd for basic auth\n\n$ curl -u admin1:this-is-passwd-1 -Fc=@/path/to/file example-pb.com\n{\n  \"url\": \"https://example-pb.com/YCDX\",\n  \"admin\": \"https://example-pb.com/YCDX:Sij23HwbMjeZwKznY3K5trG8\",\n  \"isPrivate\": false\n}\n```\n\n## Administration\n\nDelete a paste:\n\n```console\n$ yarn delete-paste \u003cname-of-paste\u003e\n```\n\nList pastes:\n\n```console\n$ yarn -s wrangler kv key list --binding PB \u003e kv_list.json\n```\n\n## Development\n\nNote that the frontend and worker code are built separatedly. To start a Vite development server of the frontend,\n\n```console\n$ yarn dev:frontend\n```\n\nTo develop the backend worker, we must build a develop version of frontend,\n\n```console\n$ yarn build:frontend:dev\n```\n\nThen starts a local worker,\n\n```console\n$ yarn dev\n```\n\nThe difference between `build:frontend:dev` and `build:frontend` is that the former will points the API endpoint to your deployment URL, while the later points to `http://localhost:8787`, the address of a local worker.\n\nRun tests:\n\n```console\n$ yarn test\n```\n\nRun tests with coverage report:\n\n```console\n$ yarn coverage\n```\n\nRemember to run eslint checks and prettier before commiting your code.\n\n```console\n$ yarn fmt\n$ yarn lint\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharzyl%2Fpastebin-worker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsharzyl%2Fpastebin-worker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsharzyl%2Fpastebin-worker/lists"}