{"id":21753774,"url":"https://github.com/melardev/flaskapiecommerce","last_synced_at":"2025-10-17T21:23:10.491Z","repository":{"id":65830490,"uuid":"171147512","full_name":"melardev/FlaskApiEcommerce","owner":"melardev","description":"Python Ecommerce Api application built with Flask + Flask SQlAlchemy","archived":false,"fork":false,"pushed_at":"2019-02-17T16:58:09.000Z","size":156,"stargazers_count":29,"open_issues_count":0,"forks_count":28,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-20T09:18:25.310Z","etag":null,"topics":["api","crud","django","e-commerce","ecommerce","flask","flask-sqlalchemy","full-stack","fullstack","orm","orm-framework","pagination","python","shopping-cart","sqlalchemy","web"],"latest_commit_sha":null,"homepage":"http://melardev.com","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/melardev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-17T16:58:01.000Z","updated_at":"2025-02-24T11:00:29.000Z","dependencies_parsed_at":"2023-02-12T23:25:10.707Z","dependency_job_id":null,"html_url":"https://github.com/melardev/FlaskApiEcommerce","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/melardev/FlaskApiEcommerce","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FFlaskApiEcommerce","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FFlaskApiEcommerce/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FFlaskApiEcommerce/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FFlaskApiEcommerce/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/melardev","download_url":"https://codeload.github.com/melardev/FlaskApiEcommerce/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/melardev%2FFlaskApiEcommerce/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266983523,"owners_count":24016559,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-25T02:00:09.625Z","response_time":70,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","crud","django","e-commerce","ecommerce","flask","flask-sqlalchemy","full-stack","fullstack","orm","orm-framework","pagination","python","shopping-cart","sqlalchemy","web"],"created_at":"2024-11-26T09:11:31.971Z","updated_at":"2025-10-17T21:23:10.433Z","avatar_url":"https://github.com/melardev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nThis is one of my E-commerce API app implementations. It is written in Python with Flask as the main dependency.\nThis is not a finished project by any means, but it has a valid enough shape to be git cloned and studied if you are interested in this topic.\nIf you are interested in this project take a look at my other server API implementations I have made with:\n\n- [Node Js + Sequelize](https://github.com/melardev/ApiEcomSequelizeExpress)\n- [Node Js + Bookshelf](https://github.com/melardev/ApiEcomBookshelfExpress)\n- [Node Js + Mongoose](https://github.com/melardev/ApiEcomMongooseExpress)\n- [Python Django](https://github.com/melardev/DjangoRestShopApy)\n- [Java EE Spring Boot and Hibernate](https://github.com/melardev/SBootApiEcomMVCHibernate)\n- [Ruby on Rails](https://github.com/melardev/RailsApiEcommerce)\n- [AspNet Core](https://github.com/melardev/ApiAspCoreEcommerce)\n- [Laravel](https://github.com/melardev/ApiEcommerceLaravel)\n\nThe next projects to come will be:\n- Elixir with phoenix and Ecto\n- AspNet MVC 6\n- Java EE with Jax RS with jersey\n- Java EE with Apache Struts 2\n- Spring Boot with Kotlin\n- Go with Gorilla and Gorm\n- Go with Beego\n- Laravel with Fractal and Api Resources\n- Flask with other Rest Api frameworks such as apisec, flask restful\n\n## WARNING\nIf you debug the seed_database.py file then be warned you may run into exceptions related to thread safety, in that\ncase just rerun the script and try to not place the breakpoint where creating the model takes place\n# Getting started\n1. Git clone the project\n1. Setup Flask-Migrate\n`flask db init \u0026\u0026 flask db migrate \u0026\u0026 flask db upgrade`\n1. Seed the database with\n1. Seed the database\n`python2 seed_database.py`\n\nWhile you play with the project, if you want to reset the database(delete the app.db, regenerate the migrations and migrate)\nyou can execute reset.bat, it relies on flask2 executable(you may want to change it to flask instead); Flask2 it is\njust a custom bat file that I have that points to flask.exe from my Python2 Installation folder\n\n# Useful commands\n- Setup the migrations folder to hold migration files\n`flask2 db init`\n- Generate migration files\n`flask2 db migrate`\n- Make the actual migration and create tables on database\n`flask2 db upgrade`\n\n\n# Features\n- Authentication / Authorization\n- JWT middleware for authentication\n- Multi file upload\n- Database seed\n- Paging\n- CRUD operations on products, comments, tags, categories, orders\n![Fetching products page](./github_images/postman.png)\n- Orders, guest users may place an order\n![Database diagram](./github_images/db_structure.png)\n\n# What you will learn\n- Flask\n- Jwt authentication with flask\n- Controllers\n- Middlewares\n- JWT Authentication\n- Role based authorization\n- Flask SQLAlchemy ORM\n    - associations: ManyToMany, OneToMany, ManyToOne\n    - Select specific columns\n    - Eager loading\n    - Count related association\n    \n- seed data\n- misc\n    - project structure\n\n# Understanding the project\nIn project apps you will most of the times see that there is the launcher file, and the creation of the app and db is done\nelsewhere, why? to avoid circular dependencies. The app flask instance along with the db are heavily import from\nall over the places in our project, those variables are better placed in a separate file, I will explain this aspect \nin a youtube video if you did not get it.\n\n# TODO\n- Security, validations, fix vulnerabilities\n- File upload validation\n- unit testing\n- Create annotation to require authenticated user to be admin\n- Considering changing the project structure to a flask-ish way, with extensions clearly separated in a separate file\neven though the way it is implemented right now is not that bad\n- I do not think it is a good idea to put the get_dto inside the model itself, that should be placed in the corresponding\nserializer class to clearly separate the concerns, this is easy to refactor\n\n# Resources\n- [](https://flask-jwt-extended.readthedocs.io/en/latest/api.html#flask_jwt_extended.JWTManager.user_identity_loader","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelardev%2Fflaskapiecommerce","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmelardev%2Fflaskapiecommerce","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmelardev%2Fflaskapiecommerce/lists"}