Short is a lightweight and simple link shortener working on Cloudflare Workers®.
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
The goal of this project is to create a lightweight and simple url shortener that simply runs on Cloudflare Workers® and is deployed by GitHub Actions. It uses the native Cloudflare Workers® SDK without any additional packreges to be as minimal and cheap as possible. Short provides a simple API to create and manage new links.
This is an explanation of how you can get your own instance of short up and running.
Before you get started, you need to have a few things ready:
Caution
When you fork the repository unselect "Copy the main
branch only" else you will only be able to use the development version.
- Fork the repository to your own account with all branches.
- A Cloudflare® API Key with the necessary permissions to create and manage workers.
- Follow the instructions here to get your API Key.
- A Cloudflare® KV Namespace to store the links.
- Follow the instructions here to create a new KV Namespace. (Recommended: Select Dashboard in the documentation)
Important
It is mandatory to follow the following steps to ensure that a stable version is deployed. If you want to deploy the development version, you can do so by selecting the main
branch in the workflow.
-
Create following secrets in your forked repository: (Settings > Secrets and variables > New Repository Secret)
CF_API_TOKEN
- Your Cloudflare® API TokenCF_KV_ID
- Your Cloudflare KV Namespace ID- To get your KV Namespace ID, go to your Cloudflare® Dashboard, select your KV Namespace and copy the which is next to the name in the top left.
SHORT_API_KEY
- Recommended: A random string if you want to secure your API.
-
Activate GitHub Actions in your repository.
- Go to the
Actions
tab in your repository. - Click on the green button
I understand my workflows, go ahead and enable them
to enable GitHub Actions.
- Go to the
-
Run the workflow
🚀 Deploy
.- On your repository page, click on the
Actions
tab. - Click on the
🚀 Deploy
workflow on the left side. - Click on the
Run workflow
button on the right side.- Click on the
Branch: main
dropdown. - Select the branch
production
.
- Click on the
- Run the workflow by clicking the green
Run workflow
button.
- On your repository page, click on the
-
(Recommended) Install the pull app to the repository. It will automatically update the production branch. Just install it and you are done, everything is preconfigured and will be updated automatically.
🚀 All done! How simple huh? Now you can see your worker active here in your Cloudflare dashboard.
Short provides a simple API to create and manage new links. The API is secured by an API key which you can set in the secrets of your repository.
For detailed documentation, please refer to the API Documentation
- Simple web interface to create and manage links.
- Custom link expiration.
- Custom link statistics.
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Joshua Schmitt - @jqshuv - [email protected]
Project Link: https://github.com/jqshuv/short
- Cloudflare and GitHub for the amazing services.
- Best-README-Template for the README template.
- Cloudflare Worker - Status Page for the actions workflow inspiration.
- YAML Update Action for the actions workflow tools.
- Bump.sh for the API documentation platform.
- Contrib.rocks for the contributors badge.
- Shields.io for the badges.
- API-Fiddle for the API documentation generation.
- Cloudflare Workers SDK for the SDK and inspiration for code structure.
- Devin's Badges for the badges and inspiration for the logo and banner.
- And of course, the amazing open-source community! 🚀
- Cloudflare, the Cloudflare logo, Cloudflare Workers® adn the Cloudflare Workers® logo are registered trademarks of Cloudflare, Inc. in the United States and other countries.
- GitHub, GITHUB, the GitHub logo(s), and the GitHub Actions logo are registered trademarks of GitHub, Inc. in the United States and other countries.
Me and this project are not affiliated with Cloudflare, Inc. or GitHub, Inc. in any way. The use of the trademarks is only for identification and explanation purposes. The use of the trademarks does not imply any endorsement by the trademark owners. If you have any questions or concerns, please contact me at [email protected]. I do not claim any ownership of the trademarks. All rights belong to their respective owners. Thank you for your understanding.