Checkout : https://gleaming-sunflower-432961.netlify.app/
A simple and efficient URL shortener built using Java. This project allows you to shorten long URLs into compact, easy-to-share links and track their usage.
Perfect for learning backend development, REST APIs, and database integration with Java.
- Shorten Long URLs: Convert any long URL into a compact TinyTrail link.
- Link Redirection: Automatically redirects the short link to the original destination.
- Usage Tracking: Track the number of clicks for each shortened link.
- REST API: A clean and simple API for creating and managing links.
- Java: Java 20
- Framework: Spring Boot
- Build Tool: Maven
- Database: PostgreSQL
- Framework: React
- Package Manager: npm
To get a local copy up and running, follow these simple steps.
- Java JDK 20
- Maven
- npm
- MySQL
-
Clone the repository:
git clone [https://github.com/Gautam-aman/TinyTrail.git](https://github.com/Gautam-aman/TinyTrail.git) cd TinyTrail/Backend -
Configure Database:
- Navigate to
src/main/resources/application.properties(or.yml). - Update the database connection settings (URL, username, password).
# spring.datasource.url= ${DATABASE_UR} # spring.datasource.username=root # spring.datasource.password=your_password # spring.jpa.hibernate.ddl-auto=update # spring.jpa.show-sql=true # spring.jpa.database-platform= ${DATABASE_DIALECT} # jwt_expiration = ${JWT_EXPIRATION} # jwt_secret = ${JWT_SECRET} # FRONTEND_URL = ${FRONTEND_URL}
- Navigate to
-
Install Dependencies and Build:
mvn clean install
-
Run the application:
mvn spring-boot:run
The backend server will start on
http://localhost:8080(or as configured).
-
Navigate to the frontend directory:
cd frontend -
Install NPM packages:
npm install
-
Run the development server:
npm run dev
The frontend application will open in your browser at
http://localhost:3000.
- POST
/api/v1/shorten - Body (JSON):
{ "originalUrl": "[https://www.very-long-url-to-shorten.com/example](https://www.very-long-url-to-shorten.com/example)" } - Success Response (200 OK):
{ "shortUrl": "http://localhost:8080/aB12Cd" }
- GET
/{shortCode} - Example:
GET http://localhost:8080/aB12Cd - Response:
- Redirects (302) to
https://www.very-long-url-to-shorten.com/example
- Redirects (302) to
This project does not currently have a license.