Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: I made an open-source Bitly alternative (dub.sh)
255 points by steventey on Sept 22, 2022 | hide | past | favorite | 207 comments



You should add a way to export all the URLs on the platform in a format that matches the URLTeam (https://wiki.archiveteam.org/index.php/URLTeam) releases.

That way, when you shut down your service, we can figure out what some of these short links went to.


> when you shut down

That's a reasonable assumption, since the service is not likely to be sustainable financially.


Why shouldn't it be sustainable? Seems like the sort of service where a freemium AGPL open source model might work quite well.


Hosting costs money regardless of whether the underlying codebase is open source, but why would anyone pay for a URL shortener? Maybe those things had a use a decade ago but I don't see a use for them nowadays and definitely not enough to pay for one.


"but why would anyone pay for a URL shortener?"

If you are sending automated sms, to around phone carrier blocking people use bit.ly etc. A new domain would take a lot of testing.


Agreed – the plan is to keep this running as long as possible, and the freemium AGPL model is a great way to get there in a sustainable pace! :)


Sorry for the pessimistic quip.

I love that it's open source, the site design is beautiful, and the service looks well made. Good luck!


Appreciate the kind words! :)


Best of luck!


As part of url derive process, you could kick off a process to archive the redirect with the Internet Archive. When you turn the service down, no further action is required. It can die at anytime and no one is worse off.


FYI you have some rogue script or something on the page that brings my pretty hefty windows 10 pc to a halt. It spikes my CPU to 100% and the page is in like 1FPS. I think it's your countdown thing for pricing. Something is def up with it, you may want to disable that temp.


Hey everyone! My good friend & colleague Shu just pushed a PR that should mitigate this: https://github.com/steven-tey/dub/pull/13

Can y'all check again and let me know if the performance issue is still bad? Feel free to reply here or send me an email at steven[at]dub.sh

FYI Shu (https://github.com/shuding) is the creator of the globe library that I'm using on the home page: https://cobe.vercel.app, it's really good!


I was doing "native compile" of several hundred el scripts for emacs and my computer was fine, clicked on that page and everything started taking a couple seconds to click afterwards lol. Definitely something up with the javascript on there.


Next.js strikes again. :-)


I'd guess it's the rotating globe canvas animation showing real-time stats.


Yeahhhh...I recently merged a PR that should fix this though! let me know if it's still performing badly!

https://github.com/steven-tey/dub/pull/13


FTW!


Chiming in - brought down my Chrome tab on a Ryzen 3600x. All for a page to display pricing.

I don't get it.


I think it literally killed my M1 MBP during a meeting this morning (had a few tabs and a zoom meeting running). My screen went black and everything locked. I had to hold down the power button to reboot.


How can a single, unprivileged process in an multi-task OS cause such effect?


I believe it's something to do with the canvas size not being optimized: https://github.com/steven-tey/dub/issues/11#issue-1382789740

I just merged a PR to fix this though – are you still facing this issue?


Same thing here. After scrolling about halfway through the page, fans went off and the whole site came to a crawl. Could also be the globe animation.


Ahh yes I believe it's the globe animation, it uses a very simple stripped down version of webgl & threejs (based on the lib: https://cobe.vercel.app/)

Gonna think about how I can optimize that further! Thanks for the headsup y'all!


you could render a mp4 or webm video, it wouldn't be as fancy but would just work


I genuinely thought it was my graphic driver glitch that for a second all my screens went dark. Not until I read your comment here did I realise they were connected.


Slows down my pretty basic laptop as well.


Have you tried this? https://www.downloadmoreram.com/


You know, if you put your paging file into your Google Drive, Dropbox, etc., you're effectively downloading more RAM.


I wanted to add to this, but the edit window has ended so...

To go even further, if you have gigabit internet and the data center that hosts your drive is in the same city as you, then putting your swap in cloud storage could potentially be faster than storing it on a hard drive!

Obviously, this is making a lot of assumptions, like your ISP doesn't do any silly routing (I'm in Portland, and for a while a couple years ago, my ISP routed all my traffic through Seattle), assumes the cloud storage provider is using solid state storage, and all the code involved in retrieving it doesn't add more than a couple ms of latency.


I wonder what we'd need to store data 'in transit'.

There's a delay with data reaching a location, so why can't we send data to ourselves around the globe and when it gets to us, send it around again.. just around and around.


Heh, people have done it with NAS apparently https://superuser.com/a/861203


No joke! Typing this from my phone as it somehow froze the browser on my workstation.


Same here too.... 8% CPU and 95-100% GPU usage (Firefox, latest version/patch)


It spikes my GPU to 100% as soon as I open the page.


Yep. Brought my 16GB Macbook Pro to a halt.


