This project is a FastAPI application that implements a package management system and location history. In this version, we integrate the application with a MySQL database using SQLAlchemy ORM.
- Package management (CRUD operations)
- Location tracking for packages
- Location history
- MySQL database integration
- RESTful API
To configure and run the application, follow the steps below:
- Python 3.8+
- MySQL Workbench
- Python libraries listed in
requirements.txt
-
Clone the Repository:
git clone https://github.com/cribeirop/Package_Tracking.git
-
Create Virtual Environment:
python -m venv venv
-
Activate Virtual Environment:
- Windows:
.\venv\Scripts\activate
- macOS/Linux:
source venv/bin/activate
- Windows:
-
Install Dependencies:
pip install -r requirements.txt
-
Environment Variables Configuration:
- Create a
.envfile in the project root. - The
.envfile should include the following environment variable to define the MySQL database connection:
DATABASE_URL=mysql://username:password@localhost/dbnameNotes:
- Replace
usernamewith your database username. - Replace
passwordwith your database password. - Replace
dbnamewith the database name you created.
- Create a
-
Create Database:
- Create a database in MySQL.
- Tables will be generated automatically when starting the application.
-
Start the Server:
uvicorn app.main:app --reload
-
Access Documentation:
- Access http://127.0.0.1:8000/docs to view and test available endpoints through the interactive Swagger interface.
Check out the demo video of the API functionality by clicking this link https://youtu.be/zYnqHrrbyAM.
-
Navigate to frontend directory:
cd frontend -
Install Node.js dependencies:
npm install
-
Start the React development server:
npm start
-
Access the frontend:
- Frontend will be available at: http://localhost:3000
- API calls are proxied to: http://localhost:8000
Access the interactive API documentation at: http://localhost:8000/docs
The application uses two main tables:
packages: Stores package informationpackage_locations: Stores location history for each package
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Create a Pull Request