Blank for now...
- Docker ( >=23.0.4 ) and docker compose plugin ( >=2.18.1 )
- 2GB RAM
- 5GB+ ROM
- Clone the repository:
git clone https://github.com/kieled/ecommerce-backend.git
- Rename
.env.example
to.env
and change variables like you want - Run command to start project
docker compose up -d --build
- To check logs use this command [ Optional ]:
docker compose logs -f api consumer inst payment
This will start the server on: http://localhost:8000
- FastAPI docs available on: http://localhost:8000/docs
- GraphQL User Interface on: http://localhost:8000/graphql
The following API endpoints are available:
POST /setup
- Endpoint for setting up the application (creates superuser account). Requires thesecret_key
,username
, andpassword
fields as form data. Accessible only with a validsecret_key
(from env file).POST /instagram/auth
- Endpoint for authenticating with an Instagram account. Requires theusername
,password
, and optionalverification_code
(If you receive code on the email or 2FA, just resend your request with this code again) and locale fields as form data. [AdminOnly]
POST /load-images
- Endpoint for loading images. Requires the images field as a form data list of files to be uploaded. [AdminOnly]GET /download/{product_id}
- Endpoint for downloading product images as a ZIP file. Requires the product_id path parameter. [AdminOnly]POST /upload-files/
- Endpoint for uploading temporary images. Requires the files field as a form data list of files to be uploaded. [AdminOnly]
The following GraphQL queries are available:
requisites
- Retrieves a list of requisites based on the type_id parameter. [AdminOnly]active_requisite
- Retrieves the active requisite based on the type_id parameter.orders
- Retrieves a list of orders with pagination support. [AdminOnly]order_detail
- Retrieves detailed information about a specific order. [AdminOnly]users
- Retrieves a list of users with pagination support. [AdminOnly]self
- Retrieves information about the current authenticated user.hash
- Generates a hash for a given password.location_search
- Retrieves information about a location based on a query.location_reverse
- Retrieves information about a location based on latitude and longitude.order_public_list
- Retrieves a list of public orders with pagination support.order_public_detail
- Retrieves detailed information about a specific public order.check_promo
- Checks the validity of a promo code.requisite_types
- Retrieves a list of requisite types.products
- Retrieves a list of products with pagination support. [AdminOnly]product_detail
- Retrieves detailed information about a specific product. [AdminOnly]fetch_product
- Parses product information from an Aliexpress URL. [AdminOnly]products_public
- Retrieves a list of public products with pagination support.public_detail
- Retrieves detailed information about a specific public product.product_categories
- Retrieves a list of product categories.
The following GraphQL mutations are available:
update_requisite
- This mutation updates the transactions information based on the provided payload. [AdminOnly]delete_requisite
- This mutation deletes a requisite by its ID. [AdminOnly]create_requisite
- This mutation creates a new requisite based on the provided payload. [AdminOnly]update_order
- This mutation updates the order information based on the provided order input. [AdminOnly]create_order
- This mutation creates a new order based on the provided payload, including an address, products, and promo information.login
- This mutation performs administrator authorization by taking a username and password as input.logout
- This mutation logs out the authenticated user.refresh
- This mutation refreshes the JSON Web Token (JWT) token for an authenticated user.telegram_login
- This mutation performs authorization for customers through a Telegram widget.confirm_transaction
- This mutation confirms a transaction by its associated order ID. [AdminOnly]create_requisite_type
- This mutation creates a new requisite type based on the provided payload. [AdminOnly]update_requisite_type
- This mutation updates a requisite type based on the provided payload. [AdminOnly]delete_requisite_type
- This mutation deletes a requisite type by its ID. [AdminOnly]create_product
- This mutation creates a new product based on the provided product input. [AdminOnly]update_product
- This mutation updates the product information based on the provided product input. [AdminOnly]delete_product
- This mutation deletes a product by its ID. [AdminOnly]update_product_category
- This mutation updates a product category based on the provided payload. [AdminOnly]create_product_category
- This mutation creates a new product category based on the provided payload. [AdminOnly]delete_product_category
- This mutation deletes a product category by its ID. [AdminOnly]
The main dependencies used in this code are:
FastAPI
- A modern, fast (high-performance) web framework for building APIs with Python.Strawberry
- A GraphQL library for Python that aims to provide a straightforward and type-safe approach to building GraphQL APIs.aio-pika
- a wrapper for theaiormq
forasyncio
and humans.Uvicorn
- an ASGI web server implementation for Python.