https://github.com/rahul07bagul/url-shortener
https://github.com/rahul07bagul/url-shortener
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/rahul07bagul/url-shortener
- Owner: rahul07bagul
- License: mit
- Created: 2025-03-04T03:42:17.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-03-04T03:44:01.000Z (3 months ago)
- Last Synced: 2025-03-04T04:28:52.809Z (3 months ago)
- Language: Java
- Size: 0 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# URL-Shortener
A robust, scalable URL shortening service built with Java and Spring Boot.
## Demo
## High Level Design
## Class Diagram
## Features
- Generate short, unique URLs for any valid web address
- Configurable short code generation strategies (random Base62 or sequential counter)
- Multiple storage options (in-memory, Redis, MySQL)
- RESTful API for URL management
- Redirect service with analytics tracking
- Scalable architecture ready for high-traffic deployment## Running the application
1. Clone the repository
```sh
https://github.com/rahul07bagul/URL-shortener.git
cd url-shortener
```
2. Configure database (if using MySQL):
```sh
mysql -u root -p
CREATE DATABASE urlshortener;
```
3. Start redis server (if available) else change application properties to use mysql or in-memory database.
```sh
//By default application starts for redis and mysql
spring.profiles.active=db //mysql profile
spring.profiles.active=dev //in-memory database profile
```
5. Build and run:
```sh
mvn clean install
```## API Usage
- Create a Short URL
```sh
POST /api/v1/shorten
Content-Type: application/json
{
"longUrl": "https://example.com/very/long/url/that/needs/shortening"
}
```- Get Original URL Info
```sh
GET /api/v1/info/{shortCode}
```- Get Original URL Info
```sh
GET /{shortCode}
```## Configuration Options
```sh
url.shortener.generator.type: ID generation strategy (base62 or counter)
url.shortener.code.length: Length of generated short codes (default: 6)
url.shortener.base.url: Base URL for the shortener service
```