This repository contains the backend and frontend applications of an educational online store project. It provides functionalities for managing products, users, cart, orders, authentication, and related operations.
The project uses the following technologies and tools:
- Programming Languages: Python, JS
- Backend frameworks/libs: Ariadne, Flask, SQLAlchemy, MinIO
- Frontend framework: React
- Database: PostgreSQL
- File Storage: MinIO
- API type: GraphQL API
- Containerization: Docker
To run this application, the following requirements must be met:
- Python 3.10 or higher
- Docker and Docker Compose (if running the application using Docker)
To install and run the application in development mode, follow these steps:
- Clone the repository:
git clone https://github.com/Desunovu/graphql-store-backend.git
. - Rename
./backend/.env.example
to./backend/.env
Now, run the application using one of the following methods:
- Edit the
./backend/.env
file, specifying the device connection address for theMINIO_ENDPOINT
(the address must be accessible to the frontend user) - Execute the command
docker-compose --profile full up --build
to deploy the entire application, including the required services.
-
- Option 1: Deploy the
postgres
andminio
services usingdocker-compose --profile dev up -d
. - Option 2: Deploy and configure
postgres
andminio
services independently.
- Option 1: Deploy the
- Edit the
./backend/.env
file, specifying the connection address for theMINIO_ENDPOINT
andPOSTGRES_HOST
variables. - Install the dependencies:
pip install -r requirements.txt
. - Set the
FLASK_APP
environment variable to the main package namestore_backend.py
. - Run the application:
flask run
.
The API provides the following mutations:
createUser
: Register a new user.updateUser
: Update user information.uploadAvatar
: Upload a user's avatardeleteUser
: Delete a user.assignAdmin
: Assign admin role to a user.addProduct
: Add a new product.updateProduct
: Update product information.deleteProduct
: Delete a product.addCategory
: Create a new category.removeCategory
: Remove a category.addReview
: Leave or update a review.removeReview
: Delete a review.createOrder
: Create a new order.updateOrderStatus
: Update the status of an order.addProductToFavorites
: Add a product to favorites.removeProductFromFavorites
: Remove a product from favorites.createCharacteristic
: Create a new characteristic.deleteCharacteristic
: Delete a characteristic.addProductToCart
: Add a product to the shopping cart.removeProductFromCart
: Remove a product from the shopping cart.setProductCharacteristicValue
: Set a value for a product characteristic.
And the following queries:
loginUser
: Obtain an authorization token.getUser
: Get user information.getUsers
: Get a list of users.getProduct
: Get product information.getProducts
: Get a list of products.getCart
: Get cart information.getCategories
: Get a list of categories.getOrders
: Get a list of orders.getFavoriteProducts
: Get a list of favorite products.getCharacteristics
: Get a list of available characteristics.