{"id":21246791,"url":"https://github.com/apfirebolt/myntra_ecommerce_api_in_django","last_synced_at":"2026-05-20T06:09:09.352Z","repository":{"id":207547163,"uuid":"719435719","full_name":"Apfirebolt/Myntra_ecommerce_api_in_django","owner":"Apfirebolt","description":"An API created in Django with clothing store data from Mynta.com website","archived":false,"fork":false,"pushed_at":"2024-04-12T20:16:10.000Z","size":8452,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-13T03:58:09.217Z","etag":null,"topics":["api","backend-api","django","django-rest-framework","drf-spectacular","myntra","myntra-clone","python","swagger-api","swagger-docs"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Apfirebolt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-11-16T06:48:55.000Z","updated_at":"2024-04-15T05:29:42.696Z","dependencies_parsed_at":"2024-04-15T05:29:21.663Z","dependency_job_id":null,"html_url":"https://github.com/Apfirebolt/Myntra_ecommerce_api_in_django","commit_stats":null,"previous_names":["apfirebolt/myntra_ecommerce_api_in_django"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apfirebolt%2FMyntra_ecommerce_api_in_django","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apfirebolt%2FMyntra_ecommerce_api_in_django/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apfirebolt%2FMyntra_ecommerce_api_in_django/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Apfirebolt%2FMyntra_ecommerce_api_in_django/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Apfirebolt","download_url":"https://codeload.github.com/Apfirebolt/Myntra_ecommerce_api_in_django/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243685525,"owners_count":20330980,"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","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","backend-api","django","django-rest-framework","drf-spectacular","myntra","myntra-clone","python","swagger-api","swagger-docs"],"created_at":"2024-11-21T02:06:04.542Z","updated_at":"2026-05-20T06:09:04.313Z","avatar_url":"https://github.com/Apfirebolt.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Python](https://img.shields.io/badge/python-3670A0?style=for-the-badge\u0026logo=python\u0026logoColor=ffdd54)\n![Django](https://img.shields.io/badge/Django-092E20?style=for-the-badge\u0026logo=django\u0026logoColor=green)\n![Django Rest Framework](https://img.shields.io/badge/django%20rest-ff1709?style=for-the-badge\u0026logo=django\u0026logoColor=white)\n![Swagger](https://img.shields.io/badge/-Swagger-%23Clojure?style=for-the-badge\u0026logo=swagger\u0026logoColor=white)\n\n# Ecommerce API created using Myntra dataset\n\nThis is an Ecommerce API which I created using a dataset with data taken from https://myntra.com which is one of the most popular online clothing stores in India.\n\nhttp://localhost:8000/api-docs/\n\nThe API docs can be viewed using the above link. Swagger is used to generate API docs under the hood using a package called 'drf_spectacular'.\n\n## Getting Started\n\n* Create a new virtual environment and install packages specified in the requirements.txt file.\n\n* Hook in your database of choice, make necessary database changes in the settings.py file inside the project folder. Obviously, some familiarity with Django folder structures is required for this. By default this project uses MySQL as database.\n\n* Make migrations when you're done with the database settings and migrate.\n* Run python manage.py runserver, and the application should be running on port 8000 by default.\n\n## Built With\n\n* [Python Django](https://www.djangoproject.com/)\n* [Django Rest Framework](https://www.django-rest-framework.org/)\n* [Swagger Docs](https://swagger.io/)\n\n## Features \n\nApplication has around 10K entries for clothing related products coming from a dataset I retrieved from Kaggle.com\nFor feeding the data into the database, Management commands are used.\n\n```\npython manage.py populate\npython manage.py clear\n```\n\nPopulate command reads the csv file and creates an item model for each row saving it in the database. Clear command is as the name suggests clears the database in case required in any case.\n\nThe initial data was kind of large so I had to condense it by only picking the first 10k entries from the csv file. It was done using the pandas library.\n\n```\nimport pandas as pd\n\ndef condense_data():\n\n    # Read data from csv file\n    df = pd.read_csv('data/myntra.csv')\n\n    # Read only first 5k enties and save it in a new csv file\n\n    df = df.head(5000)\n    df.to_csv('data/myntra_condensed.csv')\n\n\ncondense_data()\n\n```\n\n## Updates\n\nReact frontend to be added in future.\n\n- Cached response using Redis, it decreased response time for subsequent requests from 33 ms to 5 ms approximately.\n\n### Added Support for MySQL\n\nInstall pymysql library\n\n```\npip install pymysql\n```\n\nImport it in settings.py file\n\n```\nimport os\nfrom pathlib import Path\nimport pymysql\npymysql.install_as_MySQLdb()\n\n...\n```\n\nDatabase configuration\n\n```\nDATABASES = {\n    'default': {\n        'ENGINE': 'django.db.backends.mysql',\n        'NAME': 'myntra',\n        'USER': 'root',\n        'PASSWORD': 'password',\n        'HOST': 'localhost',   # Or the IP Address where your MySQL server is hosted\n        'PORT': '3306',        # Default MySQL port\n    }\n}\n```\n\nRun Migrations and populate data from the dataset.\n\n```\npython manage.py migrate\npython manage.py populate\n```\n\nTaking Database Back-up\n\n```\npython manage.py db_backup [--filename \u003cfilename\u003e] [--database \u003cdatabase_name\u003e]\n\npython manage.py db_backup --filename myntra_backup.sql --database myntra\n\n```\n\n## API Throttling\n\nAPI throttling is a concept of limiting the user access to a specific number based on the privileges of the user. In this application we allow logged in users to 10 requests/min and anonymous users to 5 req/min.\n\n```\nREST_FRAMEWORK = {\n    'DEFAULT_AUTHENTICATION_CLASSES': (\n        'rest_framework_simplejwt.authentication.JWTAuthentication',\n    ),\n    'DEFAUL_THROTTLE_CLASSES': [\n        'rest_framework.throttling.AnonRateThrottle',\n        'rest_framework.throttling.UserRateThrottle',\n    ],\n    'DEFAULT_THROTTLE_RATES': {\n        'anon': '5/min',\n        'user': '10/min',\n    },\n    'DEFAULT_FILTER_BACKENDS': ['django_filters.rest_framework.DjangoFilterBackend'],\n    'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination',\n    'PAGE_SIZE': 50,\n    'DEFAULT_SCHEMA_CLASS': 'drf_spectacular.openapi.AutoSchema',\n}\n```\n\n## Authors\n\n* **Amit Prafulla (APFirebolt)** - (http://apgiiit.com/)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details\n\n```\ndocker-compose run --rm web python manage.py populate\n\ndocker-compose build --no-cache\n\ndocker run -d \\\n  -p 5173:5432 \\\n  --name my-postgres \\\n  -e POSTGRES_DB=myntra \\\n  -e POSTGRES_USER=postgres \\\n  -e POSTGRES_PASSWORD=pass123 \\\n  postgres:latest\n\n\ndocker-compose up\n```\n\n```\ndocker-compose down -v\n```\n\n## Screenshots\n\n## Screenshots\n\nSwagger Documentation \n\n![Screenshot 1](screenshots/1.png)\n\nREST FRAEMWORK view of the items page.\n\n![Screenshot 2](screenshots/2.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapfirebolt%2Fmyntra_ecommerce_api_in_django","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fapfirebolt%2Fmyntra_ecommerce_api_in_django","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fapfirebolt%2Fmyntra_ecommerce_api_in_django/lists"}