Sorry, if you want to see the spinning globe, you'll need an M1.


Maybe it's the 3D sphere


I really hate link shorteners, because they inevitably die and leave a spray of broken links over the web. What’s wrong with normal URLs?


how else would you embed tracking params into spam links sent over sms, riddle me that


Query strings after an image URL are the most common I have seen.

    https://some.tld/obvious-tracking/some-transparent.png?someUniqueCode


But now you've burned about 40% of your character limit.


Fair enough. I hope that should I ever get a smart phone that there are filters to make all SMS text only. My current flip-phone just renders html as text and binary images as garbled junk.


> I'm OK with this.

I mean, on a personal level sure, but if you need to get out an SMS with a link and a coherent message, you want all the characters you can get.


In that case I would go with a tiny SMS specific domain for the company and a tiny query string. https://my.tld/r?B33F Two hex values should allow for a large number of redirects for a single company. Or even one hex code and use a different letter /a?00 /a?FF /b?AF etc... 36x255

I would give the marketing/sales team a way to update the letter/HEX map as a plain text file.


Cool, but now we have implemented a link shortener, in response to a post saying "What’s wrong with normal URLs?"


I was suggesting a way to make short url's without using someone elses URL shortener. If one controls the mapping it will persist as long as that company hosting it exists. It wont vanish and the webmaster/developers can update URL's as they see fit.


Not to mention the fact that they can be abused to redirect into malicious sites, but I think that is pretty obvious at this point.


Agreed I think on bitly at least you can use some character after the URL - I think its bit.ly/somethingsomething+ (the plus) - and you get a bitly page that shows you where the URL is supposed to land.

I think tinyurl had a similar mechanism.


TinyURL has a feature called preview mode, which allows you to automatically preview any URL before getting redirected without using the extra +. I think it's a nice feature.


IIRC, tinyurl also rewrites URLs to some commerce sites to include their affiliate token.


It used to show you all the click stats too, it was useful to see how everyone's ad campaigns were doing


>What’s wrong with normal URLs?

Length (in many contexts). Agree or disagree, but that answers your question for the "why" from what I have seen in my experience. Marketing wants to link to something sexy like "te.st/dog" vs "news.ycombinator.com/item?id=32939407". Many sites may have longer url structures (esp nested structures) for various reasons that are not easy to remember or sexy to have on an ad, so when it's short it's easy to remember, and simple to type out for the user.


Tim Berners-Lee invented hyperlinks so that URLs can be shortened to a single word, character or even image while keeping them visible to the user if need to by hovering over it.

People using these kind of links shorterner are people using bad tools and bad UIs. This is that usage that needs to be corrected, and not by inventing things even more stupid.


You can't put a hyperlink on a magazine, the tv, or the radio. There are definitely reasonable applications of shortened URLs that apply outside of the normal day-to-day web browsing and applications.


qrcodes are superior for most printed usage.

It never occured to me to type an url from a radio or TV message and I've never heard anyone spelling an url from a url shortener. All TV/radio broadcasters will rather tell you check for more information in "name of the show" on "domain of the TV/radio channel" or their social media feed. They all have a web presence anyway.


> qrcodes are superior for most printed usage.

Agreed

>It never occurred to me to type an url from a radio or TV message and I've never heard anyone spelling an url from a url shortener.

It happens. How do I know? Every time I've included a url (shortened or not) in a radio/tv ad, I've gotten verified traffic.

> All TV/radio broadcasters will rather tell you check for more information in "name of the show" on "domain of the TV/radio channel" or their social media feed.

This is a best practice for sure, but we all answer to someone, and that someone might not care.


Just wanted to chime in and say that QR Codes are next on the roadmap! Would be fun to learn how to build those


> qrcodes are superior for most printed usage

Disagree. I can't scan or type a QR code into my computer.


That's because desktop OS vendors still haven't integrated that feature. They just don't care.

But it's not rocket science. Why the heck my iOS camera has a built in QRcode reader, but why doesn't Firefox or my webcam app on my PC?

It's niche but I always come across it when setting up a new 2FA account and I need to save the code through the mobile app instead of my PC. Such bullshit.


Can't wait to watch people trying to scan QR codes from their TV with the selfie camera on a laptop or even desktop.

Agreed that QR codes are better for mobile devices and sometimes useful on a laptop.

But also QR codes can only be scanned as long as visible.

corp.ltd/specialoffer is easy to remember and type on any device


Unrelated recommendation - 1Password will scan QR codes and can store TOTP 2fa tokens for you. I assume other password managers also have similar features.


Usuallt you don't deal with printed code when you are in front of a computer and even then it is easy to scan the code with your phone and paste the link on your computer.


