Qrcode Generator

A powerful, cross-platform tool for generating QR codes from URLs, text, and UPI payments. Features GUI, CLI, and PWA interfaces with offline support, smart caching, and easy installation.

0 0

QR Forge (QR Code Generator)#

Generate QR codes, UPI payment codes, and transfer files optically via an animated QR stream — desktop app, CLI, and offline-first installable PWA.

Live PWA: qr.tashif.codes

Features#

Modes#

Mode What it does
Text / URL Encode any link or plaintext as a QR PNG
UPI Pay Build a UPI payment QR with optional fixed amount + local history
Send File Stream a file as a looping animated QR (no network upload)
Receive Scan the stream with the camera and reassemble the file on-device

Offline-first optical file transfer#

Transfer a file between devices with no file upload — payload bytes travel only as light through an animated QR stream. When online, an optional peer-to-peer WebRTC control channel acknowledges readiness and completion; offline, the same transfer uses a manual handshake.

  1. On the sending screen open Send File, pick a file, choose speed, and show the handshake QR.
  2. On the receiving phone open Receive (or ?mode=receive), allow the camera, and scan that static QR.
  3. If peer control connects, the receiver sends READY and the stream starts automatically. Offline, tell the sender to tap Begin manually after the receiver confirms the handshake.
  4. Keep the full QR inside the guide until recovery reaches 100%, then tap Save file.

Protocol (QF1)

  • Optional gzip when it shrinks the optical payload
  • File split into ordered data chunks with compact headers
  • Metadata headers recur through the stream so receivers can join mid-loop
  • First frame remains static until WebRTC READY or manual offline confirmation
  • Optional WebRTC control carries READY, recovery progress, and COMPLETE only
  • Sender stops automatically after the receiver reports the matching full checksum
  • SHA-256 prefix verified before save
  • Speed profiles: Careful / Normal / Turbo
  • Fullscreen sender mode for easier scanning

Warning: practical throughput is optical (camera + screen), not network. Larger files need more frames and more loops; compress first when possible. Small files (hundreds of KB) transfer more reliably.

Privacy and offline behavior

  • File names and payload bytes are never sent through signaling or WebRTC.
  • The signaling Worker relays only temporary SDP/ICE negotiation messages and expires sessions after ten minutes.
  • The WebRTC data channel is encrypted and carries control messages only.
  • With no internet connection, peer setup fails softly and Begin manually remains fully functional.

Progressive Web App (PWA)#

  • Installable on mobile and desktop
  • Offline after first visit (service worker + cached assets)
  • UPI ID memory (local only, up to 10 recent entries)
  • Background updates with a soft prompt
  • Runtime badge: Desktop (Eel) / Web / Offline

Desktop GUI (Eel)#

  • Same web UI hosted locally via Eel (python app.py)
  • Python QR backend when Eel is available; JS / Pyodide fallback on the web
  • Cross-platform: Windows, macOS, Linux

CLI#

  • Quick QR generation from the command line
  • Display / save options
  • Interactive UPI QR prompts

Progressive Web App Installation#

Installing the PWA#

The web version at qr.tashif.codes can be installed as a native app on any device:

On Mobile Devices (iOS/Android):#

  1. Open qr.tashif.codes in your mobile browser
  2. Look for the “📱 Install App” button (usually bottom-left corner)
  3. Tap it and follow the installation prompts
  4. The app will be added to your home screen with a native icon
  5. Launch from home screen for full-screen, app-like experience

On Desktop (Windows/macOS/Linux):#

  1. Open qr.tashif.codes in Chrome, Edge, or other PWA-supported browser
  2. Look for the install icon in the address bar or the “📱 Install App” button
  3. Click “Install” to add it to your desktop/applications folder
  4. Launch like any native desktop application

Offline Functionality#

Once installed or after the first visit, the PWA works completely offline:

  • Complete Offline Operation: Generate QR codes without any internet connection
  • Cached Python Runtime: Uses Pyodide WebAssembly runtime cached locally
  • Persistent Storage: Your UPI history and preferences are saved locally
  • Background Updates: When online, automatically downloads updates
  • Smart Caching Strategy: Intelligently caches resources for optimal performance

What Works Offline:#

  • URL/Text QR code generation
  • UPI payment QR code generation
  • Access to saved UPI ID’s / adresses (up to 10 recent entries)
  • Download generated QR codes
  • Optical file transfer with manual handshake and checksum verification
  • Full app functionality and interface
  • Automatic data persistence

Installation#

Optional WebRTC signaling service#

Automatic optical-transfer acknowledgement uses the small Cloudflare Worker in signaling/. It is optional; the PWA falls back to its manual handshake whenever signaling is unreachable.

bash
cd signaling
npm install
npm test
npm run check
npm run deploy

The checked-in PWA points at the deployed qr-forge-signal Worker. If you deploy your own copy, replace the qr-forge-signal-url meta value in web/index.html. Allowed browser origins are configured in signaling/wrangler.jsonc.

Pre-packaged Applications#

For convenience, pre-built executable files are available in the tashifkhan/QRCode-Generator section of the GitHub repository. These executables require no installation or dependencies:

  1. Go to the tashifkhan/QRCode-Generator page
  2. Download the appropriate version for your operating system:
    • Windows: Download QRCode-Generator-Windows.zip
    • macOS: Download QRCode-Generator-macOS.zip
    • Linux: Download QRCode-Generator-Linux.zip
  3. Extract the downloaded archive
  4. Run the application:
    • GUI: Run qrcode-generator-gui (or qrcode-generator-gui.exe on Windows)
    • CLI: Run qrcode-generator-cli (or qrcode-generator-cli.exe on Windows) from the terminal

