Skip to content

juniorsir/Url_shortner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 

Repository files navigation

🚀 MyShort Ultra | Professional URL Suite

Maintained by JuniorSir   


A high-performance URL shortening engine featuring a premium Glassmorphism UI and Smart App-Routing technology.


MyShort Ultra is a high-performance URL shortening engine built with Next.js/Vercel, featuring a premium Glassmorphism UI, JWT Security, and a Smart App-Routing Engine designed to bypass restricted social media browsers (Instagram, TikTok, Facebook).


Experience the Next-Gen Interface

Web ui available at:
https://myshort.vercel.app


✨ Core Features

  • 💎 Glass Theme: Advanced backdrop blur transparency with dynamic Aura theme switching.
  • 📱 App-Aware Redirects: Automatically triggers native apps (YouTube, Spotify) on mobile devices.
  • 🔒 Dual-Layer Auth: Secure JWT-based access for Owners (Admins) and Sub-Users (API keys).
  • 🛠 Multi-Language API: Programmatic link creation via Python, Node.js, JS, and cURL.
  • 📊 Local Analytics: Persistent history and click tracking stored in the user's browser.
  • 🎨 Dynamic Branding: Real-time Favicon fetching for link previews.

🛠 Setup & Environment Variables

Deploy this project on Vercel and add these Environment Variables:

Key Description Example Value
JWT_SECRET Secret key used to sign and verify security tokens. a_very_long_random_string
PUBLIC_FORM_ENABLED Allow visitors to create links without a token. true
PUBLIC_CUSTOM_ALIAS_ENABLED Allow visitors to set their own slug (e.g. /my-link). false

🔑 Permissions & Roles

The system uses JWT payloads to enforce different access levels:

Feature Owner (Admin) Sub-User Public
Create Links via UI/API
Custom Aliases
Iframe Mode
Manage Ad Slots
Manage User Keys
Export/Import DB

🛰 API Documentation

1. Authenticate (POST /api/auth)

Exchange a password for a JWT token (Valid for 2 hours).

Request Body:

{ "password": "YOUR_PASSWORD" }

Response

{ "token": "eyJhbGciOiJIUzI1NiIsIn...", "role": "admin" }

Create Smart Links ( POST /api/shorten)

Header: json Authorization: Bearer <YOUR_TOKEN>

Request Body:

Field Type Required Description
long string Yes The destination URL.
alias string No Custom slug (3-20 characters).
iframe boolean No If true, uses Iframe mode (Admin only).

💻 Language Examples (One-File Integration)

These examples show how to Authenticate and Shorten in a single execution.


🔑 Requesting API Access

Access to create links via the API is restricted to authorized partners and administrators. If you require a unique Sub-User Password and JWT Token, please reach out through the following official channels:

Channel Contact Link
Telegram Telegram
Email Email

Note: Please include your project name and expected monthly click volume in your request.

🐍 Python (using requests)

import requests

API_BASE = "https://myshort.vercel.app"
PASSWORD = "get_your_password"

def quick_shorten(url, slug=None):
    # 1. Auth
    auth = requests.post(f"{API_BASE}/api/auth", json={"password": PASSWORD}).json()
    token = auth.get("token")
    
    # 2. Shorten
    headers = {"Authorization": f"Bearer {token}"}
    data = {"long": url, "alias": slug}
    res = requests.post(f"{API_BASE}/api/shorten", json=data, headers=headers).json()
    
    print(f"🚀 Short URL: {res.get('short')}")

quick_shorten("https://github.com/juniorsir", "cool-vid")

Dont forget to install axios

npm install axios

🟢 Node.js (using axios)

const axios = require('axios');

// --- Configuration ---
const CONFIG = {
    apiBase: "https://myshort.vercel.app",
    password: "your_password_here"
};

async function createSmartLink(longUrl, customAlias = null) {
    try {
        console.log("🔄 Authenticating...");
        
        // 1. Exchange password for a secure JWT Token
        const authResponse = await axios.post(`${CONFIG.apiBase}/api/auth`, {
            password: CONFIG.password
        });
        
        const token = authResponse.data.token;
        console.log("✅ Token Obtained.");

        // 2. Use the token to shorten the URL
        const shortenResponse = await axios.post(
            `${CONFIG.apiBase}/api/shorten`,
            { 
                long: longUrl, 
                alias: customAlias 
            },
            { 
                headers: { 
                    'Authorization': `Bearer ${token}`,
                    'Content-Type': 'application/json'
                } 
            }
        );

        console.log("🚀 Success! Your link is ready:");
        console.log("🔗 Short URL:", shortenResponse.data.short);
        return shortenResponse.data.short;

    } catch (error) {
        // Handle Errors gracefully
        const message = error.response ? error.response.data.error : error.message;
        console.error("❌ Error:", message);
    }
}

// --- Usage ---
createSmartLink("https://github.com/juniorsir", "my-pro-video");

🖥️ cURL (Terminal/Bash)

# Get token first
TOKEN=$(curl -s -X POST https://myshort.vercel.app/api/auth \
     -H "Content-Type: application/json" \
     -d '{"password": "your_password"}' | jq -r '.token')

# Create link
curl -X POST https://myshort.vercel.app/api/shorten \
     -H "Authorization: Bearer $TOKEN" \
     -H "Content-Type: application/json" \
     -d '{"long": "https://github.com/juniorsir"}'

⚠️ Error Reference

• 401 Unauthorized: Token is expired or password is wrong. • 403 Forbidden: Sub-user attempted to use an Admin-only feature (like Iframe). • 409 Conflict: The custom alias is already in use.

🤝 Credits & Support

MyShort Ultra Suite is developed and maintained by JuniorSir.

🤝 Let's Connect!

If you like my projects, feel free to follow me for the latest updates!



Made with ❤️ by JuniorSir at © 2025 MyShort Ultra Suite

About

Access

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors