Spaces:
Sleeping
Sleeping
added changes to readme
Browse files
README.md
CHANGED
|
@@ -9,9 +9,250 @@ app_file: Dockerfile
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
-
# Dynamic QR
|
| 13 |
|
| 14 |
-
|
| 15 |
-
Users can scan a single QR code and be redirected to updated links without needing to reprint or regenerate the QR.
|
| 16 |
|
|
|
|
| 17 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
pinned: false
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Dynamic-QR: QR Code Management System
|
| 13 |
|
| 14 |
+
<div align="center">
|
|
|
|
| 15 |
|
| 16 |
+

|
| 17 |
|
| 18 |
+
[](https://python.org)
|
| 19 |
+
[](https://fastapi.tiangolo.com)
|
| 20 |
+
[](https://huggingface.co/spaces/parthmax/dynamic-qr)
|
| 21 |
+
[](LICENSE)
|
| 22 |
+
|
| 23 |
+
*A powerful, FastAPI-based system for generating, updating, and tracking **dynamic QR codes** with enterprise-ready APIs.*
|
| 24 |
+
|
| 25 |
+
[π Live Demo](https://huggingface.co/spaces/parthmax/dynamic-qr) β’ [π Documentation](#documentation) β’ [π οΈ Installation](#installation) β’ [π API Reference](#api-reference)
|
| 26 |
+
|
| 27 |
+
</div>
|
| 28 |
+
|
| 29 |
+
---
|
| 30 |
+
|
| 31 |
+
## π Overview
|
| 32 |
+
|
| 33 |
+
Dynamic-QR provides a **centralized system for creating and managing QR codes** that can be updated anytime without re-printing.
|
| 34 |
+
It includes scan tracking, redirection logic, and a simple **web dashboard + API interface** for enterprise use cases.
|
| 35 |
+
|
| 36 |
+
---
|
| 37 |
+
|
| 38 |
+
## β¨ Key Features
|
| 39 |
+
|
| 40 |
+
### π **Dynamic QR Management**
|
| 41 |
+
- Create unique QR codes with short IDs
|
| 42 |
+
- Update QR destination anytime without changing the QR image
|
| 43 |
+
- Delete or deactivate codes when needed
|
| 44 |
+
|
| 45 |
+
### π **Analytics & Tracking**
|
| 46 |
+
- Track scan counts in real time
|
| 47 |
+
- Log last scan timestamp
|
| 48 |
+
- Manage activity status (`active/inactive`)
|
| 49 |
+
|
| 50 |
+
### π₯οΈ **Dashboard & APIs**
|
| 51 |
+
- Jinja2-powered dashboard to view all QR codes
|
| 52 |
+
- REST APIs for integration with other systems
|
| 53 |
+
- QR image generation endpoint for direct embedding
|
| 54 |
+
|
| 55 |
+
### π‘οΈ **Enterprise Ready**
|
| 56 |
+
- CORS enabled
|
| 57 |
+
- Health check endpoint
|
| 58 |
+
- Extensible for database or authentication integration
|
| 59 |
+
|
| 60 |
+
---
|
| 61 |
+
|
| 62 |
+
## ποΈ System Architecture
|
| 63 |
+
|
| 64 |
+
```
|
| 65 |
+
|
| 66 |
+
βββββββββββββββββββββ ββββββββββββββββββββββ
|
| 67 |
+
β Web Dashboard ββββββΊβ FastAPI Backend β
|
| 68 |
+
β (Jinja2) β β (app.py) β
|
| 69 |
+
βββββββββββββββββββββ βββββββββββ¬βββββββββββ
|
| 70 |
+
β
|
| 71 |
+
βΌ
|
| 72 |
+
βββββββββββββββββββββ ββββββββββββββββββββββ
|
| 73 |
+
β QR Generator β β In-Memory Store β
|
| 74 |
+
β (qrcode lib) β β (Dict, can use DB)β
|
| 75 |
+
βββββββββββββββββββββ ββββββββββββββββββββββ
|
| 76 |
+
|
| 77 |
+
````
|
| 78 |
+
|
| 79 |
+
---
|
| 80 |
+
|
| 81 |
+
## π Quick Start
|
| 82 |
+
|
| 83 |
+
### Option 1: Try Online (Recommended)
|
| 84 |
+
Visit the live demo: [π€ HuggingFace Spaces](https://huggingface.co/spaces/parthmax/dynamic-qr)
|
| 85 |
+
|
| 86 |
+
### Option 2: Local Installation
|
| 87 |
+
|
| 88 |
+
#### 1. Clone the Repository
|
| 89 |
+
```bash
|
| 90 |
+
git clone https://github.com/parthmax2/dynamic-qr.git
|
| 91 |
+
cd dynamic-qr
|
| 92 |
+
````
|
| 93 |
+
|
| 94 |
+
#### 2. Setup Virtual Environment
|
| 95 |
+
|
| 96 |
+
```bash
|
| 97 |
+
python -m venv venv
|
| 98 |
+
source venv/bin/activate # Linux/Mac
|
| 99 |
+
# venv\Scripts\activate # Windows
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
#### 3. Install Dependencies
|
| 103 |
+
|
| 104 |
+
```bash
|
| 105 |
+
pip install -r requirements.txt
|
| 106 |
+
```
|
| 107 |
+
|
| 108 |
+
#### 4. Run the Server
|
| 109 |
+
|
| 110 |
+
```bash
|
| 111 |
+
uvicorn app:app --reload --host 0.0.0.0 --port 8000
|
| 112 |
+
```
|
| 113 |
+
|
| 114 |
+
π Visit [http://127.0.0.1:8000](http://127.0.0.1:8000)
|
| 115 |
+
|
| 116 |
+
---
|
| 117 |
+
|
| 118 |
+
## π― Usage
|
| 119 |
+
|
| 120 |
+
### Web Dashboard
|
| 121 |
+
|
| 122 |
+
1. Open `/` to view all QR codes
|
| 123 |
+
2. Create a new QR by entering **title + redirect URL**
|
| 124 |
+
3. Update existing QR code targets anytime
|
| 125 |
+
4. Download the QR image and share
|
| 126 |
+
|
| 127 |
+
### API Examples
|
| 128 |
+
|
| 129 |
+
#### Create QR
|
| 130 |
+
|
| 131 |
+
```bash
|
| 132 |
+
curl -X POST "http://localhost:8000/create" \
|
| 133 |
+
-F "title=My GitHub" \
|
| 134 |
+
-F "redirect_url=https://github.com/parthmax2"
|
| 135 |
+
```
|
| 136 |
+
|
| 137 |
+
#### Redirect Scan
|
| 138 |
+
|
| 139 |
+
```bash
|
| 140 |
+
curl -i "http://localhost:8000/r/{qr_id}"
|
| 141 |
+
```
|
| 142 |
+
|
| 143 |
+
#### Get QR Image
|
| 144 |
+
|
| 145 |
+
```bash
|
| 146 |
+
curl -o qr.png "http://localhost:8000/qr/{qr_id}"
|
| 147 |
+
```
|
| 148 |
+
|
| 149 |
+
#### Get QR Metadata
|
| 150 |
+
|
| 151 |
+
```bash
|
| 152 |
+
curl "http://localhost:8000/api/qr/{qr_id}"
|
| 153 |
+
```
|
| 154 |
+
|
| 155 |
+
---
|
| 156 |
+
|
| 157 |
+
## π API Reference
|
| 158 |
+
|
| 159 |
+
### Core Endpoints
|
| 160 |
+
|
| 161 |
+
| Method | Endpoint | Description |
|
| 162 |
+
| -------- | ----------------- | -------------------- |
|
| 163 |
+
| `GET` | `/` | Dashboard UI |
|
| 164 |
+
| `POST` | `/create` | Create new QR |
|
| 165 |
+
| `POST` | `/update/{qr_id}` | Update QR code |
|
| 166 |
+
| `GET` | `/r/{qr_id}` | Redirect endpoint |
|
| 167 |
+
| `GET` | `/qr/{qr_id}` | Get QR PNG image |
|
| 168 |
+
| `DELETE` | `/delete/{qr_id}` | Delete QR code |
|
| 169 |
+
| `GET` | `/api/qr/{qr_id}` | Get QR metadata JSON |
|
| 170 |
+
| `GET` | `/health` | Health check |
|
| 171 |
+
|
| 172 |
+
### Example QR Metadata Response
|
| 173 |
+
|
| 174 |
+
```json
|
| 175 |
+
{
|
| 176 |
+
"id": "abc12345",
|
| 177 |
+
"title": "My GitHub",
|
| 178 |
+
"redirect_url": "https://github.com/parthmax2",
|
| 179 |
+
"scan_count": 12,
|
| 180 |
+
"created_at": "2025-08-31T10:45:00",
|
| 181 |
+
"last_scanned": "2025-08-31T11:20:00",
|
| 182 |
+
"is_active": true
|
| 183 |
+
}
|
| 184 |
+
```
|
| 185 |
+
|
| 186 |
+
---
|
| 187 |
+
|
| 188 |
+
## βοΈ Configuration
|
| 189 |
+
|
| 190 |
+
### Environment Variables
|
| 191 |
+
|
| 192 |
+
| Variable | Description | Default |
|
| 193 |
+
| ---------- | -------------------------------- | --------------------------------------------------- |
|
| 194 |
+
| `BASE_URL` | Base URL used for QR redirection | `https://huggingface.co/spaces/parthmax/dynamic-qr` |
|
| 195 |
+
|
| 196 |
+
> β οΈ In production, configure `BASE_URL` to match your deployment domain.
|
| 197 |
+
|
| 198 |
+
---
|
| 199 |
+
|
| 200 |
+
## π οΈ Development
|
| 201 |
+
|
| 202 |
+
### Project Structure
|
| 203 |
+
|
| 204 |
+
```
|
| 205 |
+
dynamic-qr/
|
| 206 |
+
βββ app.py # Main FastAPI application
|
| 207 |
+
βββ templates/ # Jinja2 templates (UI)
|
| 208 |
+
β βββ index.html
|
| 209 |
+
βββ static/ # Static assets (CSS, JS)
|
| 210 |
+
βββ requirements.txt # Python dependencies
|
| 211 |
+
βββ README.md # Documentation
|
| 212 |
+
```
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
---
|
| 216 |
+
|
| 217 |
+
## π Roadmap
|
| 218 |
+
|
| 219 |
+
* β
Dynamic QR CRUD
|
| 220 |
+
* β
Scan tracking
|
| 221 |
+
* π Persistent DB integration (SQLite/Postgres)
|
| 222 |
+
* π User authentication
|
| 223 |
+
* π Analytics dashboard with charts
|
| 224 |
+
* π Bulk QR generation & export
|
| 225 |
+
|
| 226 |
+
---
|
| 227 |
+
|
| 228 |
+
## π Security
|
| 229 |
+
|
| 230 |
+
* Input validation for URLs
|
| 231 |
+
* Configurable active/inactive state
|
| 232 |
+
* Ready for JWT auth integration
|
| 233 |
+
* Safe QR redirection logic
|
| 234 |
+
|
| 235 |
+
---
|
| 236 |
+
|
| 237 |
+
## π License
|
| 238 |
+
|
| 239 |
+
This project is licensed under the **MIT License**.
|
| 240 |
+
See the [LICENSE](LICENSE) file for details.
|
| 241 |
+
|
| 242 |
+
---
|
| 243 |
+
|
| 244 |
+
## π€ Author
|
| 245 |
+
|
| 246 |
+
**Saksham Pathak** ([@parthmax2](https://github.com/parthmax2))
|
| 247 |
+
Generative AI Engineer | AI Apps & Developer Tools
|
| 248 |
+
|
| 249 |
+
---
|
| 250 |
+
|
| 251 |
+
<div align="center">
|
| 252 |
+
|
| 253 |
+
**[β Star this repo](https://github.com/parthmax2/dynamic-qr)** if you find it useful!
|
| 254 |
+
|
| 255 |
+
Made with β€οΈ by [parthmax](https://github.com/parthmax2)
|
| 256 |
+
|
| 257 |
+
</div>
|
| 258 |
+
```
|