Cover image for project: NEXUS Affiliates IN PROGRESS

Technical summary

NEXUS plugin for centralized affiliate link and promo code management: full CRUD organized by project and category, click tracking (302 redirect + counter + detailed log), Dead Link Detector with periodic HTTP health checks via cron every 12 hours, coupon suggestions in the Intelligence Hub, QR Code generation and share snippets — 100% internal, no external API (first in the series).

Executed scope

  • backend.php backend (519 lines): internal MySQL CRUD — no external API dependency (only one in the series so far).
  • Tables (created by affiliates_install()): nexus_affiliates (project, name, url, promo_code, status, category, commission_rate, clicks_count, notes, expires_at, http_code, last_checked_at; indexes idx_project, idx_status, idx_category, idx_expires_at) with silent migrations (ADD COLUMN for expires_at/http_code/last_checked_at) and nexus_affiliate_clicks (affiliate_id, ip, user_agent, referer, clicked_at; idx_affiliate_id, idx_clicked_at).
  • Initial seeds: 3 sample records (Cloudflare Enterprise 15%, Hetzner Cloud VPS €10 credit, Shodan Pro Engine 20%) created when the table is empty.
  • affiliates_list — filters by project/status/category/search (LIKE on name/promo_code/url/notes), limit ≤ 100; auto expired marking when expires_at passes; short_url built from site_url (/api.php?action=affiliate_redirect&id=X); is_expiring_soon flag (< 3 days); distinct categories and embedded stats.
  • affiliates_save — validates required name, URL via FILTER_VALIDATE_URL, status whitelist (active/pending/cancelled/expired) and auto-expires when the date is in the past; insert or update.
  • affiliates_delete — removes the record and linked clicks (manual cascade).
  • affiliates_check_health (Dead Link Detector) — HEAD request (CURLOPT_NOBODY), follows up to 5 redirects, 8s timeout / 4s connect, NEXUS-Affiliate-HealthCheck/1.0 UA; with ID checks 1 link; without ID checks up to 10 oldest active links (last_checked_at ASC); stores http_code + last_checked_at.
  • affiliate_redirect — increments clicks_count, logs detailed click (IP, User-Agent, Referer) in nexus_affiliate_clicks and redirects with HTTP 302 (or returns JSON on AJAX calls).
  • affiliates_stats — total, active, pending, cancelled, expired, total clicks, with coupon and dead_links (http_code ≥ 400 or 0).
  • Settings (affiliates_settings / affiliates_settings_save) — base_url (validated), enable_tracking, default_category, auto_shorten via DB::setConfig('plugin.affiliates.*').
  • Intelligence Hub: nexus-affiliates enricher (priority 20, types affiliate, promo, cupom, cloud, hosting, vpn, vps) — suggestion format (not a severity signal): when the user mentions services (Hetzner, Cloudflare, Shodan...), it suggests up to 3 active coupons with shortened link, promo code and commission.
  • Cron (cronjob.json): Affiliate Link Health Check job with a **real cron schedule 0 */12 * * *** (every 12 hours) → affiliates_check_health — first in the series with a cron expression (previous ones used soft-cron ticks).
  • API: 9 actions via PluginManager::registerApiAction (affiliates_list, affiliates_get, affiliates_save, affiliates_delete, affiliates_check_health, affiliate_redirect, affiliates_stats, affiliates_settings, affiliates_settings_save).
  • Alpine.js UI (tab.php, 712 lines — largest in the series): indigo theme; 2 sub-tabs (Dashboard / Settings); 5 KPI cards (Total Links, Active, Accumulated Clicks, Coupons, Unreachable Links); toolbar with search (300ms debounce) and project/status/category filters; Test Link Health button; cards with status badge (Active/Pending/Cancelled/Expired), HTTP badge (green 2xx / blue 3xx / red 4xx or 0) and "⏰ Expires soon" alert (< 3 days); QR Code actions (api.qrserver.com), copy shortened link, test redirect, generate Markdown snippet and edit/delete; create/edit modal; settings with usage guide.
  • Fastr: 2 commands — /afiliados (PT) and /affiliates (EN) → affiliates_list.
  • No external API — 100% internal: MySQL + cURL (only for health check and redirect).

Stack and tools

  • PHP 8 (no framework)
  • MySQL 8 (nexus_affiliates + nexus_affiliate_clicks)
  • Alpine.js + Tailwind CSS (premium light, indigo ring)
  • NEXUS plugin system (PluginManager + cronjob.json)
  • cURL (HEAD health check + 302 redirect)

Operational tags

  • Affiliates
  • Coupons
  • Marketing
  • Link Building
  • Click Tracking
  • QR Code
  • Plugin NEXUS

Operational outcome

  • Centralized affiliate link and coupon registry organized by project and category (Geral, NEXUS, Security, etc.).
  • Conversion tracking: NEXUS shortened link with click counter and detailed log (IP, User-Agent, Referer).
  • Dead Link Detector: automatic check every 12 hours plus manual, flagging broken links with an HTTP badge.
  • Coupon suggestions in chat/tasks via Intel Hub (service mentions → coupon with link and commission).
  • QR Codes and Markdown snippets ready for sharing in one click.
  • 100% internal: no external API cost, own data in MySQL.

GitHub progress (issues)

Real-time panel with latest repository issues.

abertas (amostra): -- fechadas (amostra): -- base: -- ultimas issues

carregando andamento...

Real results

NEXUS plugin for centralized affiliate link and promo code management: full CRUD organized by project and category, click tracking with 302 redirect and counter, Dead Link Detector with periodic HTTP health checks via cron every 12 hours, coupon suggestions in the Intelligence Hub, QR Code generation and share snippets — 100% internal, no external API.

Architecture and organization

Execution and operations

The project follows reproducible execution flow with technical validation in production-like environments.

Screenshots

Talk about this project

Apply this implementation pattern in your environment and accelerate delivery with technical consistency.