Froggy Commerce API is a backend API designed to manage an e-commerce system. It provides endpoints to manage products, customers, administrators, shopping carts, and payment processes. This API is designed to be flexible, secure, and easy to integrate with e-commerce user interfaces.
-
User and Roles Control: Implements a user and roles management system to ensure security and control access to the API functionality. This includes creating customer accounts and assigning specific roles to users.
-
Security Measures: The API implements security measures such as user authentication using JWT tokens, role-based authorization, and data validation to protect data and ensure proper access control.
-
Administrators: Administrators can manage products (create, update, delete), manage product stock, and view and manage all existing customers on the platform.
-
Customers: Customers can view products, update their user profile, manage shipping and billing addresses, and add, delete, and update products in the shopping cart.
-
Login and Registration: Endpoints are provided for user registration and authentication on the platform, using a secure system based on JWT tokens.
-
Payment Link Generation: The application allows generating a payment link for products in the user's shopping cart, facilitating the purchase process.
-
Integration with Mercado Pago: Integrates with Mercado Pago to manage payment processes efficiently and securely.
-
Swagger Documentation: Uses Swagger to document the API clearly and accessibly.
Make sure you have the following requirements installed on your system:
- Docker: To run the project in a container.
- Docker Compose: To define and run Docker applications with multiple containers.
-
Clone the repository:
git clone https://github.com/Sapitorico/FroggyCommerce-api.git cd FroggyCommerce-api
-
Configure the
.env
file:# Flask configuration FLASK_ENV=development # Can be 'development' or 'production' depending on the environment # API config API_NAME=Your_API_Name URL_SCHEME=URL_Scheme (http/https) SERVER_NAME=Server_Name PORT=5000 # MySQL configuration MYSQL_HOST=localhost # MySQL Database Host MYSQL_PORT=3306 # MySQL Database Port MYSQL_USER=root # MySQL Database User MYSQL_PASSWORD=yourpassword # MySQL Database User Password MYSQL_DB=ecommerce_db # MySQL Database Name # Security SECRET_KEY=Secret_key_for_Flask ALGORITHM=Algorithm_for_JWT_tokens # Mercado Pago MP_ACCESS_TOKEN=youraccesstoken # Mercado Pago Access Token
-
Run the following command to build and start the containers:
sudo docker-compose up --build -d
-
After the containers have started successfully, you can access the API documentation generated by Swagger at the following link:
Make sure you have the following requirements installed on your system:
- Python: To run the project locally.
- Virtualenv: To create a virtual environment for Python.
- MySQL: Database management system. Make sure MySQL is installed and running on your system.
-
Clone the repository:
git clone https://github.com/Sapitorico/FroggyCommerce-api.git cd FroggyCommerce-api
-
Configure the
.env
file as shown in the Docker installation section. -
Run the following command to create the database and load the schema from the create_db.sh script:
./create_db.sh
-
Create and activate a virtual environment for Python:
python -m venv venv source venv/bin/activate
-
Install the project dependencies:
pip install -r requirements.txt
-
Run the application:
python main.py
-
After the application has started successfully, you can access the API documentation generated by Swagger at the following link:
Froggy Commerce integrates with Mercado Pago to manage payment processes efficiently and securely. To use this integration, follow these steps:
-
Create an account on Mercado Pago.
-
Get your Mercado Pago API credentials, including your Access Token.
-
Configure your application to use the Mercado Pago credentials. This may involve setting environment variables in your
.env
file:MERCADO_PAGO_ACCESS_TOKEN=your_access_token_here
-
Follow the instructions in the Mercado Pago documentation to set up the necessary webhooks to receive payment notifications.
-
If you are working in a local environment and want to test Mercado Pago payment functionalities, you will need to expose your local server to the internet using a tool like ngrok to create a tunnel and obtain a public URL. Make sure to configure your application to use this URL, including the scheme (HTTP or HTTPS) and the server name in your
.env
file:URL_SCHEME=https SERVER_NAME=your_ngrok_url_here
-
That's it! You can now start using the Mercado Pago payment functionalities in your Froggy Commerce application.
This project is licensed under the MIT License. See the LICENSE file for more details.