Skip to content

avispatech/flixbus-coupon-saver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Flixbus Coupon Saver 🎫

A mobile-first Progressive Web App to store, manage, and organize your coupon codes. Works offline and can be installed on your phone like a native app.

License

πŸš€ Quick Start

Use the App

Try it now: Live Demo (replace with your URL)

Install on Your Phone

  1. Open the app in your mobile browser
  2. Add to Home Screen:
    • iPhone: Tap Share button β†’ "Add to Home Screen"
    • Android: Tap menu (3 dots) β†’ "Add to Home screen" or look for install prompt
  3. Use offline - works without internet connection

πŸ“± How to Use

Adding Coupons

  • Tap the green + button in the bottom right
  • Enter codes one per line in the text area
  • Tap Save to add them to your current list

Managing Coupons

Current Tab

  • Tap any coupon β†’ copies to clipboard instantly
  • Swipe any coupon β†’ moves to archived

Archived Tab

  • Tap any coupon β†’ copies to clipboard
  • Swipe left β†’ moves back to current
  • Swipe right β†’ deletes permanently

Features

  • βœ… Works offline - no internet needed after first visit
  • βœ… Persistent storage - your coupons stay saved
  • βœ… One-tap copy - instant clipboard access
  • βœ… Touch-friendly - optimized for mobile use
  • βœ… Clean interface - easy to read monospace codes

πŸ› οΈ Technical Overview

Architecture

This PWA is built with vanilla JavaScript using a modular approach:

File Structure

coupon-manager/
β”œβ”€β”€ index.html      # Main HTML structure
β”œβ”€β”€ app.js          # All JavaScript modules
β”œβ”€β”€ styles.css      # Complete styling
β”œβ”€β”€ manifest.json   # PWA configuration
β”œβ”€β”€ sw.js           # Service worker
β”œβ”€β”€ README.md       # Documentation
└── LICENSE         # MIT license

Core Modules

StorageManager (app.js)

  • Handles localStorage operations
  • Provides get/set methods with error handling

CouponManager (app.js)

  • Manages coupon CRUD operations
  • Handles current/archived state transitions
  • Validates and processes bulk input

UIManager (app.js)

  • Controls tab switching and rendering
  • Updates DOM with coupon lists
  • Handles empty states

TouchHandler (app.js)

  • Detects tap vs swipe gestures
  • Differentiates swipe directions
  • Provides visual feedback during interactions

ClipboardManager (app.js)

  • Modern clipboard API with fallback
  • Shows success notifications

ModalManager (app.js)

  • Controls add coupon modal
  • Handles bulk text input processing

ToastManager (app.js)

  • Shows temporary notifications
  • Non-blocking user feedback

PWA Components

Service Worker (sw.js)

  • Caches app resources for offline use
  • Implements cache-first strategy
  • Handles cache updates

Web App Manifest (manifest.json)

  • Enables "Add to Home Screen"
  • Defines app metadata and icons
  • Sets standalone display mode

Data Storage

Uses localStorage with JSON serialization:

  • current-coupons: Array of current coupon objects
  • archived-coupons: Array of archived coupon objects

Each coupon object: { code: "COUPONCODE", id: timestamp }

Browser Support

  • βœ… Chrome/Chromium (Android, Desktop)
  • βœ… Safari (iOS, macOS)
  • βœ… Firefox
  • βœ… Edge
  • ⚠️ Touch gestures require modern browser

πŸ”§ Development

Local Setup

  1. Clone the repository

    git clone https://github.com/yourusername/coupon-manager.git
    cd coupon-manager
  2. Start local server

    # Using Python
    python -m http.server 8000
    
    # Using Node.js
    npx serve
    
    # Using PHP
    php -S localhost:8000
  3. Open browser: http://localhost:8000

Deployment to GitHub Pages

  1. Fork this repository
  2. Enable GitHub Pages:
    • Go to Settings β†’ Pages
    • Source: "Deploy from a branch"
    • Branch: main, folder: / (root)
  3. Access: https://yourusername.github.io/coupon-manager

Testing

Manual Testing Checklist:

  • Add coupons via bulk input
  • Copy coupon codes (check clipboard)
  • Swipe gestures on both tabs
  • Tab switching functionality
  • Offline functionality (disconnect network)
  • PWA installation on mobile device

🀝 Contributing

We welcome contributions! Here's how to help:

Ways to Contribute

πŸ› Bug Reports

  • Use GitHub Issues
  • Include browser/device info
  • Describe steps to reproduce
  • Add screenshots if helpful

πŸ’‘ Feature Requests

  • Open GitHub Issue with "enhancement" label
  • Describe the use case
  • Explain expected behavior

πŸ› οΈ Code Contributions

  1. Fork the repository

  2. Create feature branch

    git checkout -b feature/your-feature-name
  3. Make your changes

    • Follow existing code style
    • Keep modules separate and focused
    • Test on mobile devices
  4. Submit Pull Request

    • Clear description of changes
    • Reference any related issues
    • Include testing notes

Development Guidelines

Code Style:

  • Use ES6+ JavaScript features
  • Keep functions small and focused
  • Comment complex logic
  • Use meaningful variable names

Mobile-First:

  • Test on actual mobile devices
  • Ensure touch gestures work smoothly
  • Verify offline functionality
  • Check PWA installation flow

Performance:

  • Minimize DOM manipulations
  • Keep localStorage operations efficient
  • Test with large numbers of coupons

Roadmap Ideas

Potential future enhancements:

  • Coupon expiration dates
  • Categories/tags for organization
  • Search and filter functionality
  • Export/import features
  • Backup to cloud storage
  • Usage tracking/statistics

πŸ“„ License

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

πŸ™ Acknowledgments

  • Built with vanilla JavaScript for maximum compatibility
  • Inspired by mobile-first design principles
  • Uses Web APIs for native-like experience

Made with ❀️ for fellow bus travelers

Have questions? Open an issue or contribute to make this app even better!

About

Saves your flixbus coupon on your devise's storage

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors