This is a full-stack URL Shortener application built using the MERN stack (MongoDB, Express, React, Node.js). The frontend is developed with Vite+React+TypeScript, and the backend uses Node.js, Express, and MongoDB.
- Shorten URLs: Convert long URLs into short, manageable links.
- Custom URLs: Create memorable custom short URLs.
- Analytics: Track the number of clicks on your shortened URLs.
- User-Friendly: Intuitive and easy-to-use interface with Tailwind CSS styling.
- Node.js
- MongoDB
- npm (Node Package Manager)
git clone https://github.com/your-username/url-shortener.git
cd url-shortener
cd client
npm install
cd ../server
npm install
cd server
npm start
cd ../client
npm run dev
Create a .env
file in the server
directory and add the following environment variables:
MONGODB_URI=your_mongodb_connection_string
PORT=5001
- Sign in to Vercel.
- Import the
client
directory from your GitHub repository. - Set the framework preset to Vite.
- Set the build command to
npm run build
. - Set the output directory to
dist
. - Deploy the project.
- Create a new project in Vercel for the
server
. - Import the
server
directory from your GitHub repository. - Set the framework preset to Node.js.
- Add necessary environment variables (e.g.,
MONGODB_URI
). - Deploy the project.
- Navigate to the deployed client application.
- Enter a long URL in the input field.
- Click "Shorten URL".
- Use the generated short URL to share and track clicks.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.