Shortify.pro

Shortify.pro is an enterprise grade URL shortening website

Payment system

Shortify is a very simple concept; create a short URL which redirects to a larger one. The simplicity of the idea makes a great platform for testing out the latest technologies and techniques in software development.

The tech stack for Shortify is based on Go microservices running on a serverless platform with an infinitely scalable json database for storage.

Domains

Shortify uses an interesting approach to URL shortening. Rather than hosting the site at a short domain, it has a roster of ten two character domains it uses to provide short URLs.

Using a three character long url eg /abc, there are 238,328 possible combinations. With a roster of 10 domains, this becomes 2,383,280 combinations - enough to offer unusually short URLs for a very long time.

Golang Microservices

The back end of Shortify comprises a collection of Go microservices. Each one has a small role to play in creating and serving up short urls. The service which creates URLs does not even write them to the database; this is another service which responds to the event of a URL being created.

Google Cloud

Google Cloud Run

Shortify has no servers or compute resource. All back end services are hosted via Google Cloud Run. This service spins up a docker container whenever a request arrives and keeps the container alive for a short period; serving the incoming request and any others that arrive soon after.

Because the docker containers are only active when a request arrives, the cost per month can be drastically lower than the costs of dedicated hardware.

Pub/Sub

Shortify uses GCP pub/sub topics and subscriptions to create an event driven architecture. When a url is created a message is published to the url-created topic. Subscribers to this topic include processes to save the URL to the database and to carry out safety checks on the destination.

There are various topics for each event which can affect a URL; these include url-changed, url-deleted and url-visit.

Firestore

Shortify uses the firestore json document database for persistence. This allows 50,000 reads and 20,000 writes per day for free, and beyond that a block of 100,000 additional reads costs £0.03, and the same number of writes is £0.11.

Firestore is infinitely scalable and extremely fast.
There is no hardware as the database is provided as a service and has at least a five nines uptime (99.999% availability).