Skip to content

mudassir-dev713/Url_Shortner_Frontend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ”— LinkSnip - Modern URL Shortener

A powerful, modern URL shortening platform with advanced analytics, QR code generation, and PWA capabilities. Built with React, Vite, and Tailwind CSS.

Live Demo LinkSnip React Vite Tailwind PWA

✨ Features

πŸš€ Core Functionality

  • URL Shortening: Transform long URLs into short, shareable links
  • Custom URLs: Create branded short URLs (for logged-in users)
  • QR Code Generation: Generate QR codes for any URL
  • Click Tracking: Monitor link performance in real-time
  • Analytics Dashboard: Detailed insights into link performance

πŸ“Š Advanced Analytics

  • Total Clicks: Track overall link performance
  • Unique Visitors: Identify unique user interactions
  • Geographic Data: See where your traffic comes from
  • Device Breakdown: Understand user device preferences
  • Referrer Analysis: Track traffic sources
  • Bot Detection: Filter out suspicious traffic
  • Click Growth: Visualize trends over time

🎨 User Experience

  • Dark/Light Theme: Toggle between themes
  • Responsive Design: Works perfectly on all devices
  • PWA Support: Install as a native app
  • Offline Support: Works without internet connection
  • Fast Loading: Optimized for performance
  • Accessibility: WCAG compliant design

πŸ” Authentication & Security

  • User Registration/Login: Secure authentication system
  • Protected Routes: Secure dashboard access
  • Anonymous Usage: Use without signing up
  • Data Privacy: Secure data handling

πŸ› οΈ Tech Stack

Frontend

  • React 18 - Modern React with hooks and context
  • Vite 6.3 - Fast build tool and dev server
  • Tailwind CSS 4.1 - Utility-first CSS framework
  • React Router 6 - Client-side routing
  • React Helmet Async - SEO optimization

UI/UX Libraries

  • Lucide React - Beautiful icons
  • Framer Motion - Smooth animations
  • React Hot Toast - Toast notifications
  • Chart.js - Data visualization

PWA & Performance

  • Vite PWA Plugin - Progressive Web App support
  • Service Worker - Offline functionality
  • Code Splitting - Lazy loading for performance
  • Error Boundaries - Graceful error handling

πŸš€ Getting Started

Prerequisites

  • Node.js (v16 or higher)
  • npm or yarn

Installation

  1. Clone the repository

    git clone https://github.com/mudassir-dev713/Url_Shortner_Frontend.git
    cd linksnip
  2. Install dependencies

    npm install
  3. Set up environment variables Create a .env file in the root directory:

    VITE_BACKEND_URL=your_backend_api_url
  4. Start development server

    npm run dev
  5. Build for production

    npm run build

πŸ“± PWA Features

Installation

  • Automatic Prompt: Shows install prompt for eligible users
  • Smart Timing: Respects user preferences and shows at appropriate times
  • Offline Support: Works without internet connection
  • App-like Experience: Full-screen mode and native feel

Offline Functionality

  • Offline Detection: Real-time network status monitoring
  • Graceful Degradation: Shows appropriate messages when offline
  • Smart Redirects: Redirects to appropriate pages when back online
  • Cached Content: Service worker caches essential resources

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ api/                 # API integration
β”‚   β”œβ”€β”€ Auth.api.js     # Authentication endpoints
β”‚   β”œβ”€β”€ Url.api.js      # URL shortening endpoints
β”‚   └── Qr.api.js       # QR code endpoints
β”œβ”€β”€ components/         # Reusable components
β”‚   β”œβ”€β”€ Layout.jsx      # Main layout wrapper
β”‚   β”œβ”€β”€ Navbar.jsx      # Navigation component
β”‚   β”œβ”€β”€ Footer.jsx      # Footer component
β”‚   β”œβ”€β”€ UrlCard.jsx     # URL display card
β”‚   β”œβ”€β”€ QrCard.jsx      # QR code display card
β”‚   └── ...            # Other components
β”œβ”€β”€ context/           # React Context providers
β”‚   β”œβ”€β”€ AuthContext.jsx # Authentication state
β”‚   β”œβ”€β”€ ThemeContext.jsx # Theme management
β”‚   β”œβ”€β”€ UrlContext.jsx  # URL state management
β”‚   └── QrContext.jsx   # QR code state management
β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   └── useOffline.js  # Offline detection hook
β”œβ”€β”€ pages/             # Page components
β”‚   β”œβ”€β”€ HomePage.jsx   # Landing page
β”‚   β”œβ”€β”€ ShortenerPage.jsx # URL shortening page
β”‚   β”œβ”€β”€ DashboardPage.jsx # User dashboard
β”‚   β”œβ”€β”€ AnalyticsDashboard.jsx # Analytics page
β”‚   └── ...           # Other pages
β”œβ”€β”€ utils/             # Utility functions
β”‚   β”œβ”€β”€ Constant.js    # Constants and data
β”‚   └── ...           # Other utilities
└── main.jsx          # App entry point

🎯 Key Features Explained

URL Shortening

  • Instant Shortening: Create short URLs in seconds
  • Custom Codes: Personalized short codes for logged-in users
  • Validation: URL format validation and error handling
  • Copy to Clipboard: One-click copying of shortened URLs

Analytics Dashboard

  • Real-time Data: Live click tracking and analytics
  • Visual Charts: Interactive charts for data visualization
  • Geographic Insights: Country-wise click distribution
  • Device Analytics: Browser and device breakdown
  • Referrer Tracking: Traffic source analysis

QR Code Generation

  • Instant Generation: Create QR codes for any URL
  • Customizable: Different sizes and formats
  • Download Support: Save QR codes as images
  • Integration: Seamless integration with URL shortening

πŸ”§ Configuration

Environment Variables

# Backend API URL
VITE_BACKEND_URL=https://api.yourdomain.com

# Frontend domain for URL generation
VITE_BACKEND_URL_DNS=https://yourdomain.com

PWA Configuration

The PWA is configured in vite.config.js with:

  • Service Worker: Automatic registration and updates
  • Manifest: App metadata and icons
  • Caching Strategy: Smart caching for optimal performance
  • Offline Support: Fallback pages and offline detection

πŸ“Š Performance Optimizations

Code Splitting

  • Lazy Loading: Components loaded on demand
  • Route-based Splitting: Separate bundles for each route
  • Preloading: Critical components preloaded for better UX

Caching Strategy

  • Network First: HTML pages with network fallback
  • Cache First: Static assets for fast loading
  • Stale While Revalidate: Dynamic content with background updates

Bundle Optimization

  • Tree Shaking: Unused code elimination
  • Minification: Compressed production builds
  • Gzip Compression: Reduced file sizes

πŸš€ Deployment

Build Process

# Development
npm run dev

# Production build
npm run build

# Preview production build
npm run preview

Deployment Platforms

  • Netlify: Recommended for static hosting
  • Vercel: Great for React applications
  • GitHub Pages: Free hosting option
  • Any Static Host: Compatible with any static hosting service

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • React Team - For the amazing framework
  • Vite Team - For the fast build tool
  • Tailwind CSS - For the utility-first CSS framework
  • Lucide - For the beautiful icons
  • Chart.js - For the data visualization capabilities

πŸ“ž Support


Made with ❀️ by [Mudassir]

About

Modern URL shortener with analytics and PWA support

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published