URL_Shortener Tailwind Templates

Url_shortener

A full-stack application developed using React, Tailwind CSS, and Spring Boot with a PostgreSQL backend. This project allows users to shorten long URLs and manage their links efficiently. The application features robust input validation, error handling, and seamless redirection logic.

šŸ”— URL Shortener

A full-stack, scalable URL Shortener built with React and Spring Boot

āš™ļø Tech Stack

Frontend

  • āš›ļø React
  • 🧭 React Router DOM
  • šŸŽØ CSS Modules / Tailwind (custom styling)

Backend

  • ā˜• Spring Boot
  • šŸ—„ļø JPA + H2 / PostgreSQL (configurable)
  • šŸ“¦ RESTful JSON API

🧠 Features

  • āœ… Shorten long URLs with unique, shareable short links
  • āœ… Redirection with statistics support (future enhancement)
  • āœ… Clean, modern UI with responsive design

šŸš€ How to Run Locally

šŸ”§ Backend (Spring Boot)

  1. Clone the repo:
    git clone https://github.com/your-username/url-shortener.git
    cd url-shortener/backend
    
  2. Run the app (via your IDE or CLI):
    ./mvnw spring-boot:run
    
  3. The backend should be up at: http://localhost:8080

Note: Replace application.properties with your DB configs if using PostgreSQL or another DB.

šŸŽØ Frontend (React)

  1. Navigate to frontend folder:
    cd ../frontend
    
  2. Install dependencies and start dev server:
    npm install
    npm start
    
  3. The frontend will run at: http://localhost:3000

šŸ›”ļø API Overview

POST /api/auth/register

  • Body: { "username": "user", "password": "pass" }
  • Creates a new user

POST /api/auth/login

  • Body: { "username": "user", "password": "pass" }
  • Returns: JWT Token

POST /api/url/shorten

  • Headers: Authorization: Bearer <token>
  • Body: { "longUrl": "https://example.com" }
  • Returns: Short URL

GET /api/url/user

  • Headers: Authorization: Bearer <token>
  • Returns: List of user's shortened URLs

šŸ“ Folder Structure

src/
│
ā”œā”€ā”€ pages/
│   ā”œā”€ā”€ Home.js
│   ā”œā”€ā”€ Login.js
│   ā”œā”€ā”€ Register.js
│   ā”œā”€ā”€ Dashboard.js
│
ā”œā”€ā”€ components/
│   └── Navbar.js
│
ā”œā”€ā”€ App.js
└── index.js

šŸ’” Future Enhancements

  • šŸ” JWT-based Auth (via custom useAuth hook)
  • 🧰 Spring Security + JWT
  • āœ… User authentication: Register, Login (JWT tokens)
  • āœ… Personalized Dashboard to: 1. View all shortened URLs 2. Copy short links 3. View original long URLs
  • šŸ“Š Click analytics and URL stats
  • šŸ“… Expiry time for short URLs
  • šŸ“ˆ Charts on Dashboard
  • šŸ” Forgot password & OAuth logins
  • 🌐 Custom domains

šŸ§‘ā€šŸ’» Author

Made with ā¤ļø by Sunil (https://github.com/snerall1)
Feel free to fork, contribute or star the project!

Top categories

Loading Svelte Themes