Skip to content

Gautam-aman/TinyTrail

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyTrail: A Simple URL Shortener

Checkout : https://gleaming-sunflower-432961.netlify.app/

Java JavaScript Maven

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.

Features

  • 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.

Tech Stack

Backend (Java)

  • Java: Java 20
  • Framework: Spring Boot
  • Build Tool: Maven
  • Database: PostgreSQL

Frontend (JavaScript)

  • Framework: React
  • Package Manager: npm

Installation and Setup

To get a local copy up and running, follow these simple steps.

Prerequisites

  • Java JDK 20
  • Maven
  • npm
  • MySQL

1. Backend Setup

  1. Clone the repository:

    git clone [https://github.com/Gautam-aman/TinyTrail.git](https://github.com/Gautam-aman/TinyTrail.git)
    cd TinyTrail/Backend
  2. 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}
  3. Install Dependencies and Build:

    mvn clean install
  4. Run the application:

    mvn spring-boot:run

    The backend server will start on http://localhost:8080 (or as configured).

2. Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install NPM packages:

    npm install
  3. Run the development server:

    npm run dev

    The frontend application will open in your browser at http://localhost:3000.

Create a Short URL

  • 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"
    }

Redirect URL

  • GET /{shortCode}
  • Example: GET http://localhost:8080/aB12Cd
  • Response:
    • Redirects (302) to https://www.very-long-url-to-shorten.com/example

License

This project does not currently have a license.

About

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.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages