Shortly is a full-stack application developed using MERN Stack. It uses CRA for the frontend, tailwind CSS for styling, Express.js as a Node.js framework for creating applications, MongoDB to store information.
sequenceDiagram
Frontend ->> Backend: http://www.google.com
Note right of Backend: Backend will now validate the URL<br/>and then generate a shorten URL<br />which will be then saved to MongoDB
Backend-->>MongoDB: { link: http://google.com, shorten: gpeetkwiu }
Backend-->> Frontend: { link: http://google.com, shorten: gpeetkwiu }
Note right of Frontend: If we are retrieving the URL,<br/>frontend will send a shorten URL to<br />backend and will get the original URL
Frontend-->>Backend: { shorten: gpeetkwiu }
Backend->>MongoDB: { shorten: gpeetkwiu }
MongoDB->>Backend: { link: http://google.com, shorten: gpeetkwiu }
Backend->>Frontend: { link: http://google.com, shorten: gpeetkwiu }
Make sure docker is install before running any command and follow these instructions:
- Navigate to the backend folder
- Place the .env file with the
MONGO_URIto connect to MongoDB. - Navigate to the root folder
- Run
docker compose upfrom the command prompt while staying in the root folder. - Application will be up and running. (Frontend Port: 3000, Backend Port: 3100)
In order to run the application in development mode you have to run the frontend and backend applications separately.
- Navigate to Backend folder
- Run
npm install - Add the .env file with the
MONGO_URIto connect to MongoDB. - Once package installation is done, Run
npm run dev - Application will be up and running on port 3100.
- Navigate to frontend folder
- Run
npm install - Once package installation is done, Run
npm start - Application will be up and running on port 3000.