I don't? I do most of my reading at home where I have multiple computers in easy reach. I'm also not sure how I'm "easily" copy/pasting between my phone/computer. Is this an iOS/OS X thing? Not everyone is in that eco-system.


I am doing that with kdeconnect/gsconnect on linux. The kdeconnect app on android is at least available on f-droid repo and allows you once on the same wifi network, to share clipboard, do mounts, transfer files, get notifications, use the phone as a remote to control the video plan of netflix/hbo/prime, etc.


Quite a number of apps allow you to easily copy/paste between Android phone and computer:

- BlitzMail, via email - Joplin, via desktop client - Nextcloud/Owncloud - Termux, e.g. via ssh, rsync, ...

Various messenger apps with desktop clients or web interfaces, e.g. Element (matrix.org) or Threema.


I run NextCloud on my computer and laptop, and just checked... no I can't "just copy/paste" from my phone to my computer, or at least if it can the interface is hidden to the point I can't figure it out. I'd have to scan the QR code, have it pop open my browser, select the url, long press to copy, navigate to the NextCloud app, create a text file, paste the url, save the file, open it on my computer, copy the URL, and paste it into my browser.

Admittedly, sending it via e-mail or something would cut out a couple of those steps (still a far cry from "just copy/paste"), and is what I do on those rare occasions I do need to take a URL from my phone to my laptop, but you know what's even easier? Just sitting down at the damn keyboard and typing in whatever.com/coolthing.

Why do I need two devices just to browse your damn website on a decent sized screen or buy your product?


While I agree that textual links and qr codes aren't the best solutions for certain tasks, the workflow you describe appears a bit too complicated. What I do:

- scan a qrcode with a qrcode app (I use a version from f-droid) - choose "share as text" in the app - select the Owncloud app, which asks me what name the file should have

No browser step needed on the phone. In the desktop's browser I navigate to the Owncloud, open the file just saved and click on the link. No cut/copy/paste involved.

What I really do:

- scan the qr code (or the text with an OCR app like TextFairy) - share the snippet with the Joplin app - open the Joplin desktop version and there's the link or text

Or I actually use Blitzmail (share as text from some other app, which counts as the "cut" step of cut/copy/paste), then select the email arriving on the desktop and select the link (i.e. "copy" ) and "paste" it into the browser, where the last step is usually done by the desktop which offers a "open this link" menu for links in texts.

Using the Blitzmail app serves as an easy record keeping device too, when I just send a whole text block containing a link, so I have the context at hand later, if needed.


how are they any better than url shorteners? Now I have to download a qr code reader, screen grab it, convert it with said app, and that opens in a browser


Aren't QR code readers built into Android and iOS?


I'm on PC at least 75% of my time and not on my phone. My phone is mostly for messaging, music, email, and killing time at the airport/airplane/wherever I'm waiting. I get the point about extremely long URLs though, but most of the time that's not an issue unless you're printing it out


Depends on your OS, manufacturer, and version. In Android, it depends on your camera app (and version). Later Google Camera versions have that, for example, but earlier ones (as of a few years ago) did not.


They are better because you know the exact url you will reach before sending it to your browser.


apart from the download that happens once, it is just a case of pointing your camera to the code and the browser open by the touching the screen once. Quicker than typing a shortened url.


Bitly exists because of Twitter and SMS character limits.


I don't know how long this has been true but all links in tweets are replaced with Twitter's own link-shortener links (t.co). No matter how short your link is, in a tweet it will consume 23 characters.

https://help.twitter.com/en/using-twitter/how-to-tweet-a-lin...


This happened after bit.ly and other shorteners started to have great financial success. Ecosystem annexation at it's best...


I run into similar problems in a corporate context. Being able to quickly tell someone "the provisioning portal is at corp.short/provision" is easily 10x more useful than "go look in the wiki for the link"


See also: golinks


I agree, we sell PDFs with the ability to be printed, all links are short links (on our own domain, though) so they aren’t lost/inaccessible when printed.


I think you underestimate how much separation there sometimes is on large teams with the people who run/build the website, vs the marketers who are moving fast. I've seen terrible devs who will claim it takes DAYS to add a simple redirect of dog.com/X to your long marketing url (cutting out services like this), but the marketing team can't wait that long so services like this are much more async in many contexts, too.


100% this... I was our web dev working with marketing, and before I got there, short URLs/marketing links had to be manually created as new pages in Drupal sometimes, in a 301 redirect dashboard other times (what the hell), which meant submitting a ticket, waiting for it to get prioritized, etc., then making sure there were no conflicts anywhere.

Switched it out with a cheap commercial short URL system with its own domain, and the marketers could login anytime and make their own URLs, see all the analytics, edit the destinations, etc.

