Loading repository data…
Loading repository data…
arumes31 / repository
A modern, high-performance, and feature-rich self-hosted URL shortener built with Flask, PostgreSQL, Redis, and SQLAlchemy. Features custom QR codes, link rotation, local MaxMind GeoIP analytics, automatic phishing link screening, and strict security hardening.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
start_at and end_at parameters, or automatic time-to-live (TTL) limits.--require-hashes) for container builds.Every link request undergoes security screening and database optimization before resolving:
graph TD
A[User requests short code /ABC123] --> B{Phishing Check}
B -- Is Domain Blocked? --> C[Return 403 Forbidden]
B -- Safe --> D{Expired / Inactive?}
D -- Expired/Future Window --> E[Return 404 Not Found]
D -- Active --> F{Password Protected?}
F -- Yes --> G[Prompt User for Password]
G -- Invalid --> G
G -- Valid --> H{Rotational Redirect?}
F -- No --> H
H -- Yes --> I[Resolve Rotated Target]
H -- No --> J[Resolve Main URL]
I --> K[Update Analytics: GeoIP / User Agent]
J --> K
K --> L[302 Redirect to Target]
/metricsEnsure safe execution by loading our production-ready image verified with strict security hashes:
docker-compose.ghcr.yml as your template:
services:
app:
image: ghcr.io/arumes31/redrx:latest
ports:
- "5000:5000"
environment:
- SECRET_KEY=your-production-cryptographic-secret
- DATABASE_URL=postgresql://redrx:securepassword@db:5432/redrx_db
- BASE_DOMAIN=short.yourdomain.com
docker-compose up -d
docker-compose up --build
The application will boot and expose itself at http://localhost:5000.
To secure development packages from production builds, dependencies are segregated into human-editable templates and strict hash-verified lock files.
requirements.txt: Master direct runtime dependency source.requirements.lock.txt: production locked pins, generated with SHA-256 package signatures (--require-hashes).requirements-dev.txt: Dev dependencies including pytest.requirements-dev.lock.txt: dev-specific lock with full package tree and hashes.Ensure virtual environment activation and run strict hash-verified installation:
# Windows PowerShell
python -m venv venv
.\venv\Scripts\Activate.ps1
# Install package set with secure hashes
pip install --require-hashes -r requirements-dev.lock.txt
Set your local env to debug/development and launch:
# Run the local server
$env:FLASK_DEBUG="true"
python run.py
# Execute full automated test suite (all checks pass)
pytest
| Category | Variable | Default | Description |
|---|---|---|---|
| Core | SECRET_KEY | - | Strong cryptographic key for session signing and hashing. Enforced in production. |
| Domain | BASE_DOMAIN | short.example.com | Base host string used when formatting shortened URLs. |
| GeoIP | MAXMIND_LICENSE_KEY | - | Required to download the GeoIP dataset and update in background. |
| Phishing | ENABLE_PHISHING_CHECK | true | Enables domain protection against real-time blacklists. |
| Phishing | ENABLE_AUTO_REMOVE_PHISHING | false | Automatically removes links that redirect to verified phishing domains. |
| Database | DATABASE_URL | - | PostgreSQL URI (e.g. postgresql://user:pass@host:5432/db). Defaults to SQLite local file fallback. |
| Limits | RATELIMIT_STORAGE_URL | redis://redis:6379 | Rate limiting backend. Can fall back to local storage memory:// in dev. |
| Access | DISABLE_ANONYMOUS_CREATE | false | When true, only authenticated users can shorten links. |
| Access | DISABLE_REGISTRATION | false | When true, public registration routes are disabled. |
For the full detailed documentation including parameter tables and system metrics, visit the /api-docs page on your running Redrx instance.
Include your personal API key (available inside your user Profile menu) in request headers:
X-API-KEY: your_api_key_here
POST /api/v1/shorten
Payload:
{
"long_url": "https://example.com/my-long-link",
"custom_code": "my-code",
"code_length": 6,
"preview_mode": true,
"stats_enabled": true,
"rotate_targets": ["https://alt1.com", "https://alt2.com"],
"ios_target_url": "https://apps.apple.com/app/id123",
"android_target_url": "https://play.google.com/store/apps/details?id=com.example",
"password": "secret-password",
"expiry_hours": 24,
"start_at": "2026-06-05T22:00:00Z",
"end_at": "2026-06-30T23:59:59Z"
}
Response (201 Created):
{
"short_code": "my-code",
"short_url": "https://short.example.com/my-code",
"long_url": "https://example.com/my-long-link",
"rotate_targets": ["https://alt1.com", "https://alt2.com"],
"ios_target_url": "https://apps.apple.com/app/id123",
"android_target_url": "https://play.google.com/store/apps/details?id=com.example",
"expires_at": "2026-06-06T22:00:00+00:00",
"start_at": "2026-06-05T22:00:00+00:00",
"end_at": "2026-06-30T23:59:59+00:00",
"password_protected": true,
"preview_mode": true,
"stats_enabled": true
}
GET /api/v1/<short_code>
Response (200 OK):
{
"short_code": "my-code",
"short_url": "https://short.example.com/my-code",
"long_url": "https://example.com/my-long-link",
"rotate_targets": ["https://alt1.com", "https://alt2.com"],
"ios_target_url": "https://apps.apple.com/app/id123",
"android_target_url": "https://play.google.com/store/apps/details?id=com.example",
"preview_mode": true,
"stats_enabled": true,
"clicks_count": 42,
"clicks": 42,
"created_at": "2026-06-05T22:00:00+00:00",
"expires_at": "2026-06-06T22:00:00+00:00",
"start_at": "2026-06-05T22:00:00+00:00",
"end_at": "2026-06-30T23:59:59+00:00",
"active": true
}
This project is licensed under the MIT License. See LICENSE for details.