A production-grade, full-stack QR code analytics and redirection engine built with Node.js, Express, and PostgreSQL. It features high-performance background analytics, anti-race-condition request debouncing, and a vibrant, multi-API-powered joyful web interface.
- Key Features
- Tech Stack
- Project Structure
- Prerequisites
- Setup & Installation
- Testing via Mobile QR
- Database Cheat Sheet
- Contributing
- License
- ⚡ Smart QR Redirection & Debouncing: Prevents duplicate scan inflation caused by mobile camera pre-fetching and rapid-fire background pings using an in-memory TTL cache lock.
- 🌍 Real-Time Telemetry: Tracks incoming IP addresses, ISP networks, user agents, and geolocation metadata.
- 🎨 Dynamic Multi-API Frontend: Serves an animated, high-energy glassmorphism UI on every scan by pulling live random quotes and GIFs from external APIs, paired with floating CSS-animated emojis.
- 🛡️ Fault-Tolerant Architecture: Independent try/catch blocks ensure that if external APIs or non-critical systems fail, safe fallback content keeps the application running smoothly without crashing.
- Backend: Node.js, Express.js
- Database: PostgreSQL (
pgdriver) - APIs: DummyJSON Quotes API, The Cat API (for dynamic GIFs)
- Tunneling: LocalTunnel / Pinggy / Ngrok (for local device testing via public QR codes)
AURASCAN/
├── .env # Environment variables (database URL, port, etc.)
├── .gitignore # Git exclusion rules (node_modules, .env)
├── package.json # Project metadata and dependency manifest
├── README.md # Project documentation
├── database/ # SQL schema (source of truth) and seed data
└── src/ # Source code root
├── config/ # Configuration files (database connection pools)
├── controllers/ # Request handlers (redirect, inspire)
├── middleware/ # Custom request processors
├── repositories/ # Database queries
├── routes/ # Express router endpoints
├── services/ # External API handlers
├── utils/ # Helper scripts
├── workers/ # Asynchronous telemetry enqueuers
└── server.js # Main application entry point
Before you begin, ensure you have the following installed on your local machine:
- Node.js (v16.0 or higher recommended)
- npm (comes installed with Node.js)
- PostgreSQL (v14.0 or higher)
- Git (for cloning the repository)
Open your terminal and install the required Node modules:
git clone https://github.com/yourusername/AURASCAN.git
cd AURASCAN
npm installCopy .env.example to .env and fill in your values (do not commit .env):
PORT=3000
DATABASE_URL=postgres://postgres:your_password@localhost:5432/inspiro_db
ALLOWED_HOSTS=localhost,your-tunnel-url.loca.lt
# Required by GET /api/export/logs. Generate with: openssl rand -hex 32
ADMIN_API_KEY=your_long_random_admin_keyCreate the database, then apply the schema and seed data. database/schema.sql is the
single source of truth for the table definitions — do not hand-write them:
createdb inspiro_db
psql -d inspiro_db -f database/schema.sql
psql -d inspiro_db -f database/seeds/quotes.sqlStart your backend server locally:
node src/server.jsThe server is now running on http://localhost:3000.
To test scanning the QR code with a mobile device, expose your local server to the public internet using a separate terminal tab:
LocalTunnel (No installation required):
npx localtunnel --port 3000Pinggy (SSH-based):
ssh -p 443 -R0:localhost:3000 a.pinggy.io(Remember to update the ALLOWED_HOSTS array in your .env file with the generated URL and restart the server!)
View your most recent telemetry logs directly in PostgreSQL:
SELECT ip_address, city, os, browser, isp, scanned_at
FROM scan_logs
ORDER BY scanned_at DESC
LIMIT 5;GET /api/export/logs streams the contents of scan_logs back as a downloadable
.csv, newest first, for analysis in Excel, Google Sheets, or pandas.
Authentication — required. Send the value of ADMIN_API_KEY (from your .env)
in an x-api-key header. Requests without a valid key get 401; if ADMIN_API_KEY
is not configured at all the endpoint fails closed with 503 rather than serving
data. The route also sits behind the shared rate limiter (100 requests / 15 min per IP).
Query parameters
| Param | Default | Range | Description |
|---|---|---|---|
limit |
1000 |
1–EXPORT_MAX_LIMIT (default 50000) |
Maximum rows to export. |
days |
(none) | 1–3650 |
Only include scans from the last N days. |
Both must be plain integers; anything else returns 400.
# All defaults (most recent 1000 rows)
curl -H "x-api-key: $ADMIN_API_KEY" \
-OJ http://localhost:3000/api/export/logs
# Last 7 days, up to 500 rows
curl -H "x-api-key: $ADMIN_API_KEY" \
"http://localhost:3000/api/export/logs?days=7&limit=500" -o recent.csvColumns are read from the live scan_logs table at request time, so the export
tracks the schema automatically rather than relying on a hardcoded list.
Note on leading apostrophes: fields whose value begins with
=,+,-, or@are prefixed with a single quote (').user_agent,referer, andispare attacker-controlled, and spreadsheet software executes cells starting with those characters. This is a deliberate safety measure, not corrupted data.
Contributions, issues, and feature requests are welcome! Feel free to check out the issues page if you want to contribute.
This project is licensed under the MIT License - see the LICENSE file for details.