Everyone was much happier after that. It did indeed cut the wait from days to seconds, and plus they had real-time usage data after that.


Terrible, perhaps, but very smart.


Actually, link shorteners are just a symptom of the problem.

The problem is the DNS system itself. It is the reason that your email address gets spammed, and the reason that you can DDOS websites, etc.

DNS is a glorified search engine, and it is only really used for root urls like mydomain.tld . It's pretty much only good in two contexts:

1) for when people dictate a specific domain name verbally to someone, and even then, spelling errors can occur.

2) advertising a URL somewhere to a landing site. But you can just use a QR code that people can scan, or a link in a webpage.

Everything else may as well be at non-human-readable domain names, in which case you can even use distributed hash tables instead of DNS. Perhaps one day browsers will allow plugins realize their own schemas, such as ipfs://hjkldfjhsdfkjgsdhfgsdf and the plugin would do the routing instead of DNS. Is that currently possible with standard browser extensions?


I'm pretty sure my email gets spammed because bad actors exist in the world. I'm sceptical any technical solution will protect against that.


It takes both. If people couldn't send a message to your email just by knowing it, then you wouldn't get SPAM.

Instead, you could be giving out capabilities, to send you email. And if one of them was abused, you'd simply turn it off, and only accounts who used it in the past could continue to send. New ones wouldn't be.


Right, but your domain name is part of your marketing effort. And you don’t need to resort to a short URL service to get a branded URL. If you listen to any sponsored podcasts they have the job of reading out a sponsorship URL, and inevitably it’s something like {sponsoringCompany}.com/{podcastName}, which is totally understandable to people.


It is maybe understandable but also too long for lots of content.

You want it to be as short and memorable as possible for anything which has limited "screen" time. Which is basically everything, i.e. Radio broadcasts, video streams/adverts, Billboards you drive by, advertisements on websites etc.


it's not really about it being sexy, it's about it being able to be typed in manually on a mobile keyboard by humans. the url editing experience on mobile browsers is terrible. like trying to write an essay through a keyhole.


That too, yup!


I feel like custom URLs are better than random bit.ly. I can create a link like `company.com/summer23promo` that is easier to remember than `bit.ly/gsjsun618n`

I think the paid version let's you do custom URLs but that is just a worse version of doing it yourself since a typo can lead to a completely random website.


There's a project[0] designed to archive various URL shorteners to combat the link-rot problem. It's ran by ArchiveTeam which is a bunch of preservationists who are hell-bent on preserving parts of the web that otherwise would go into the dustbin of history.

[0] https://wiki.archiveteam.org/index.php?title=URLTeam

[0] https://tracker.archiveteam.org:1338/status


Maybe these fine people should run a url shortener service.


yeah, this is cool, but in the future, wouldn't it be better to just skip the link shorteners?


In past they took much space in comments and messages. Now most sites have gotten smarter and automatically shorten a long URL when presenting it. For the first part, depending on site, a deterministic shortener could be possible. For example "example.com/blog/2022/09/22/first-article-of-the-day.html" can be "example.com/s/b22092201". Remember read someone utilizing something like this but cannot find the article.


An use case:

I work daily with short links, because we need to pass parameters in URL and, depending on the amount of parameters you use in your URL, it gets bigger quickly.

Then you have many stakeholders, with no IT background, using those links and if for some reason they use ctrl+c missing some part of that big URL, the access will be broken and then they will complain its not working.

Short links are better to avoid that problem.


That's why you have your own link shorteners. There is no reason to use some third party shortener that may or may not be alive the next year.


I actually use a third party, because I'm not a dev and have no idea on how to do one myself.


It's actually very easy to implement if all you want is just shortening and you have the slightest idea about databases. All you need to do is generate a random string (functions that do this for almost any language are available online), save that string and the long URL to the database.

If you want tracking and statistics though, it gets more complicated. The simple version can be a good way to get into web development now that I think about it. You learn about forms, GET/POST, databases, very basic SQL etc.


thanks a lot for elaborating it :)

how it works with the domain tho? i need to buy a short domain that will concatenate with my database strings, is that correct?


If all you need to do is to "hide" the parameters, you can just use a subdomain of your choice regardless of the length, like post.domain.com or a.domain.com. However, if you want an actual "shortened" url, you will need a short domain name. Shorteners use TLDs other than .com to make it even shorter. For example, reddit.com uses redd.it for short urls.


Hey! Creator of Dub here! Appreciate the sentiment, also great point in the replies about link shorteners leading to spam.

My plan with Dub is to keep this running at a sustainable pace for as long as possible, and I believe it's possible for a few reasons:

