This is a simple URL shortener service using golang, gin framework, cassandra database, and redis cache. You can find more details in https://tinyurl.com/bj4bne99.
✔️ Authentication using jwt.
✔️ Authenticated users can generate a shorter and unique alias of a given URL.
✔️ Authenticated users can see the details of their generated URL.
✔️ Given a short link, redirect users to the original link.
✔️ Accessible through REST APIs by other services.
✔️ Default url ttl in cassandra configuration.
✔️ Users can delete their urls.
✔️ List links of a user.
❌ Link expiration after its standard default timespan.
❌ Custom expiration time.
❌ Custom short link.
❌ Use an API developer key to throttle users based on their allocated quota in createUrl() api.
❌ Limit users via their api_dev_key to a certain number of URL creations and redirections per some time period (which may be set to a different duration per developer key).
❓ Key Generation Service (KGS) instead of github.com/teris-io/shortid package
❌ Data partitioning and replication (Hash Based Partitioning).
❌ Cache eviction policy (LRU, Linked Hash Map).
❌ Load balancer (LB): See https://tinyurl.com/bdfnc9pk.
❌ Purging or DB cleanup: See https://tinyurl.com/56tje6tt.
❌ Telemetry: See https://tinyurl.com/4zrpbupd.
❌ public/private permission level for each URL in database.
❌ Dockerfile and docker compose.
Install Docker & Go (>1.18)
make cassandra \
make redis \
make db-start \
make cache-start \
make db-migrate \
make server
You can stop database container using the following commands
make db-stop
To stop Cache
make cache-stop
To drop database you can use this command
make db-drop
- https://medium.com/easyread/golang-clean-archithecture-efd6d7c43047
- https://intersog.com/blog/how-to-write-a-custom-url-shortener-using-golang-and-redis/
- https://github.com/tushar9989/url-short
- https://www.educative.io/courses/grokking-the-system-design-interview/m2ygV4E81AR
- https://github.com/quyenphamkhac/go-tinyurl
- https://www.geeksforgeeks.org/system-design-url-shortening-service/
- https://github.com/teris-io/shortid