A URL shortener is a tool that can be used to shorten long, complex URLs into shorter, more manageable links. This project is a simple URL shortener service, where users can input a long URL and get a shorter one in return and will also generate QR code for link and UPI.
-
HTML
CSS
JavaScript
tailwind
-
Node.js
Express.js
MongoDB
Redis
google-oAuth
github-oAuth
-
Visual Studio Code
-
NPM
-
Netlify
Cyclic
Render
- Client Side: https://lacking-berry-1088.netlify.app/
- Server Side: https://beige-swordfish-wear.cyclic.app/
-
PORT=<your_preferred_port> MONGODB_URI=<your_mongodb_uri> normalkey = <normalkey> refreshkey = <refreshkey> redis_password = < redispassword > GITHUB_CLIENT_ID = < github client id> GITHUB_CLIENT_SECRET = <github client secret> GOOGLE_CLIENT_ID = < google client id> GOOGLE_CLIENT_SECRET = <google client secret>
-
To sign in or sign up with Google or GitHub, click the corresponding button on the login page and follow the prompts.
-
Once the server is running, you can use the URL shortener by entering a long URL in the input field on the dashboard and clicking the "Shrink" button. The application will generate a short URL that you can use to redirect to the original long URL.
-
To access the admin dashboard, navigate to /admin in your web browser and enter the admin username and password that you specified in the .env file. From the dashboard, you can view a list of all the users and links, delete users, and delete links.
POST /url/shorturl
Shortens a long URL and returns the shortened URL.
Request Body
{
"longUrl": "string"
}
response
longUrl
(string, required): The long URL to shorten. Response
{
"shortUrl": "string"
}
shortUrl
(string): The shortened URL.
-
One of the key challenges in building a URL shortener is generating unique, short URLs that are easy to remember and type. In this implementation, we are using a combination of Redis and MongoDB to generate short URLs.
-
Another important consideration is security. By implementing authentication with Google OAuth and GitHub OAuth, we can ensure that only authorized users are able to access the application. Additionally, we have implemented input validation and sanitization to protect against malicious inputs.
-
To improve performance and scalability, we are using Redis to cache frequently accessed data and MongoDB to store less frequently accessed data. We can also implement load balancing to handle a large number of requests.
- View a list of all the users and links.
- Delete users.
- Delete links. To access the admin dashboard, navigate to /admin in your web browser and enter the admin username and password that you specified in the .env file.