- Operating costs for Dub are quite low at the moment, thanks to Edge Functions (https://vercel.com/edge) + Redis.

- I'm leaning into the custom domains & self-hosted aspect with the freemium model – where enterprises and businesses would be able to get set up with a custom domain link shortener super easily.

- Agree that individual short links are definitely not sustainable in the long run, I might set a rule where randomly-generated links > 30 days get deleted, to save it you'll either need to make an account (to prevent spam) or set up your own domain.


> What’s wrong with normal URLs?

I've seen some random blogging software break when you embed certain kinds of links into articles, for example, ones that have query strings (?key=value), where the question mark gets interpreted as something else by the software and thus the link gets cut off and no longer works.

In cases like that, it makes sense (because you literally don't have a choice, unless you want to migrate to something else).

Also some might enjoy the consistency of short links, instead of having a URL that's really long. That is also pretty nice for putting the URL on a poster, flier, or sending it to someone.

Some also just don't care about the implications of the link going down in the future.


I have wanted to implement a link shortener with a couple of monetization ideas to avoid that:

* Allow you to "buy" transparent clicks for your URL (e.g. 1 cent per "transparent" click)

* Implement "ad gateway" like what adf.ly does for non-transparent URLs

* Give you X small amount of "transparent" clicks for free

* Use something like IPFS or (gasp) Ethereum blockchain for storing the data... allow you to keep your URLs alive by paying for them (this last one is not that clear)

* [Don't kill me] At some point (back when it had started) I though of putting a WASM miner in a frame when visiting a page.

My main problem is that I have not been able to get a good domain name.


I see you also read the Bitly playbook re: WASM miner


Short URLs are nice for some things. QR codes for example work better the shorter a URL is.

Nothing's wrong with normal URLs. Every post on my website can be reached by a single decimal number appended to the end of the domain.

But this requires every website on the internet to care about having URLs of reasonable length. URL shorteners allow a third party to put a bandaid over the problem.


> What’s wrong with normal URLs?

Nothing, but how would you then track users and redirect through 3 nested services to attribute purchases? ;)


When a URL is generated and contains some long cryptic un-memorizable code they're pretty handy (but only if you can specify the path name yourself, which is how I use tinyurl)


With that in mind, QR Codes are the new shortlinks.

Sort of :-)

Hmm... I wonder if Google interprets and follows QR Codes?


Agreed. Please do not use this software, nor link shorteners generally.


I'm the creator of https://T.LY URL Shortener and am always interested when I see new short link services. My biggest piece of advice is to figure out a way to detect malicious URLs before your service is completely shut down. A month after starting T.LY, my servers were disabled by my hosting company without warning. Since then, I've worked on systems and tools to prevent malicious short links and make the service more reliable.

Most comments I see here are questioning why we still need URL shorteners. Print, media, SMS, and analytics are just a few reasons. I wrote some additional info on my blog: https://timleland.com/are-url-shorteners-useful-today/

Another interesting thought is when you create a TinyURL, it's 20 characters long, and Bitly links are 14 characters long. These services cannot create short links anymore. As a URL shortener grows, the number of actual short links diminishes. Currently, T.LY has over 10 million short links, which means plenty of four and five-character short URLs are available.

Two character URLs 3,844 (62^2) unique combinations

Three character URLs 238,328 (62^3) unique combinations

Four character URLs 14,776,336 (62^4) unique combinations

Five character URLs 916,132,832 (62^5) unique combinations

Six character URLs 56,800,235,584 (62^6) unique combinations

Seven character URLs 3,521,614,606,208 (62^7) unique combinations

Eight character URLs 218,340,105,584,896 (62^8) unique combinations


Hey Tim! Thanks a lot for sharing your experience with T.LY! I'm definitely going to implement some abuse prevention measures over the next few days. My first instinct is to prevent folks from pointing shortlinks to certain malicious sites – do you think that'll be enough? Or are there other abuse vectors?

Also, very interesting note regarding the hash combinations! The main focus of Dub is probably going to be for folks to add their own domains – but this is something that I'll keep in mind as well!


Just curious, can a short link be a single emoji as the URL (after domain)? If so, does it technically take up 4 characters?

And (if you don't mind answering) how much does such a short domain like t.ly cost?


It is possible, but your users will need to type emojis (which can be hard or impossible on some devices), or you'll need to urlencode it in href attributes and it will actually take encodeURIComponent("").length = 12 characters (imagine a simple emoji between the quotes). It will also require bigger QRCodes than alphanumeric characters. It might display incorrectly in address bars.


Yeah, someone actually created an issue for this on the repo: https://github.com/steven-tey/dub/issues/8

I'm planning to not allow emojis simply because of the accessibility challenges that it presents to users :')

Emoji domains though, on the other hand, are really cool and more than welcome to be added :)


