Rafif Muchsin

Link Shortener

Error

Something went wrong

Documentation

This is a completely serverless link shortener that uses GitHub repo as the database. It offers 100% data ownership with zero database hosting costs. Anyone can use this tool by only providing a Target URL, User, Repo, and GitHub Token.

It's also possible to use it by cloning the repository.

1. How to Use It

  • Create a Database: Make a new, empty public GitHub repository (e.g., my-links).
  • Get a Token: Go to your GitHub Developer Settings and generate a Personal Access Token (classic) with the repo scope.
  • Generate: Select "Custom", input your Target URL, User, Repo, and Token. Click Generate!

2. Token Privacy & Security

Your GitHub Token is stored locally in your browser (securely in IndexedDB) to avoid repeated typing. To keep your credentials safe from casual inspection or malicious browser scrapers, we use a Symmetric XOR Obfuscation layer:

  • Obfuscated Storage: Before being saved to the browser's IndexedDB, your token is processed via a bitwise XOR cipher and Base64 encoded. It never exists as plain text in your storage.
  • Zero Server Contact: The token is only used to communicate directly with api.github.com. It never touches any third-party analytics or backend servers.
  • Clearing: To remove a previously saved token, click the trash icon next to the Token field in the dashboard; this clears the stored token from your browser's IndexedDB.

3. Autofill & Presets (domains.json)

The "Preset" dropdown reads from a file called domains.json located in the project's root. The Default (Root) option is auto-filled to save you time if you have a primary repository you use constantly.

Why add a new option? If you want to categorize your links (e.g., one repo for /blog/ and another for /dl/ by modifying its "prefix"), you can clone this project and edit domains.json to add custom prefixes.

[
    {
    "prefix": "",
    "name": "Default",
    "user": "rafifmsn",
    "repo": "rmsn-link-base",
    "default": true
    },
    {
    "prefix": "tr",
    "name": "Trash",
    "user": "rafifmsn",
    "repo": "trash-bin",
    "default": false
    }
]

4. Link Formats (Clean vs. Portable)

The system uses a Smart Match routing logic. The generated link adapts based on whether your repository is registered in domains.json or not:

  • Registered Repo (Clean URL):
    If your User/Repo matches a preset, you get a clean URL.
    s.domain.com/01JG... (or /prefix/01JG...)
  • Unregistered Repo (Portable Hash):
    If you use the "Custom" option for a repo not in your config, the resolver uses URL hashes to locate it.
    s.domain.com/01JG...#u=user&r=repo