Frontend

This directory contains the frontend files for the URL Shortener application.

Files

  • index.html - Main HTML template with TailwindCSS styling
  • index.js - JavaScript for form handling, API calls, and user interactions

Features

  • Responsive Design: Works on desktop and mobile devices
  • Real-time Validation: URL input validation and error handling
  • Copy to Clipboard: One-click copying of generated short links
  • Loading States: Visual feedback during API calls
  • Error Handling: User-friendly error messages
  • Accessibility: Proper labels, focus management, and keyboard navigation

Styling

The frontend uses TailwindCSS via CDN for styling, providing:

  • Modern, clean design
  • Responsive grid layouts
  • Hover and focus states
  • Loading animations
  • Color-coded action buttons

JavaScript Features

  • Form submission handling
  • Fetch API for backend communication
  • Clipboard API integration
  • DOM manipulation for dynamic content
  • Error state management
  • Auto-focus and keyboard shortcuts

API Integration

The frontend communicates with the backend API endpoints:

  • POST /shorten - Create new short links
  • Displays generated short URLs, status links, and calendar download links
  • Handles API errors gracefully with user feedback