Reminder that there are also great tools designed to do the opposite.

https://aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

google.com becomes https://aaa.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...

shadyurl.com was fun while it lasted. Tagline: Don’t just shorten your Shady URL, make it suspicious and frightening.


Another chance to warn about:

Shorten URLs using invisible spaces

https://github.com/zws-im/zws


Whoa, had no idea this was possible. Pretty cool!


Love these lol, really gave me a good laugh when I saw them in the past


Good luck on your link shortener project! I made an open source link shortener many years ago and eventually threw in the towel and quit. The problem domain for link shorteners is one of anti-spam and abuse. Charging for it makes complete sense to try and weed this out but having any amount of "free" I found to be a hotbed of reports thrown against my hosting provider and registrar for supporting spam. I found myself getting quickly blacklisted everywhere since spammers love to use new shorteners for bypassing their own blacklists.

I've not looked into the problem again in 10+ years since. If I did I would 100% skip the free plan.


Looks like a visually pleasant site to browse, however it appears that there is some lag on Firefox (on the desktop), at least for me.

As far as link shorteners go, I actually host my own containerized instance of YOURLS: https://yourls.org/

It's fairly boring and not really pretty, but it seems to work okay for me.

Actually, as far as self-hosting goes, there's quite a few options out there: https://github.com/awesome-selfhosted/awesome-selfhosted#url...

Of course, one can also find some free services hosted by others.


Thanks for the headsup re: the lag – there's some performance issues with the Globe animation that I'm trying to fix right now, sorry about that!


Just remove it.

Your site is good without the globe.

    Application error: a client-side exception has occurred (see the browser console for more information).


Just merged a PR that should mitigate this: https://github.com/steven-tey/dub/pull/13

Can y'all check again and let me know if the performance issue is still bad? Feel free to reply here or send me an email at steven[at]dub.sh


It's better now.

I can scroll to bottom without crashing, but it is still high cpu usage and fans start spinning.


Thanks for letting me know! I'm gonna keep digging into optimization strategies! :)


> however it appears that there is some lag on Firefox (on the desktop)

I also had noticeable lag using Chrome (on desktop)


firefox and brave both choked on it for me (while a bunch of el scripts are building in the background). that page killed my GUI responsiveness lol which was unencumbered before I went there (aka windows was doing fine with compiling in the background and letting me browse the web)


Nice project, although I'd definitely not use it. The website seems too bloated and as others have said uses too much ram.

For personal use I just curl one of these URLs from my linux machine: https://wiki.archlinux.org/title/List_of_applications#Pasteb...


Apologies for the performance issues! I just merged a PR that should mitigate this: https://github.com/steven-tey/dub/pull/13

Can you check again and let me know if the performance issue is still bad?


Genuine question. Why would people pay for the pro version if they could just host it for themselves? Does the pro version have some proprietary stuff which would have advantages to the selfhosted version?


The usual use case for paying for something you could self-host, is that you don't have to self-host and therefore manage it. Someone else deals with installation, updates, and ongoing availability.

For something like this there is perhaps extra factors like someone else worrying about abuse by malicious users and the resulting risk of being black-listed by spam filters.


At my work, getting approval to pay for this would take about 5 minutes. On the other hand, if I had to provision a server to self-host, I might be lucky to have this done in the next six weeks, depending on how IT is feeling when I ask.


Here we'd also have to go though a vendor review (security, legal, etc.)


I can easily envision a non-technical person spending a few bucks for this because they don't know how to set things up without help. I don't see that working at $99/month though. It's WAY more than most bit.ly plans for a vastly more limited product.


That's a great point, thanks for mentioning that! I'm gonna do some pricing research over the next couple of months to see what the optimal pricing is for a tool like this! :)


Do you have any mechanisms to handle abuse? That's a common problem in the URL shortener space, and usually leads to them getting blocked from most platforms.


Yeah I was thinking about that right before launching last night, gonna go ahead and add some simple abuse prevention measures now!

My first idea is blacklisting certain problematic hostnames and not let folks add them. Can you think of any other abuse vectors?


> Can you think of any other abuse vectors?

Just be prepared that your service will be (ab)used for linking to malware, pirated content, porn.


Here’s mine: https://xn--gda.at


Funny thing – I actually had to do some regex validation for domain submissions from users and this was one of the edge cases I had to account for haha

Here's the regex that I ended up with: https://github.com/steven-tey/dub/blob/main/lib/utils.ts#L12...


Apparently HN replaces ï.at to xn-


Didn't think they'd handle punycode like that.


xn-- for me


