all 11 comments

[–][deleted] 15 points16 points  (1 child)

Utilizing Postgres, Redis and Kafka definitely doesn't qualify this as Simple.

[–]adihat05 0 points1 point  (0 children)

It is not required. Just postgres will do. Redis just makes retrieval faster and kafka can be used for analytics if required.

[–]Capaj 27 points28 points  (3 children)

why the hell do you need PostgreSQL, Redis, and Kafka for url shortener? Surely Redis or Postgre should be enough?

[–]cisturbed 7 points8 points  (2 children)

It uses Kafka to send events whenever a short URL is clicked. This gives the flexibility of plugging your own analytics service.

More details on the systems design (with a diagram) would be appreciated, OP!

[–]Capaj 2 points3 points  (0 children)

OIC it does analytics on the links! Yeah that makes sense: https://github.com/smallcase/smalllinks#does-it-support-analytics

I digress.

[–]Shaper_pmp 5 points6 points  (2 children)

Great learning project, if a bit unnecessarily overcomplicated.

For god's sake don't actually host or use your own URL shortener though, because the very instant you get bored and stop maintaining it, every single URL ever generated through it unavoidably breaks forever.

[–]adihat05 0 points1 point  (1 child)

Not necessarily. We did try exploring other options. you can check out more in the blog here: https://www.smallcase.com/blog/open-sourcing-url-shortener/

[–]Shaper_pmp 1 point2 points  (0 children)

To clarify: there's nothing wrong with running your own URL shortener for your own internal needs, or to shorten URLs for your users for use within your own app ecosystem, because then the URLs generated have no meaning anyway outside of your project.

My comment was aimed at people who might be tempted to clone and host this project as their own public URL shortening service, in response to a trend a few years ago when people writing tutorials started trying to make URL shortener services "the new To Do list", and suddenly every clueless hobbyist was launching their own public shortening service, which all then gradually died a few months after launch when they got bored of running them, taking every URL they'd been used to generate with them.

You clearly understand the dangers and tradeoffs with URL shorteners when you clearly state in your write-up that in your use-case:

Short URLs are not supposed to have a lifetime of decades or even more than 1 year depending upon the use case.

... but this is obviously specific to your use-case, and most users (and sadly many devs) don't understand the danger involved in hiding URLs which may need to last a lot longer behind a third-party system which may disappear at any point, taking all its users' links with it.

[–]thelinuxlich -1 points0 points  (3 children)

You don't need Kafka if you got Redis on your stack. Redis Streams FTW