š 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)
- Clone the repo:
git clone https://github.com/your-username/url-shortener.git
cd url-shortener/backend
- Run the app (via your IDE or CLI):
./mvnw spring-boot:run
- 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)
- Navigate to frontend folder:
cd ../frontend
- Install dependencies and start dev server:
npm install
npm start
- 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!