Available in French here
I don't know for you but I share links/ URLs very often. And a lot of time it's from videos, so it needs to be short and easy to remember. Something like https://c5m.ca/project is better than a random string (aka. GUID). And this is how I started a project to build a URL Shortener. I wanted to be budget-friendly, easy to deploy and customizable.
In this post, I will share how I build it, how you can use it, and how you can help!
How I build it, with the community
This tool was build during live streams coding sessions on Twitch (all videos are in available in my YouTube archive). It's composed of two parts: a Serverless backend leveraging the Azure Function & Azure Storage, and a frontend of your choice.
The backend is composed of a few Azure Functions that act as an on-demand HTTP API. They only consume when they are called. They are in .Net Core, C# to be specific. When publishing this post, there are four functions:
- UrlShortener: To create a short URL.
- UrlRedirect: That's the one called when a short link is used. An Azure Function Proxy is forwarding all call to the root.
- UrlClickStats: Return the statistic for a specific URL.
- UrlList: Return the list of all URLs created.
All the information like long url, short url, click count are save in an Azure Storage Table.
And that's it. Super light, very cost-efficient. IF you are curious about the price I'll but references in the footnotes
The frontend could be anything that can make HTTP requests. Right now in the project, I explain how to use a tool call Postman, there is also a very simple interface done that you can easily deploy.
This simple interface is of course protected and gives you the options to see all URLs and create new ones.
How YOU can use it
All the code is available into GitHub, and it's deployable with a one-click button!
This will deploy the backend in your Azure subscription in a few minutes. If you don't own an Azure subscription already, you can create your free Azure account today.
Then you will probably want an interface to create your precious URLs. Once more in the GitHub repository, there is a List of available Admin interfaces and ready to be used. The Admin Blazor Website is currently the most friendly and can also be deployed in one-click.
How You can help and participate
Right now, there is really only one interface (and some instructions on how to use Postman to do the HTTP calls). But AzUrlShortener is an open-source project, meaning you can participate. Here some suggestions:
- Build a new interface (in the language of your choice)
- Improve current interface(s) with
- Better UI 🙂
- Register bugs in GitHub
- Make feature request
- Help with documentation/ translation
Definitely come see the GitHub repo https://github.com/FBoucher/AzUrlShortener, click those deploy buttons. On my side, I will continue to add more features and make it better. See you there!