RESTful HTTP API using Python Flask that allows users to manage their ecommerce platform.
- Create a user
- users can login
- user can logout
- Create an order
Add New Product Update a product See all users Create a user
GADGETGO is a robust, production-ready RESTful API for an e-commerce platform. It provides a complete backend solution for managing users, products, categories, orders, and payments. Built with Flask and SQLAlchemy, it features secure JWT authentication, role-based access control, and image handling.
- User Management: Registration, Login (JWT), Logout (Token Blacklist), Profile management.
- Product Catalog: CRUD operations for products and categories.
- Order Processing: Create, view, update, and cancel orders.
- Image Handling: Support for product images (via Pillow).
- Security: Password hashing (Bcrypt), JWT Authentication, Token Blacklisting.
- Database: SQLAlchemy ORM with SQLite (default) or PostgreSQL/MySQL support.
- Migrations: Database schema migrations using Flask-Migrate.
- Deployment Ready: Gunicorn configuration included.
- Framework: Flask
- Database: SQLAlchemy (ORM), SQLite (Dev)
- Authentication: PyJWT, Flask-Login
- Forms/Validation: Flask-WTF
- Utilities: Pillow (Images), Flask-Mail (Email), Flask-Migrate (DB Migrations)
- Server: Gunicorn
GADGETGO/
βββ app/
β βββ v1/
β βββ models/ # Database models (User, Product, Order)
β βββ routes/ # API endpoints (Blueprints)
β βββ utils/ # Helper functions (Auth, Tokens)
β βββ templates/ # HTML templates (if using UI)
β βββ __init__.py # App factory
βββ instance/ # SQLite database location
βββ migrations/ # Database migration scripts
βββ config.py # Configuration settings
βββ run.py # Entry point
βββ requirements.txt # Dependencies
βββ README.md # Documentation
- Python 3.8+
- Git
git clone https://github.com/GODSPE1/GADGETGO.git
cd GADGETGOpython3 -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activatepip install -r requirements.txtCreate a .env file in the root directory:
export SECRET_KEY="your-super-secret-key"
export FLASK_APP=run.py
export FLASK_ENV=developmentflask db init
flask db migrate -m "Initial migration"
flask db upgradeNote: If you just want to run with the default setup, the app will create the DB on first run if configured in __init__.py.
flask runThe API will be available at http://127.0.0.1:5000.
| Method | Endpoint | Description | Auth |
|---|---|---|---|
POST |
/auth/register |
Register a new user | No |
POST |
/auth/login |
Login & get JWT token | No |
POST |
/auth/logout |
Logout (Blacklist token) | Yes |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
GET |
/products |
Get all products | No |
GET |
/products/<id> |
Get product details | No |
POST |
/products |
Create a product | Admin |
PUT |
/products/<id> |
Update a product | Admin |
DELETE |
/products/<id> |
Delete a product | Admin |
| Method | Endpoint | Description | Auth |
|---|---|---|---|
GET |
/orders |
Get all orders | Admin |
POST |
/orders |
Place a new order | User |
GET |
/orders/<id> |
Get order details | User/Admin |
Run the tests (if available) or use curl to test endpoints manually.
Example: Login
curl -X POST http://127.0.0.1:5000/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"admin", "password":"password"}'To run in production using Gunicorn:
gunicorn -w 4 -b 0.0.0.0:8000 run:app- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.