An open API service indexing awesome lists of open source software.

https://github.com/lra8dev/quickshort

A simple and efficient URL Shortener App built using the MERN stack. This application allows users to shorten long URLs and redirect to the original URL when accessing the shortened link.
https://github.com/lra8dev/quickshort

Last synced: 6 months ago
JSON representation

A simple and efficient URL Shortener App built using the MERN stack. This application allows users to shorten long URLs and redirect to the original URL when accessing the shortened link.

Awesome Lists containing this project

README

          





Project Banner




reactjs
typescript
expressjs
tailwindcss
mongodb


QuickShort - Tiny Links, Big Impact! πŸš€


A simple and efficient URL Shortener App built using the MERN (MongoDB, Express.js, React.js, Node.js) stack. This application allows users to shorten long URLs and redirect to the original URL when accessing the shortened link.


## πŸ“‹ Table of Contents

1. πŸ•ΈοΈ [Features](#-features)
2. βš™οΈ [Tech Stack](#️-tech-stack)
3. πŸ“‚ [Project Structure](#️-project-structure)
4. 🀸 [Quick Start](#-getting-started)
5. πŸ”— [API Endpoints](#-api-endpoints)
6. πŸ”­ [Deployment](#-deployment)
7. πŸͺ΄ [Future Enhancements](#-future-enhancements)
8. 🀝 [Contributing](#-contributing)
9. πŸ“„ [License](#-license)
10. πŸ“© [Contact](#-contact)

## πŸš€ Features

- πŸ”— Shorten long URLs with a unique identifier
- πŸš€ Instant redirection to the original URL
- πŸ“Š Track the number of clicks for each shortened link
- 🌐 Responsive and user-friendly UI
- 🎨 Styled with Tailwind CSS

## πŸ› οΈ Tech Stack

### **Frontend**

- React.js (Vite for fast development)
- Tailwind CSS (for modern UI styling)
- React Query (for state management)
- Axios (for API requests)

### **Backend**

- Node.js & Express.js (REST API)
- MongoDB & Mongoose (Database & Schema management)
- nanoid (for generating unique short URLs)
- dotenv & cors (environment configuration & cross-origin handling)

## πŸ—οΈ Project Structure

```ts
/url-shortener
β”œβ”€β”€ client/ (React.js Frontend)
β”œβ”€β”€ server/ (Express.js Backend)
β”œβ”€β”€ public/ (Static Assets)
β”œβ”€β”€ package.json (Project Dependencies)
β”œβ”€β”€ .gitignore (Git Ignore File)
β”œβ”€β”€ LICENSE (Project License)
β”œβ”€β”€ README.md (Project Documentation)
```

## 🀸 Getting Started

Follow these steps to set up the project locally on your machine.

**Prerequisites**

Make sure you have the following installed on your machine:

- [Git](https://git-scm.com/) - for version control
- [Node.js](https://nodejs.org/en/) - for running JavaScript on the server
- [pnpm](https://www.pnpm.io/) - for package management

### 1️⃣ Clone the Repository

```sh
git clone https://github.com/your-username/quickshort.git
cd quickshort
```

### 2️⃣ Backend Setup (Node.js & Express)

```sh
cd server
pnpm install
```

#### πŸ”Ή Create a `.env` file in the `server/` directory

```ts
CLIENT_API = ;
SERVER_API = ;
MONGO_URI = ;
PORT = 5000;
```

#### πŸ”Ή Start the Backend Server

```sh
pnpm dev
```

### 3️⃣ Frontend Setup (React.js)

```sh
cd ../client
pnpm install
```

#### πŸ”Ή Create a `.env` file in the `client/` directory

```ts
VITE_SERVER_API = ;
```

#### πŸ”Ή Start the Frontend Server

```sh
pnpm dev
```

### 4️⃣ Open the App

Visit: [http://localhost:5173](http://localhost:5173)

## πŸ“Œ API Endpoints

### 1️⃣ **Shorten a URL**

**POST** `/short`

```json
{
"longUrl": "https://example.com"
}
```

**Response:**

```json
{
"shortUrl": "http://localhost:5000/abc1234"
}
```

### 2️⃣ **Redirect to Original URL**

**GET** `/:shortId`

When visiting `http://localhost:5000/abc1234`, it redirects to `https://example.com`.

## 🌍 Deployment

- **Frontend**: Vercel
- **Backend**: Render
- **Database**: MongoDB Atlas

## πŸ”₯ Future Enhancements

βœ… Add User Authentication (JWT)
βœ… Allow Custom Short URLs
βœ… Track Click Analytics
βœ… Create a Dashboard for Managing URLs

## πŸ™Œ Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

To contribute:

Fork the repository
Create your feature branch (`git checkout -b feature/your-feature`)
Commit your changes (`git commit -m 'feat: add your feature'`)
Push to the branch (`git push origin feature/your-feature`)

## πŸ“œ License

This project is licensed under the Apache License - see the [LICENSE](LICENSE) file for details.

## πŸ“© Contact

For any questions or suggestions, feel free to reach out at [laxmanrathod.dev@gmail.com](mailto:laxmanrathod.dev@gmail.com).