sclr.ac - Scaler's Official URL Shortener #3
championswimmer
announced in
Projects
Replies: 2 comments
-
Do we need link expiration fetures or not? |
Beta Was this translation helpful? Give feedback.
0 replies
-
@championswimmer I have some ideas:
Let me know if i can start working on these features |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
sclr.ac
sclr.ac is Scaler's official URL shortener - it will be used to create shortlinks for masterclasses, events, referral links etc.
Details
Repositories
Maintainers
Summary
The URL shorten-er project - sclr.ac works like common URL shortening services like http://bit.ly or http://goo.gl etc.
People can -
There would be stats available for how many times each shortlink has been opened. Also the traffic stats will have details of the referrer URL (which gives information on where the traffic is coming from).
Features (future)
hits < X && created more than Y days ago
(eg: expire unused links after 1 month)Tech Specs
Entities
Base Entity
Every entity extends from this (i.e. all tables have these columns)
id
: integer autoincrementcreatedAt
: dateupdatedAt
: dateURLs
id
: bigint (basically base64 representation of shortCode)longUrl
: string - the actual HTTP url which we are shorteningshortCode
: string - the shortened stringownerId
: id of user who created ithits
: big integ: if https://medium.com/@championswimmer is shortened to https://sclr.ac/agm then
agm
is theshortCode
Visits
urlId
: id of shortcode which was visitedipAddr
: string - IP address of visiting userreferrer
: string - the previous website someone was visitingUsers
username
: stringemail
: stringauth
: ???API Endpoints
POST /users/
Register a new user with email/password
POST /users/login
Login a new user with email/password
GET /users/login
Redirect to Google for Google Oauth
GET /users/login/callback
Callback from Google for Oauth
POST /urls/
🔐Create a new shortened URL
For getting random short code
For getting custom short code
GET /urls
🔐 📄Shows all short URLs
GET /urls/{shortCode}
🔐👮🧑Get details of a short code (like its long URL, no of hits etc)
PATCH /urls/{shortCode}
🔐👮🧑Update details of a shortCode (for now mainly to update the long URL)
GET /{shortCode}
This will redirect the user to the longUrl. People will use this endpoint directly from the browser
GET /users/me
🔐See my profile details
PATCH /users/me
Update my profile details (if any)
Shortening Logic
Given long URL:
https://github.com/scaleracademy/open-source-projects/discussions/3
We need a short code:
https://sclr.ac/gbv6j
i.e.gbv6j
Shortcode requirements:
A-Z
,a-z
,0-9
_
and-
0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_-
64^8 == 2^X
Take
gbv6j
as a base64 representation, convert it to an integer and we'll use that as theid
of our URLs table.Beta Was this translation helpful? Give feedback.
All reactions