MCPSERV.CLUB
Simple-URL-Shortener

Simple-URL-Shortener

Self-Hosted

KISS URL shortener with user comments

Stale(68)
57stars
0views
Updated Aug 28, 2025

Overview

Discover what makes Simple-URL-Shortener powerful

Simple‑URL‑Shortener is a minimal, KISS‑compliant URL shortener written in vanilla PHP that supports both MySQL and SQLite backends. Its core purpose is to expose a lightweight API for creating, retrieving, and managing short links without the bloat of modern frameworks. The application exposes a web interface for users to register, log in, and create short URLs with optional comments. The comment field is the primary search aid; it allows developers to tag links for later retrieval, which can be leveraged in larger systems that need human‑readable metadata on short URLs.

Stateless PHP core

Dual‑database support

User management

Comment‑driven search

Overview

Simple‑URL‑Shortener is a minimal, KISS‑compliant URL shortener written in vanilla PHP that supports both MySQL and SQLite backends. Its core purpose is to expose a lightweight API for creating, retrieving, and managing short links without the bloat of modern frameworks. The application exposes a web interface for users to register, log in, and create short URLs with optional comments. The comment field is the primary search aid; it allows developers to tag links for later retrieval, which can be leveraged in larger systems that need human‑readable metadata on short URLs.

Key Features

  • Stateless PHP core – no external dependencies beyond the PHP runtime and a database driver.
  • Dual‑database support – works out of the box with MySQL or SQLite, giving developers flexibility to choose a lightweight file‑based store for low‑traffic sites or a robust relational engine for production.
  • User management – simple authentication with cookie‑based sessions (secure flag enforced on HTTPS). The first registered user becomes an admin, providing a quick path to enable link analytics or bulk operations.
  • Comment‑driven search – every short URL can have an optional comment; the UI lists links grouped by user and searchable via keyword, making it useful for internal documentation or tracking campaigns.

Technical Stack

LayerTechnology
LanguagePHP 7.x (compatible with 8.x)
Web ServerApache (via .htaccess) or Nginx (rewrite rules provided)
DatabaseMySQL / MariaDB, SQLite3
FrontendPure HTML/CSS with minimal JavaScript; no framework dependencies

The application is intentionally unopinionated: it ships a single index.php that routes all requests through URL rewriting. The routing logic is simple: the path component becomes a query parameter (site) which is then resolved to either a short URL or a page. This design keeps the codebase small and easy to audit.

Core Capabilities & API

  • REST‑style endpoints – While the UI is primarily HTML, the same logic can be reused to build a lightweight JSON API:
    • POST /?action=create – create a short link (url, optional short, comment).
    • GET /?site={code} – redirect to the original URL.
  • Admin actions – List all users’ links, delete or edit entries, and export link data.
  • Configurationinc/config.php holds database credentials, base URL, and security flags. The file can be templated for Docker or CI pipelines.

Deployment & Infrastructure

The project is designed for self‑hosting on any LAMP or LEMP stack. A single PHP file per request means it scales linearly with CPU, and SQLite support allows deployment on edge devices or CI runners. For production workloads, the recommended setup is:

  1. Docker – a lightweight image with PHP‑FPM and Nginx, mounting the source code as a volume.
  2. High‑availability – duplicate instances behind a load balancer; the database layer is the single point of contention, so use replication or read‑replicas if needed.
  3. Security – the app forces HTTPS for cookie transmission; it also denies access to .sqlite3 and .ht files via Nginx rules, protecting the database file from direct download.

Integration & Extensibility

The codebase exposes a small set of hooks:

  • Custom routing – By modifying index.php, developers can add new query parameters or rewrite rules.
  • Webhooks – The redirect handler (index.php?site=…) can be extended to trigger external callbacks (e.g., analytics services).
  • Plugin skeleton – While not a full plugin system, the inc/ directory can house additional PHP modules that are included at runtime.
  • API keys – Future forks could add an API key system for programmatic access, which would be trivial to implement given the existing routing logic.

Developer Experience

  • Zero dependencies – No Composer, no Node.js. The entire project fits in a single Git repository with clear commit history.
  • Documentation – The README covers installation, configuration, and web‑server rewrites; the code comments are minimal but consistent.
  • Community – The project is dormant, but its simplicity invites forks; the original author welcomes improvements.
  • Licensing – The repository is released under an MIT‑style license, allowing commercial use without attribution requirements.

Use Cases

  1. Internal Documentation – Teams can create short, human‑readable links to wiki pages or code snippets and annotate them with comments for quick reference.
  2. Marketing Campaigns – Developers can generate short URLs on‑the‑fly for A/B testing, attaching campaign identifiers as comments.
  3. Edge Deployment – Because it supports SQLite, the shortener can run on IoT gateways or local servers where a full MySQL installation is impractical.
  4. Educational Projects – Its bare‑bones architecture makes it an excellent teaching tool for PHP routing, session handling, and database CRUD operations.

Advantages Over Alternatives

CriterionSimple‑URL‑ShortenerCompetitors (e.g., Shlink, YOURLS)
Footprint< 50 KB PHP + assets> 200 KB, often with Composer dependencies
Setup

Open SourceReady to get started?

Join the community and start self-hosting Simple-URL-Shortener today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
apis-services
License
MIT
Stars
57
Technical Specs
Pricing
Open Source
Database
Multiple
Supported OS
Linux
Author
azlux
azlux
Last Updated
Aug 28, 2025