URL shortening is used to create shorter aliases for long URLs. Inspired by TinyURL, this project aims to clone the behaviors of TinyURL.
- Encoding and hashing actual URL
- Redirect to actual URL with tiny URL
- Cached popular urls and reduce time it takes to redirect
- High traffic capability, currently L&B with 4 instances
- DNS Look up for IPv4
For development, you will only need the following tools
- Node.js
- Yarn / Npm
- MongoDB
- Redis
$ git clone https://github.com/songrenzhao/url-shortener
$ cd url-shortener
$ yarn install
Create .env
in the root folder then edit it with your settings. You will need:
PORT=...
MONGODB_USERNAME=...
MONGODB_PASSWORD=...
MONGODB_MISC=...
REDIS_HOST=...
REDIS_PORT=...
REDIS_PASSWORD=...
Notice MONGODB setting corresponds to this mongodb+srv://${USERNAME}:${PASSWORD}@${MISC}?retryWrites=true&w=majority
$ yarn build
$ yarn start
$ yarn dev
$ yarn build