FitTrack Backend is a Flask-based application designed to manage and display QR code data for product parts. It integrates with Supabase for data storage and retrieval, providing a seamless backend solution for QR code-based inventory management.
- Save QR Data: Accepts QR data via a REST API and stores it in a Supabase database.
- Display QR Data: Fetches and displays QR data in a user-friendly HTML template.
- Supabase Integration: Uses Supabase as the backend database for storing and retrieving data.
- Dynamic HTML Templates: Renders data dynamically using Flask's Jinja2 templating engine.
Before running the project, ensure you have the following installed:
- Python 3.8+
- pip (Python package manager)
- Supabase account and API credentials
-
Clone the repository:
git clone https://github.com/dakshtitarmare/FitTrack-Backend.git cd FitTrack-Backend -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install the required dependencies:
pip install -r requirements.txt
-
Set up the environment variables:
-
Create a
.envfile in the root directory (if not already present). -
Add your Supabase credentials:
SUPABASE_URL=<your_supabase_url> SUPABASE_API_KEY=<your_supabase_api_key> SUPABASE_TABLE=qr_data
-
-
Run the Flask application:
python app.py
-
API Endpoints:
-
Save QR Data:
POST /api/save_qr_data- Request Body (JSON):
{ "partType": "Part Type", "serialNo": "Serial Number", "vendorId": "Vendor ID", "mfgDate": "Manufacturing Date", "lotNo": "Lot Number", "warrantyPeriod": "Warranty Period" } - Response:
{ "uid": "Generated UID" }
- Request Body (JSON):
-
Show QR Data:
GET /showdata/<uid>- Displays the data for the given UID in an HTML template.
-
-
Access the Application:
- Open your browser and navigate to
http://127.0.0.1:5000.
- Open your browser and navigate to
.
├── app.py # Main Flask application
├── requirements.txt # Python dependencies
├── .env # Environment variables
├── .gitignore # Git ignore file
├── templates/ # HTML templates
│ ├── show_data.html # Template for displaying QR data
show_data.html: Displays QR data in a visually appealing format.
The .env file contains the following variables:
SUPABASE_URL: Your Supabase project URL.SUPABASE_API_KEY: Your Supabase API key.SUPABASE_TABLE: The name of the table where QR data is stored.
The project uses the following Python libraries:
- Flask
- python-dotenv
- requests
- qrcode
- matplotlib
- numpy
- scipy
This project is licensed under the MIT License. See the LICENSE file for details.
- Daksh Titarmare
GitHub: dakshtitarmare
Contributions are welcome! Feel free to fork the repository and submit a pull request.
- Supabase for providing an easy-to-use backend solution.
- Flask for its simplicity and flexibility.