A simple web application to generate short, easy-to-share links from long URLs. Built with Next.js, it provides a seamless user experience with loading indicators, error validation, and a polished UI.
Live Demo - BitURLs
- Real-time URL validation: Ensures only valid URLs are accepted.
- Short URL generation: Converts long URLs into short, shareable links.
- Error handling: Displays user-friendly error messages.
- Loading indicator: Shows a progress bar while processing requests.
- Responsive design: Fully optimized for various screen sizes.
- Frontend: Next.js
- Backend API: Next.js API routes.
- Database: MongoDB Atlas for storing original and short URLs.
- UUID: For generating unique short URL identifiers.
- Styling: Tailwind CSS for responsive and modern UI.
Ensure you have the following installed on your local machine:
- Node.js (v14 or above)
- npm or yarn
- MongoDB Atlas account (or a local MongoDB instance)
-
Clone the repository:
git clone https://github.com/surajgharpankar28/BitURLs.git cd BitURLs -
Install dependencies:
npm install # or yarn install -
Set up environment variables: Create a
.env.localfile in the root directory and add the following:NEXT_PUBLIC_HOST=http://localhost:3000 MONGODB_URI=your_mongodb_connection_string
-
Run the development server:
npm run dev # or yarn dev -
Open your browser and navigate to http://localhost:3000.
- Enter the original URL in the input field.
- Click "Make Short" to generate a short link.
- Copy and share the generated short URL.
- Use the "Clear" button to reset the form.
├── pages/
│ ├── api/
│ │ └── generate.js # API route for short URL creation
│ ├── _app.js # Application entry point
│ └── index.js # Main UI
├── styles/ # Tailwind CSS configuration
├── components/ # Reusable components (if any)
├── public/ # Static assets
├── .env.local # Environment variables
├── README.md # Project documentation
└── package.json # Project dependencies and scripts
Description: Creates a short URL for a given original URL.
Request Body:
{
"url": "https://example.com",
"shorturl": "abc123"
}Response:
{
"success": true,
"shorturl": "http://localhost:3000/abc123"
}- Analytics for tracking URL clicks.
- Custom short URL naming.
- User authentication for personalized short links.
Let me know if you'd like to tweak this further or add more sections! 🚀