Skip to content

Latest commit

Β 

History

History
122 lines (89 loc) Β· 3.39 KB

File metadata and controls

122 lines (89 loc) Β· 3.39 KB

🌐 URL Shortener β€” Frontend

A modern, responsive frontend for the Advanced URL Shortener, built in 4 progressive phases using HTML, CSS, and JavaScript.


πŸ“‹ Phase Overview

Phase Feature Status
Phase 1 Landing Page (Hero + Features) βœ… Complete
Phase 2 Shorten URL Form + Result Display βœ… Complete
Phase 3 Analytics Dashboard UI βœ… Complete
Phase 4 URL History + QR Code Display βœ… Complete

Phase 1 β€” Landing Page

File: frontend/index.html + frontend/css/style.css

What's included:

  • Hero section β€” headline, subheadline, CTA button ("Shorten a URL")
  • Features section β€” 6 feature cards (Fast, Secure, Analytics, Custom Alias, QR Code, Expiry)
  • How It Works β€” 3-step visual flow
  • Footer β€” links and branding

Design:

  • Dark glassmorphism theme
  • Gradient purple/blue palette
  • Smooth scroll animations
  • Fully responsive (mobile + desktop)

Phase 2 β€” URL Shortener Form

File: frontend/shorten.html + frontend/js/shorten.js

What's included:

  • Input form β€” long URL field + optional custom alias + TTL selector
  • Shorten button β€” with loading spinner
  • Result card β€” shows generated short URL with:
    • One-click copy button
    • Share button
    • Link to QR code
  • Validation β€” URL format check before submit
  • Error handling β€” rate limit / alias taken messages

Simulated API:

Uses localStorage to simulate the C++ backend (Base62 encoding in JS).


Phase 3 β€” Analytics Dashboard

File: frontend/analytics.html + frontend/js/analytics.js

What's included:

  • Stats cards β€” Total URLs, Total Clicks, Top URL, Cache Hit Rate
  • Top URLs table β€” sortable by clicks, with short code + destination
  • Click trend chart β€” bar chart using Canvas API (no external libs)
  • Live refresh β€” auto-updates every 5 seconds

Phase 4 β€” URL History + QR Code

File: frontend/history.html + frontend/js/history.js

What's included:

  • History table β€” all shortened URLs with creation time, TTL, click count
  • Expiry indicator β€” green (active) / red (expired) badge
  • QR Code modal β€” click any URL to see its QR code (generated via Canvas)
  • Delete button β€” remove URLs from history
  • Search/filter β€” filter history by short code or destination

Project Structure

frontend/
β”œβ”€β”€ index.html          # Phase 1 β€” Landing page
β”œβ”€β”€ shorten.html        # Phase 2 β€” URL shortener form
β”œβ”€β”€ analytics.html      # Phase 3 β€” Analytics dashboard
β”œβ”€β”€ history.html        # Phase 4 β€” URL history + QR
β”œβ”€β”€ css/
β”‚   └── style.css       # Shared design system
└── js/
    β”œβ”€β”€ shorten.js      # Phase 2 logic
    β”œβ”€β”€ analytics.js    # Phase 3 logic
    └── history.js      # Phase 4 logic

Running the Frontend

Simply open any HTML file in a browser β€” no build step required:

# Open landing page
start frontend/index.html

# Or use a local server for best experience
npx serve frontend/

Design System

Token Value
Primary #7c3aed (purple)
Accent #06b6d4 (cyan)
Background #0f0f1a (dark navy)
Surface rgba(255,255,255,0.05) (glass)
Font Inter (Google Fonts)
Border radius 12px
Animation 0.3s ease transitions