Heh, I did the opposite recently after reading "Software Engineering at Google" and I discovered that even though it would be very easy to make: there is no equivalent to the `go/` permanent "friendly" URL shortener.

It can be backed by a TOML file for hardcoding URLS or a database for making it easy to add new ones (which I think is the Google way).

If I did a stupid; or a better version already exists: let me know.

https://git.drk.sc/dijit/redirector-rs

https://github.com/dijit/redirector-rs


True! But a link shortener SaaS is more than just redirects – it also needs data visualization to help marketing teams understand the performance of their links, which is half of the value prop imho!

That being said, absolutely love your spin on the go/ links – I learned about it from my friend who works at GitHub and it's kinda blown my mind ever since :)


How does this compare to YOURLS [0]? btw, I like link shorteners for their millenial quirkiness. kickme.to/the2000s

[0] https://yourls.org/


I tried using a bitly alternative but found that when I sent them to users via email the links were flagged by gmail as being dangerous. There were no problems when I sent bitly links, or the plain links.

I'm hesitant to try another alternative because I wouldn't want to get set up in a new system, only to have these problems crop up again.


Very good point, I'm going to try and add some abuse prevention measures to make sure the domain doesn't get blacklisted!

In the meantime, you can also use your own custom domain for maximum control: https://twitter.com/steventey/status/1572958205814214657


I assume thats because bitly has excellent blocking for known malware sites and techniques (rate limiting/etc) since they've been around for so long.


The site looks quite laggy on my phone, and moving around feels janky. Could it be the Javascript that caused this?


Hey! I believe it's the globe animation, it uses a very simple stripped down version of webgl & threejs (based on the lib: https://cobe.vercel.app/)

Gonna think about how I can optimize that further! Thanks for the headsup!


I think you should get rid of that stuff. I was compiling some el scripts in the background and surfing around just fine and got to your page and it starting taking a couple of seconds to respond to mouse clicks until closing the page, same for both Brave and Firefox (most recent versions on both) on windows 10. I'd give benefit of a doubt since you're doing a new service but most people wouldn't come back if that happened to their machine.


FYI, I'm on an absolute beast of a machine and my browser locked up while trying to view that page. When I mean beast, I mean beast.


