Welcome to the E-commerce Admin App Backend! This backend application provides the server-side functionality for an e-commerce admin panel. It is built using FastAPI and SQLAlchemy.
Before getting started, ensure that you have the following prerequisites installed on your machine:
- Python (3.7+ required)
-
Clone the Repository: You can download the code or clone this repository to your local machine using the following command:
gh repo clone Adan-Asim/E-commerce-Admin-App-Backend
-
Create a Virtual Environment: To isolate project dependencies, create a virtual environment. Use the appropriate command based on your operating system:
- Windows:
python -m venv venv
- macOS or Linux:
python3 -m venv venv
- Install Dependencies: Install the required dependencies for the project using pip. Run one of the following commands based on your system:
- Windows:
pip install fastapi uvicorn pydantic sqlalchemy
- macOS:
python3 -m pip install fastapi uvicorn pydantic sqlalchemy
-
Run the Server: Start the server using uvicorn with the following command:
uvicorn main:app --reload
-
Access the Application: Open your web browser and navigate to http://127.0.0.1:8000/ to access the application. Alternatively, you can use any API client to send requests to the API endpoints.
-
Explore the API Documentation: Visit the Swagger UI documentation by going to http://127.0.0.1:8000/docs. Here, you can explore and test the available API endpoints interactively.
-
Come back to the terminal, and type the following command:
python script
, this will run a script, and will populate the database with bulk of demo data
Here you will see the following six APIs:
Each of them has its own purpose as follows:
Description: This endpoint retrieves sales data within a specified date range for a given product or category. It allows you to filter and view sales data based on criteria such as start and end dates, product name, and category name.
Purpose: analyze revenue on a daily, weekly, monthly, and annual basis and also compare revenue across different periods and categories.
Description: This endpoint provides revenue analysis based on sales data. You can specify the date range (start and end dates) and the interval (e.g., daily, weekly, monthly, annual) for revenue calculation. Additionally, you can filter revenue data by category.
Description: This endpoint retrieves inventory status, including information about products with low stock levels. You can set a low stock threshold to filter products that are below a certain quantity.
Description: This endpoint allows you to update the inventory level of a specific product. You can provide the product name and the quantity to add to the inventory. If the product is not found, it returns a 404 error.
Description: This endpoint retrieves a log of inventory changes within a specified date and time range for a given product. It provides information about changes such as quantity additions or subtractions.
Description: This endpoint allows you to register a new product in the system. You need to provide product details such as name, description, price, category name, initial stock level, and low stock alert threshold. It returns the created product if successful.
These API endpoints provide essential functionality for managing sales data, revenue analysis, inventory status, inventory updates, inventory change logs, and product registration within your e-commerce admin application. You can use the provided APIs to interact with and manage your e-commerce backend efficiently.
This project is licensed under the MIT License. See the LICENSE file for details.