URLSpin is a modern web application built using Next.js and MongoDB. It allows users to shorten long URLs into compact, shareable links and manage them with analytics and customization options.
- Quick URL Shortening: Shorten long URLs into concise links instantly.
- Custom Links: Create personalized short links for branding.
- Analytics Dashboard: Track clicks, geographic data, and other stats for each link.
- URL Management: Edit or delete your shortened links easily.
- API Access: Integrate shortening functionality into your own applications.
- Mobile-Friendly: Fully responsive design for all devices.
- Secure and Reliable: Prioritizes user data protection and service uptime.
- Frontend: Next.js
- Backend: Node.js (via Next.js API routes)
- Database: MongoDB
- Styling: Tailwind CSS
- Hosting: [Your Hosting Platform, e.g., Vercel or AWS]
Ensure you have the following installed:
- Node.js (v16 or higher)
- MongoDB (local or cloud instance)
-
Clone the repository:
git clone https://github.com/adilc0070/url-shortener.git
-
Navigate to the project directory:
cd url-shortener
-
Install dependencies:
npm install
-
Set up environment variables: Create a
.env
file in the root directory with the following keys:MONGODB_URI=your-mongodb-uri
-
Start the development server:
npm run dev
-
Open your browser and navigate to:
http://localhost:3000
- POST
/api/shorten
- Request Body:
{ "originalUrl": "https://example.com" }
- Response:
{ "shortCode": "eBUXJg", "shortUrl": "http://localhost:3000/eBUXJg" }
- GET
/:shortCode
- Redirects to the original URL.
url-shortener/
├── app/
│ ├── api/
│ │ └── shorten/
│ │ └── route.js
│ ├── [shortCode]/
│ │ └── page.js
│ ├── features/
│ │ └── page.js
│ ├── privacy/
│ │ └── page.js
│ ├── terms/
│ │ └── page.js
│ └── page.js
├── components/
│ ├── ActionButtons.js
│ ├── Footer.js
│ ├── Header.js
│ └── UrlContent.js
├── models/
│ ├── Url.js
├── utils/
│ ├── generateShortCode.js
│ └── mongodb.js
└── public/
- Add user authentication
- Enable link expiration feature
- Provide advanced analytics
- Implement dark mode
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name
- Commit your changes:
git commit -m "Add feature-name"
- Push to the branch:
git push origin feature-name
- Create a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
If you have any questions or feedback, feel free to reach out:
- Email: adilc0070@gmail.com
- GitHub: adilc0070
- Website: adilc0070.site
Thank you for using URLSpin! 🎉