π Linkly β URL Shortener
A full-stack production-ready URL shortener built with Spring Boot, React, PostgreSQL, Docker, and JWT Authentication.
Live Demo: Frontend β https://linksshort.netlify.app
Backend β https://url-shortener-backend-latest.onrender.com
β¨ Features
π JWT-based Authentication (Login / Register)
π Shorten long URLs
π Click analytics tracking
π€ User-based URL management
π³ Dockerized backend
βοΈ Cloud deployed (Render + Netlify)
π‘ Spring Security 6 with CORS configuration
π PostgreSQL (Neon Cloud Database)
π Tech Stack Backend
-
Java 18
-
Spring Boot 4
-
Spring Security
-
Spring Data JPA
-
PostgreSQL
-
JWT (io.jsonwebtoken)
-
Docker
Frontend
- React (Vite)
- Tailwind CSS
- React libraries(@mui/material, @emotion/react and emotion/styled)
- Data Handling(Axios, React Query, chart.js)
- Utlity tools (day.js)
Deployment
-
DockerHub
-
Render (Backend)
-
Netlify (Frontend)
-
Neon (PostgreSQL)
π Project Structure
linkly/
β
βββ backend/
β βββ controller/
β βββ service/
β βββ repository/
β βββ entity/
β βββ security/
β βββ Dockerfile
β βββ pom.xml
β
βββ frontend/
β βββ components/
β βββ pages/
β βββ api/
β βββ package.json
π Environment Variables
Backend requires these environment variables:
SPRING_DATASOURCE_URL=
SPRING_DATASOURCE_USERNAME=
SPRING_DATASOURCE_PASSWORD=
JWT_SECRET=
JWT_EXPIRATION=
FRONTEND_URL=
Frontend requires:
VITE_BACKEND_URL= https://url-shortener-backend-latest.onrender.com
VITE_REACT_FRONT_END_URL= https://linksshort.netlify.app
π³ Run Backend with Docker
Build JAR:
mvn clean package -DskipTests
Build Docker image:
docker build -t url-shortener-backend .
Run container:
docker run -p 8080:8080 url-shortener-backend
π» Run Locally Backend
mvn spring-boot:run
Frontend
npm install
npm run dev
π API Endpoints Authentication
POST /api/auth/public/register
POST /api/auth/public/login
URL Operations
POST /api/urls/shorten
GET /api/urls
GET /api/urls/analytics/{shortUrl}
π₯ Deployment Architecture
React (Netlify)
β
Spring Boot (Render - Dockerized)
β
PostgreSQL (Neon Cloud)
π‘ Security
-
Stateless JWT authentication
-
Custom CORS configuration
-
Protected endpoints using Spring Security
-
Password hashing using BCrypt
π Future Improvements
-
Custom domain support
-
Refresh token implementation
-
Rate limiting
-
Redis caching for analytics
-
Swagger documentation
-
Custom error response handler
π¨βπ» Author
Shubham Kumar
Full Stack developer | Java Backend Developer | Spring Boot Enthusiast
β If You Like This Project
Give it a β on GitHub!