dynamic-qr / README.md
parthmax's picture
added changes to readme
872bfc6
metadata
title: Dynamic-QR
emoji: πŸ”—
colorFrom: blue
colorTo: green
sdk: docker
sdk_version: '1.0'
app_file: Dockerfile
pinned: false

Dynamic-QR: QR Code Management System

Dynamic QR Logo

Python FastAPI HuggingFace License

A powerful, FastAPI-based system for generating, updating, and tracking dynamic QR codes with enterprise-ready APIs.

πŸš€ Live Demo β€’ πŸ“– Documentation β€’ πŸ› οΈ Installation β€’ πŸ“Š API Reference


🌟 Overview

Dynamic-QR provides a centralized system for creating and managing QR codes that can be updated anytime without re-printing.
It includes scan tracking, redirection logic, and a simple web dashboard + API interface for enterprise use cases.


✨ Key Features

πŸ”— Dynamic QR Management

  • Create unique QR codes with short IDs
  • Update QR destination anytime without changing the QR image
  • Delete or deactivate codes when needed

πŸ“Š Analytics & Tracking

  • Track scan counts in real time
  • Log last scan timestamp
  • Manage activity status (active/inactive)

πŸ–₯️ Dashboard & APIs

  • Jinja2-powered dashboard to view all QR codes
  • REST APIs for integration with other systems
  • QR image generation endpoint for direct embedding

πŸ›‘οΈ Enterprise Ready

  • CORS enabled
  • Health check endpoint
  • Extensible for database or authentication integration

πŸ—οΈ System Architecture


β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Web Dashboard    │◄───►│   FastAPI Backend  β”‚
β”‚  (Jinja2)         β”‚     β”‚   (app.py)         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
β”‚
β–Ό
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  QR Generator     β”‚     β”‚   In-Memory Store  β”‚
β”‚  (qrcode lib)     β”‚     β”‚   (Dict, can use DB)β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

πŸš€ Quick Start

Option 1: Try Online (Recommended)

Visit the live demo: πŸ€— HuggingFace Spaces

Option 2: Local Installation

1. Clone the Repository

git clone https://github.com/parthmax2/dynamic-qr.git
cd dynamic-qr

2. Setup Virtual Environment

python -m venv venv
source venv/bin/activate  # Linux/Mac
# venv\Scripts\activate   # Windows

3. Install Dependencies

pip install -r requirements.txt

4. Run the Server

uvicorn app:app --reload --host 0.0.0.0 --port 8000

πŸ‘‰ Visit http://127.0.0.1:8000


🎯 Usage

Web Dashboard

  1. Open / to view all QR codes
  2. Create a new QR by entering title + redirect URL
  3. Update existing QR code targets anytime
  4. Download the QR image and share

API Examples

Create QR

curl -X POST "http://localhost:8000/create" \
  -F "title=My GitHub" \
  -F "redirect_url=https://github.com/parthmax2"

Redirect Scan

curl -i "http://localhost:8000/r/{qr_id}"

Get QR Image

curl -o qr.png "http://localhost:8000/qr/{qr_id}"

Get QR Metadata

curl "http://localhost:8000/api/qr/{qr_id}"

πŸ“š API Reference

Core Endpoints

Method Endpoint Description
GET / Dashboard UI
POST /create Create new QR
POST /update/{qr_id} Update QR code
GET /r/{qr_id} Redirect endpoint
GET /qr/{qr_id} Get QR PNG image
DELETE /delete/{qr_id} Delete QR code
GET /api/qr/{qr_id} Get QR metadata JSON
GET /health Health check

Example QR Metadata Response

{
  "id": "abc12345",
  "title": "My GitHub",
  "redirect_url": "https://github.com/parthmax2",
  "scan_count": 12,
  "created_at": "2025-08-31T10:45:00",
  "last_scanned": "2025-08-31T11:20:00",
  "is_active": true
}

βš™οΈ Configuration

Environment Variables

Variable Description Default
BASE_URL Base URL used for QR redirection https://huggingface.co/spaces/parthmax/dynamic-qr

⚠️ In production, configure BASE_URL to match your deployment domain.


πŸ› οΈ Development

Project Structure

dynamic-qr/
β”œβ”€β”€ app.py                # Main FastAPI application
β”œβ”€β”€ templates/            # Jinja2 templates (UI)
β”‚   └── index.html
β”œβ”€β”€ static/               # Static assets (CSS, JS)
β”œβ”€β”€ requirements.txt      # Python dependencies
└── README.md             # Documentation

πŸ“Š Roadmap

  • βœ… Dynamic QR CRUD
  • βœ… Scan tracking
  • πŸ”„ Persistent DB integration (SQLite/Postgres)
  • πŸ”„ User authentication
  • πŸ”„ Analytics dashboard with charts
  • πŸ”„ Bulk QR generation & export

πŸ”’ Security

  • Input validation for URLs
  • Configurable active/inactive state
  • Ready for JWT auth integration
  • Safe QR redirection logic

πŸ“„ License

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


πŸ‘€ Author

Saksham Pathak (@parthmax2) Generative AI Engineer | AI Apps & Developer Tools


⭐ Star this repo if you find it useful!

Made with ❀️ by parthmax

```