{"id":21954528,"url":"https://github.com/lakhindarpal/snippets","last_synced_at":"2025-03-22T18:29:52.530Z","repository":{"id":262738154,"uuid":"887640427","full_name":"LakhindarPal/snippets","owner":"LakhindarPal","description":"A simple, open-source pastebin web application","archived":false,"fork":false,"pushed_at":"2024-11-23T00:24:59.000Z","size":17,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-19T23:33:40.690Z","etag":null,"topics":["cloudflare-kv","cloudflare-workers","code-highlight","code-sharing","hastebin","highlightjs","pastebin","prism","prismjs","snippets","worker"],"latest_commit_sha":null,"homepage":"https://snippets.lpal.workers.dev/","language":"JavaScript","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/LakhindarPal.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}},"created_at":"2024-11-13T02:55:47.000Z","updated_at":"2025-01-28T16:12:21.000Z","dependencies_parsed_at":"2025-01-27T22:47:24.277Z","dependency_job_id":"47c41889-e54e-40d9-9656-9adbea86f028","html_url":"https://github.com/LakhindarPal/snippets","commit_stats":null,"previous_names":["lakhindarpal/snippets"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakhindarPal%2Fsnippets","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakhindarPal%2Fsnippets/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakhindarPal%2Fsnippets/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LakhindarPal%2Fsnippets/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LakhindarPal","download_url":"https://codeload.github.com/LakhindarPal/snippets/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245002146,"owners_count":20545380,"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-kv","cloudflare-workers","code-highlight","code-sharing","hastebin","highlightjs","pastebin","prism","prismjs","snippets","worker"],"created_at":"2024-11-29T07:19:42.563Z","updated_at":"2025-03-22T18:29:47.511Z","avatar_url":"https://github.com/LakhindarPal.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Snippets\n\nA simple, open-source pastebin web application built with [PrismJS](https://prismjs.com/), [Cloudflare Workers](https://developers.cloudflare.com/workers/), and [Cloudflare KV](https://developers.cloudflare.com/workers/runtime-apis/kv). Users can share code snippets, text, or other types of information with syntax highlighting and an easy-to-use interface.\n\n## Features\n\n- **Syntax Highlighting**: Automatically applies syntax highlighting using PrismJS.\n- **Fast \u0026 Scalable**: Deployed with Cloudflare Workers and powered by Cloudflare KV for storage.\n- **Minimal UI**: Simple, clean design for pasting and sharing content.\n- **Share Links**: Generates unique, permanent URLs for each paste.\n- **Open Source**: Fully open-source and customizable.\n\n## Technologies\n\n- **PrismJS**: Lightweight, extensible syntax highlighter for web code snippets.\n- **Cloudflare Workers**: A serverless compute platform to run JavaScript code close to your users.\n- **Cloudflare KV**: A key-value store for fast, distributed data storage.\n\n## Demo\n\nYou can try out the demo [here](https://snippets.lpal.workers.dev/).\n\n## Installation\n\nTo run this project locally, you'll need to have a Cloudflare account and set up Cloudflare Workers.\n\n### Prerequisites\n\n- [Node.js](https://nodejs.org/) (LTS version recommended)\n- [Wrangler](https://developers.cloudflare.com/workers/platform/cli-wrangler/) (Cloudflare Workers CLI)\n- [Cloudflare Account](https://dash.cloudflare.com/)\n\n### Steps to Run Locally\n\n1. **Clone the Repository**:\n\n   ```bash\n   git clone https://github.com/LakhindarPal/snippets.git\n   cd snippets\n   ```\n\n2. **Install Dependencies**:\n\n   ```bash\n   npm install\n   ```\n\n3. **Set Up Cloudflare Workers**:\n\n   - [Create a Cloudflare Worker](https://developers.cloudflare.com/workers/get-started/).\n   - Set up KV storage and create a KV binding in your Cloudflare Workers dashboard.\n   - Add your KV namespace binding to `wrangler.toml`:\n\n     ```toml\n     kv_namespaces = [\n       { binding = \"PASTEBIN_KV\", id = \"your-kv-namespace-id\" }\n     ]\n     ```\n\n4. **Configure Your Environment**:\n\n   Make sure the necessary environment variables are set in `wrangler.toml` or `.env` (like your KV namespace ID).\n\n5. **Run the Worker Locally**:\n\n   ```bash\n   wrangler dev\n   ```\n\n   Visit `http://localhost:8787` in your browser to test the app locally.\n\n6. **Deploy to Cloudflare**:\n\n   Once you're ready to deploy, run:\n\n   ```bash\n   wrangler publish\n   ```\n\n## How It Works\n\n1. **Creating a Paste**:  \n   When a user submits a new paste, the content is stored in Cloudflare KV, and a unique URL is generated for the paste.\n\n2. **Viewing a Paste**:  \n   When a user visits a URL (e.g., `https://snippets.\u003cSUB_DOMAIN\u003e.workers.dev//a1b2c4d5`), the content is fetched from KV and displayed with PrismJS syntax highlighting.\n\n3. **Editing/Deleting**:  \n   Currently, this implementation only supports creating and viewing pastes. You can easily extend it with features like editing or deleting pastes.\n\n## Contributing\n\nContributions are welcome! Please fork the repository and submit a pull request with your changes. Here are some ways you can help:\n\n- Report bugs or issues.\n- Suggest new features or improvements.\n- Improve documentation.\n\nPlease make sure your changes pass the existing tests and follow the project's code style.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgements\n\n- [PrismJS](https://prismjs.com/) for syntax highlighting.\n- [Cloudflare Workers](https://developers.cloudflare.com/workers/) for serverless backend.\n- [Cloudflare KV](https://developers.cloudflare.com/workers/runtime-apis/kv) for fast, distributed storage.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakhindarpal%2Fsnippets","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flakhindarpal%2Fsnippets","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flakhindarpal%2Fsnippets/lists"}