Note for macOS Users#

macOS may apply quarantine attributes to downloaded applications. If you encounter security warnings when trying to run the application, you have two options:

  1. Remove quarantine attribute using Terminal:

    bash
    xattr -d com.apple.quarantine /path/to/qrcode-generator-gui
    xattr -d com.apple.quarantine /path/to/qrcode-generator-cli
    

    Replace /path/to/ with the actual path to the extracted executables.

  2. Using GUI:

    • Right-click (or Control+click) on the application
    • Select “Open” from the context menu
    • When the security warning appears, click “Open”
    • The application will be saved as an exception to your security settings

From Source#

  1. Clone the repository:
bash
git clone https://github.com/tashifkhan/QRCode-Generator.git
cd QRCode-Generator
  1. Install dependencies:
bash
pip install -r requirements.txt

Using PyInstaller (Packaged Executables)#

Build Executables#

  1. Install PyInstaller:
bash
pip install pyinstaller
  1. Build GUI Application:
bash
pyinstaller --onefile --windowed --add-data "web:web" app.py
  1. Build CLI Application:
bash
pyinstaller --onefile main.py

The executables will be available in the dist directory.

Usage#

GUI Application#

  1. Run from source:
bash
python app.py
  1. Or use the packaged executable:
    • Windows: Run app.exe
    • macOS/Linux: Run ./app

Upon launching you’ll see four modes in the top nav:

  • Text / URL — generate a standard QR and download PNG
  • UPI Pay — UPI ID + name + optional amount; recent IDs stored locally
  • Send File — drop a file and stream it as animated QR codes
  • Receive — camera scan to rebuild and save the file

Deep links: ?mode=send · ?mode=receive · ?mode=upi · ?mode=generate

CLI Application#

  1. Run from source:
bash
python main.py [URL] [-s SAVE_PATH] [-d]

For UPI QR code generation, run:

bash
python main.py -upi
  1. Or use the packaged executable:
bash
./main [URL] [-s SAVE_PATH] [-d]

Options:

  • URL: The URL or text to encode (required for URL/Text QR).
  • -upi, --upi: Generate a UPI QR code (or use interactive prompts if no value is provided).
  • -s, --save: Save the QR code to a file (optional, defaults to qr_code.png).
  • -d, --display: Display the QR code.

Examples:

bash
# Generate and display a URL QR code
python main.py https://tashif.codes -d

# Generate and save a URL QR code
python main.py https://tashif.codes -s "/Users/taf/Desktop/My Website QR Code.png"

# Generate a UPI QR code interactively
python main.py -upi

Dependencies#

  • Python 3.13 or higher
  • Eel: Web GUI framework
  • PyQRCode and pypng: QR code generation
  • Pillow: Image processing
  • Rich, Colorama: CLI enhancements
  • Additional dependencies are listed in requirements.txt

Web/PWA Dependencies (Auto-loaded):#

  • soldair/node-qrcode (JS): fast QR rendering for generate + file stream
  • cozmo/jsQR: camera decoding for receive mode
  • Pyodide (+ qrcode/pillow): optional offline fallback for generation
  • Service Worker API: offline caching
  • Web Storage API: UPI history
  • CompressionStream / DecompressionStream: optional gzip for transfers
  • WebRTC DataChannel: encrypted peer readiness, progress, and completion control
  • Cloudflare Worker + Durable Objects: ephemeral WebSocket signaling (optional)

Technologies#

Progressive Web App (PWA)#

The web version implements modern PWA standards for native app-like experience:

  • Service Worker: Advanced caching strategy with cache-first for static assets and network-first for dynamic content
  • Web App Manifest: Proper PWA metadata for installation and theming
  • Offline-First Architecture: Complete functionality without internet after initial load
  • Background Sync: Automatic updates with user notification system
  • Local Storage: Persistent UPI history and user preferences using browser storage
  • Responsive Design: Adaptive interface for all screen sizes and orientations

Eel#

This project uses ChrisKnott/Eel, a Python library for creating simple Electron-like offline HTML/JS GUI applications. Eel hosts a local web server and allows for:

  • Bidirectional communication between Python backend and JavaScript frontend
  • Native GUI capabilities using web technologies
  • Easy deployment as a standalone desktop application

Pyodide#

Pyodide is used as a fallback mechanism when the Eel backend is not available (such as when running in browsers without the Python backend). It:

  • Brings the Python runtime to the browser via WebAssembly
  • Allows Python code execution directly in the browser
  • Enables generation of QR codes on the client side when accessing the web version
  • Provides seamless functionality between desktop application and web version
  • Cached Offline: Complete Pyodide runtime and required packages cached for offline use

UPI History & Caching#

The application implements intelligent caching for user convenience:

  • Local Storage: UPI payment details stored securely in browser’s local storage
  • History Management: Automatically saves up to 10 most recent UPI configurations
  • Quick Access: Dropdown history for instant reuse of previous UPI details
  • Privacy First: All data stored locally on device, never transmitted to servers
  • Cross-Session: History persists across browser sessions and app restarts

This dual approach (Eel + Pyodide fallback) with PWA capabilities ensures that the QR code generator works as a desktop application, web application, and installable PWA with full offline functionality.

Contributing#

  1. Fork the repository.
  2. Create your feature branch.
  3. Commit your changes.
  4. Push to the branch.
  5. Create a new Pull Request.

License#

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