Spaces:
Sleeping
Sleeping
| 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 | |
| <div align="center"> | |
|  | |
| [](https://python.org) | |
| [](https://fastapi.tiangolo.com) | |
| [](https://huggingface.co/spaces/parthmax/dynamic-qr) | |
| [](LICENSE) | |
| *A powerful, FastAPI-based system for generating, updating, and tracking **dynamic QR codes** with enterprise-ready APIs.* | |
| [π Live Demo](https://huggingface.co/spaces/parthmax/dynamic-qr) β’ [π Documentation](#documentation) β’ [π οΈ Installation](#installation) β’ [π API Reference](#api-reference) | |
| </div> | |
| --- | |
| ## π 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](https://huggingface.co/spaces/parthmax/dynamic-qr) | |
| ### Option 2: Local Installation | |
| #### 1. Clone the Repository | |
| ```bash | |
| git clone https://github.com/parthmax2/dynamic-qr.git | |
| cd dynamic-qr | |
| ```` | |
| #### 2. Setup Virtual Environment | |
| ```bash | |
| python -m venv venv | |
| source venv/bin/activate # Linux/Mac | |
| # venv\Scripts\activate # Windows | |
| ``` | |
| #### 3. Install Dependencies | |
| ```bash | |
| pip install -r requirements.txt | |
| ``` | |
| #### 4. Run the Server | |
| ```bash | |
| uvicorn app:app --reload --host 0.0.0.0 --port 8000 | |
| ``` | |
| π Visit [http://127.0.0.1:8000](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 | |
| ```bash | |
| curl -X POST "http://localhost:8000/create" \ | |
| -F "title=My GitHub" \ | |
| -F "redirect_url=https://github.com/parthmax2" | |
| ``` | |
| #### Redirect Scan | |
| ```bash | |
| curl -i "http://localhost:8000/r/{qr_id}" | |
| ``` | |
| #### Get QR Image | |
| ```bash | |
| curl -o qr.png "http://localhost:8000/qr/{qr_id}" | |
| ``` | |
| #### Get QR Metadata | |
| ```bash | |
| 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 | |
| ```json | |
| { | |
| "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](LICENSE) file for details. | |
| --- | |
| ## π€ Author | |
| **Saksham Pathak** ([@parthmax2](https://github.com/parthmax2)) | |
| Generative AI Engineer | AI Apps & Developer Tools | |
| --- | |
| <div align="center"> | |
| **[β Star this repo](https://github.com/parthmax2/dynamic-qr)** if you find it useful! | |
| Made with β€οΈ by [parthmax](https://github.com/parthmax2) | |
| </div> | |
| ``` | |