Skip to content

A URL shortener website and PWA build with vercel serverless cloud function, MongoDB and nodeJS

License

Notifications You must be signed in to change notification settings

MPrajwalKini/lenk.cf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

❤️lenk.cf

A URL shortner made using NodeJS, MongoDB and Vercel serverless function. This project also includes a serverless API. With the help of this API we can Integreate the URL shortner with basic static (HTML/CSS/JS ) websites. This website can also serve as a Progresive Web Application (PWA) where you can install this website as a normal Application on your PC or Phone.

 

Tech Stack

Client: HTML, SCSS, JS, Bootstrap, Materialize

Server: Node,TS, MongDB, Vercel Serveless function.

🎦 Screenshots

 

App Screenshot

 

 

💻Requirements

  • NodeJS
  • MongoDB (Atlas)
  • Vercel CLI

 

🌐Deployment

To get this poject running, firstly install vercel CLI on your PC with the following command.

  npm i -g vercel

Secondly, goto MongoDB and configure a MongoDB Atlas cluter running, Setup the MongoDB clutter and copy the URI for NodeJS application.

After the MongoDB setup is done clone this project and install the packages.

  git clone https://github.com/adithyapaib/lenk.cf
  cd lenk.cf
  npm i

create .env file in the root folder and create variable DB and paste your MongoDB URI

 DB = YOUR_URI_WITHOUT_QUOTES

After everthing is installed to locally deploy this project type

 vercel dev

Login with your Vercel account and your all set for Local Deployment on.

 localhost:3000

For web Deployment on Vercel use

 vercel deploy

 

💢 API Reference

 

API Index

  localhost:300/api/
Type File Description
string index.js Displays info about API

 

Redirect to original URL

  localhost:300/${shortId}
Parameter File Description
ShortId redirect.js Required ID of item to redirect

 

Register a new URL

 localhost:300/p/
Parameter File Description
url p.js Required url of main URL. Responds with a random shortID.

 

List all the URL's in the Database

  localhost:300/all
Parameter File Description
all.js Displays all the URL's in the database.

   

Register a custom ShortId

  localhost:300/custom/<shortIDLength>_<shortId><original_url>
Parameter File Description
<shortIDLength>_<shortId><original_url> custom.js Checks if the shortID is taken, return true if shortID is unique else return false if there exits any conflict shortID

Example

Parameter File Example
<shortIDLength>_<shortId><original_url> custom.js http://localhost:3000/3_adihttps://github.com/adithyapaib

 

If the link dosen't exits in Database

  localhost:300/404
Parameter File Description
/404 404.html 404 Page

 

🛰Environment Variables

To run this project, you will need to add the following environment variables to your .env file

DB = YOUR_MONGOURI

 

🌐Domains

Other domains to this project.

https://4543.ml

https://urml.ml

 

🚦Acknowledgements

  • Dont forget to 🙋🏼‍♂️Follow me on Github and Star⭐ this Repo

 

📑License

MIT

 

About

A URL shortener website and PWA build with vercel serverless cloud function, MongoDB and nodeJS

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 33.6%
  • SCSS 26.1%
  • HTML 24.4%
  • TypeScript 15.9%