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

https://github.com/imperviousdeveloper/url-shortner-react

An efficient and modern URL Shortener application
https://github.com/imperviousdeveloper/url-shortner-react

react spring-boot

Last synced: 3 months ago
JSON representation

An efficient and modern URL Shortener application

Awesome Lists containing this project

README

          

# ๐ŸŒ URL Shortener Application

## ๐Ÿš€ Introduction

The **URL Shortener Application** is a sleek and modern web solution built with **React** on the frontend and **Spring Boot** on the backend. This application allows users to shorten long URLs into more manageable links and track the number of visits for each shortened URL.

## โœจ Features

- ๐Ÿ”— Generate short URLs instantly
- ๐Ÿ“Š Track the number of clicks on shortened URLs
- ๐Ÿง‘โ€๐Ÿ’ป REST API for URL shortening and analytics
- ๐ŸŒ Customizable short links (optional feature)
- ๐ŸŽ๏ธ Lightning-fast performance with React & Spring Boot

## ๐Ÿ› ๏ธ Tech Stack

### Frontend

- React
- React Router
- Axios
- TailwindCSS

### Backend

- Spring Boot
- Spring Data JPA
- Hibernate
- PostgreSQL (or H2 for local development)
- Lombok

## ๐Ÿ“ฆ Installation & Setup

### Prerequisites

- Java 17+
- Node.js & npm
- PostgreSQL (or Docker if preferred)

### Backend Setup

```bash
cd backend
./mvnw clean install
./mvnw spring-boot:run
```

### Frontend Setup

```bash
cd frontend
npm install
npm start
```

## ๐Ÿง‘โ€๐Ÿ’ป API Endpoints

| Method | Endpoint | Description |
|--------|------------------------|----------------------------------|
| POST | /api/v1/shorten | Shorten a URL |
| GET | /api/v1/{shortCode} | Redirect to the original URL |
| GET | /api/v1/stats/{shortCode} | Get visit count for a short URL |

## โš™๏ธ Environment Variables

Create a `.env` file in both `backend` and `frontend` directories:

### Backend `.env`:

```env
DATABASE_URL=jdbc:postgresql://localhost:5432/url_shortener
DATABASE_USERNAME=your_db_user
DATABASE_PASSWORD=your_db_password
```

### Frontend `.env`:

```env
REACT_APP_API_BASE_URL=http://localhost:8080/api/v1
```

## ๐Ÿ–ผ๏ธ Screenshots

![Homepage](https://via.placeholder.com/600x300?text=Homepage+Screenshot)
![Shortened URL](https://via.placeholder.com/600x300?text=Shortened+URL+Screenshot)

## ๐Ÿงช Testing

- Frontend Unit Tests with Jest & React Testing Library
- Backend Tests with JUnit & MockMVC

## ๐Ÿš€ Future Enhancements

- โœ… User Authentication for personalized URL tracking
- โœ… Custom domain support for short URLs
- โœ… QR code generation for short links
- โœ… Expiry dates for short URLs

## ๐Ÿค Contributing

Contributions are welcome! Feel free to fork the repository and open a pull request.

## ๐Ÿ“ซ Contact

- **Email:** [mr.sharmajeerajan@gmail.com](mailto:mr.sharmajeerajan@gmail.com)

- **LinkedIn:** [LinkedIn Profile](https://www.linkedin.com/in/rajan-kumar-sharma-709a17229/)

---

> "Great software is built by passionate developers."