Spaces:
Sleeping
Sleeping
File size: 6,876 Bytes
f5af101 872bfc6 f5af101 872bfc6 f5af101 872bfc6 f5af101 872bfc6 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | ---
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>
```
|