A full-stack application for generating both static and dynamic QR codes. The project consists of a Next.js frontend and a FastAPI (Python) backend connected to a MongoDB database.
- Static & Dynamic Options: Generate classic static QR codes locally, or create dynamic QR codes for trackable links.
- Dynamic redirection: Update the underlying destination URL of the QR code without changing the QR image itself.
- Click Tracking: Tracks the number of total clicks/scans for each dynamic QR code.
- Modern UI: Responsive frontend built with Next.js and Tailwind CSS.
- Fast Backend: Python FastAPI backend for speedy short ID resolution and MongoDB connection.
- Frontend: Next.js, React, Tailwind CSS,
qrcode.react(located in thefrontend/directory) - Backend: Python, FastAPI, PyMongo (located in the
backend/directory) - Database: MongoDB
Make sure you have the following installed:
- Node.js &
pnpm(ornpm/yarn) - Python 3.8+
- MongoDB Database (Local or MongoDB Atlas)
- Navigate to the backend directory:
cd backend - Set up a virtual environment (recommended):
python -m venv .venv source .venv/bin/activate # On MacOS/Linux # or # .venv\Scripts\activate # On Windows
- Install dependencies:
pip install -r requirements.txt
- Set up environment variables:
- Create a
.envfile or export your connection string. - Example (you can copy from
.env.exampleat the root):export MONGO_URI="mongodb+srv://<username>:<password>@cluster0..."
- Create a
- Run the FastAPI development server:
The backend will be available at
uvicorn main:app --reload
http://127.0.0.1:8000
- Open a new terminal and navigate to the frontend directory:
cd frontend - Install dependencies using your preferred package manager (using pnpm as it is set as default in workspace):
pnpm install
- Start the Next.js development server:
The frontend will be available at
pnpm run dev
http://localhost:3000
Do not commit actual passwords, API keys, or database URIs to this repository!
A template for environment variables can be found in .env.example.
For Next.js frontend, place .env.local inside the frontend/ directory.
For FastAPI backend, place .env inside the backend/ directory or export MONGO_URI.
This project is open-source and available under the MIT License.