Oh nooo :( what's the specs of your computer? I'm gonna try and optimize this further tonight!


Specs: beast


hahahaha


Some necessary questions:

- Does this use any blacklist to prevent URL shortener looping (i.e. using multiple URL shorteners on top of each other to bypass the checking), or preventing any potentially malicious sites? - Does this have rate limits? URL shorteners get abused quite regularly, so this should be necessary.


Very good questions! I was actually thinking about that right before launching last night!

I'm planning to blacklist certain problematic hostnames and not let folks add them.

In terms of rate limits, it does have rate limits when it comes to collecting analytics (if you spam click a link >10 times in 10s it still redirects you but it stops recording clicks.

I can't think of how URL looping could bypass checking – could you elaborate?


Assuming validation of their licensing one might be able to use the same .txt lists that the browser addon uBlock imports as a baseline, then have a way to add custom entries. To keep Google and Bing happy maybe check to see if they have an official list of bad domains as well.


I literally spent all day Tuesday trying to find a decent alternative to bit.ly. I'm so glad this exists.


I have been using https://github.com/YOURLS/YOURLS for years without any issues


So glad to hear that!!


If you're spending a day why not just roll your own?


Because it takes longer than a day to build?


Only if you take a 12hr lunch (can happen)


Have you looked at Kutt?


I did something similar with https://statico.link when I couldn't find a cheap, free and easy service to do this.

It started as a simple nginx URL map since I was already running nginx (https://gist.github.com/statico/14fa84d7e79722031d5e49694191...) but is now a tiny containerized app because friends requested an index page. The requirement is that all links need to be named (i.e. no random hashes).


I remember the short url craze - bitly alternatives were everywhere (even @ the G[1]!) and creating one was basically the Hello World of programming for a time.

Real shame how it went from convenience tool (and largely coupled with microblogging character limit) to aggressive corporate tracking (though bitly was always a champion of the latter)

https://developers.googleblog.com/2018/03/transitioning-goog...


I ran a variation of something like this myself for years. Eventually, the site was routinely being used for spam-style (e.g., a link to some illegal data, or some advertisement to embed somewhere, etc.) links. And when I took the site down, my users asked me for help to transition away from this service that they were uniquely relying on. It was a mess. See goo.gl. I wonder how you prevent your service from being used inappropriately and how you handle the eventual costs


Very good point re: goo.gl

My plan here is to lean into the custom domains & self-hosted aspect – where enterprises and businesses would be able to get set up with a custom domain link shortener super easily.

Individual short links are definitely not sustainable in the long run, I might set a rule where randomly-generated links > 30 days get deleted, to save it you'll either need to make an account (to prevent spam) or set up your own domain.


Note that for many use cases, you can host your own URL shortener for free on GitHub pages (or Netlify, etc) by creating static index.html pages containing HTML redirects[0]. If you buy your own short domain, you can even port it between different providers if necessary.

[0]: https://apitman.com/18/#html-redirects


I built a very, very basic one of these a month ago to shorten a couple of unruly domains I had. Supports static and dynamic endpoints that you define.

https://thesom.au/gh/shorturl

Intended to self host for free/minimal cost on CloudFlare, thus comes with built in analytics, BYO domain, etc.


Love this, thanks for sharing!! Did you get to building out the analytics dashboard? Would love to check it out! :D


No dashboard, or web interface even - the idea is that you just use CF's worker analytics for usage stats. There's no storage / db sitting behind it, just a single file to deploy as a worker.

Logical next step would be to hook it into KV and include a basic auth/admin API for editing routes and retrieving stats. But even that would add a bucket load of complexity to what is essentially 20-30 lines of obtuse logic currently.

Definitely no plans to deploy as a service with custom domains and enterprise offerings :)


A bit of a shameless plug, but I also created an open-source link shortener, using Python and Flask. Although not as polished and full-fledged as this one, it done its job pretty well, with basic click statistics and custom key URLs.

https://github.com/HoangTuan110/flyurl


Application error: a client-side exception has occurred (see the browser console for more information).

I'm using Bromite on Android


The grandfather of all link shorteners: https://shorturl.com/

I had a .vze.com subdomain registered there in approx. 2006 and it still is live. Unfortunately, the target domain and website is long gone.


I read "Billy alternative" and waited for some cool Ikea hack. Bummer.


lol that would've been amazing haha


Still need to fix some bugs, but I made an URL expander using Preact and Cloudflare Workers: https://expand.flashblaze.xyz/


Great website. I really like the globe and overall theme - reminds me of Vercel. One small note - the github stars image made me think you had 0 stars. Not a big deal, but you might want to update it.

Great work


Oh my word! Good catch lol I'm not sure how that broke, will fix now!

And thanks a lot for the kind words!


The UI of the product is nice too - really feels like Vercel which is a good thing. It would be good if you were able to build UTM tags in the product, and pull analytics on them - apologies if this already possible.


That's exactly the next thing on my roadmap! Thanks for the suggestion!


I had an account before in Bitly, the username is "username", one day, they just deleted my account for no reason. I never used their service again.


earlier there was an option to add "+" at the end of any bit.ly link and you can see the stats of any shortened URL. Is that something you've given a thought?


Oh interesting! You can actually do that right now with https://dub.sh/stats/<YOUR_SHORTLINK_SLUG>

E.g. https://dub.sh/stats/github

But I like this idea, might just add it to Dub... ;)


Is there a special thing to prevent being blocked from most platforms? For instance, if I post your shortlink on HackerNews, can I be marked as "dupe"


The last thing the Internet needs is more link shorteners.


Can I ask what you used to make that landing page? I've seen a lot of pages use that template lately and it's killing me not knowing


It's not a template but it uses Tailwind (tailwindcss.com)!

Here's the full list of design inspirations for the site: https://twitter.com/steventey/status/1572958213250629633


This looks nice!

I recently deployed my own Rallly instance (Doodle alternative) via docker-compose and would love to give dub.sh a try.

Any plans for releasing a docker version?


No plans yet, but you can easily clone this repo and deploy your own version on platforms like Vercel.com, no docker containers required! :)


Very laggy - i am getting 10 FPS in your website. You should consider optimizing. Good project, congrats!


Not to be negative, but aren't there like a billion open source url shorteners at this point?


What happens on the free plan and the 1001'th person clicks the link?


The link still works, and the link still gets tracked in redis, you just won't be able to see the stats for the link until you upgrade. It's a similar model to Plausible.io, which I think is really fair! Let me know what you think! :)


Is your website cryptojacking? It blew up my GPU.


It was because of the globe animation, which is a stripped down version of Three.js + webGL. I just merged a PR that should mitigate this: https://github.com/steven-tey/dub/pull/13 Can you check again and let me know if the performance issue is still bad?


Redis as a primary database gives me chills.


I'm not sure how being open source helps here. How do we know the code that is running on the service is the same as the open source code?


I mean, you could say that about any open source service. The best way to see if it works like the service, is to just compile it and run it yourself...


It's basically an effort to promote code transparency + user privacy, and in general it's just super fun building in public! :)


the globe on the homepage needs some lube. scrolling it on mobile takes some while


nice try nsa


in rust?


Your site is completely killing my browser.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: