{"id":14976086,"url":"https://github.com/anshumanpattnaik/python-graphql-microservices","last_synced_at":"2025-10-27T17:32:17.569Z","repository":{"id":123927204,"uuid":"318307712","full_name":"anshumanpattnaik/python-graphql-microservices","owner":"anshumanpattnaik","description":"Python GraphQL Microservices","archived":false,"fork":false,"pushed_at":"2020-12-03T21:11:53.000Z","size":485,"stargazers_count":6,"open_issues_count":1,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T07:31:38.208Z","etag":null,"topics":["flask-restful","graphene","graphene-python","graphql","graphql-schema","microservices","mongodb","python","python3"],"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/anshumanpattnaik.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"publiccode":null,"codemeta":null}},"created_at":"2020-12-03T20:11:13.000Z","updated_at":"2024-12-24T19:18:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"31f4e3dc-3a6e-4d7e-844a-3063a828a3ac","html_url":"https://github.com/anshumanpattnaik/python-graphql-microservices","commit_stats":{"total_commits":4,"total_committers":1,"mean_commits":4.0,"dds":0.0,"last_synced_commit":"5ca083e81085b1a47aaa3f2e42dc61c946ef306b"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshumanpattnaik%2Fpython-graphql-microservices","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshumanpattnaik%2Fpython-graphql-microservices/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshumanpattnaik%2Fpython-graphql-microservices/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/anshumanpattnaik%2Fpython-graphql-microservices/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/anshumanpattnaik","download_url":"https://codeload.github.com/anshumanpattnaik/python-graphql-microservices/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238536012,"owners_count":19488639,"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":["flask-restful","graphene","graphene-python","graphql","graphql-schema","microservices","mongodb","python","python3"],"created_at":"2024-09-24T13:53:16.876Z","updated_at":"2025-10-27T17:32:12.223Z","avatar_url":"https://github.com/anshumanpattnaik.png","language":"Python","readme":"## Python GraphQL Microservices\nThe idea behind this project is to demonstrate using [GraphQL](https://graphql.org/) how we can query large sets of datasets by combining different sets of API endpoints? and GraphQL is a very popular data query and manipulation language developed by [Facebook](https://developers.facebook.com/docs/graph-api/) and using GraphQL we can populate large sets of data using a single query in a very faster and efficient way. To demonstrate the proof of concept I have taken the datasets from [COVID-19](https://github.com/anshumanpattnaik/covid19-full-stack-application) project and those datasets used for analysis in this project.\n\n\u003cimg src=\"screenshots/thumbnail.png\"/\u003e\n\n## Technical Overview\nThe proof of concept written using python and to implement the GraphQL it uses [graphene](https://pypi.org/project/graphene/) python module and the microservices designed and implemented using [flask](https://flask.palletsprojects.com/en/1.1.x/) framework and to store the data it uses mongodb database for the storage.\n\nThere are three different types of microservices designed in this project\n\n1. Statistics\n2. Total Cases\n3. Subscriptions\n\n## Installation\n`````````````````````````````````````````````````````````````````````````\ngit clone https://github.com/anshumanpattnaik/python-graphql-microservices\ncd python-graphql-microservices\npip install -r requirements.txt\nsource venv/bin/activate\npython3 run.py\n`````````````````````````````````````````````````````````````````````````\n\n## COVID-19 Datasets\nUnder `covid19_dummy_data/` folder you will find the statistics [data.json](https://github.com/anshumanpattnaik/python-graphql-microservices/blob/main/covid19_dummy_data/data.json) file, which you can use while adding data using `http://127.0.0.1:5000/api/v1/add_statistics` endpoint.\n\n## GraphQL (All Queries/Mutation)\nAfter the installation and importing the data into mongodb database, you can open `http://127.0.0.1:5000/api/v1/graphql` to view in the browser.\n\nTo refer the queries you can follow `graphql_queries/` folder for [all_queries.graphql](https://github.com/anshumanpattnaik/python-graphql-microservices/blob/main/graphql_queries/all_queries.graphql) and [mutation_query.graphql](https://github.com/anshumanpattnaik/python-graphql-microservices/blob/main/graphql_queries/mutation_query.graphql) which you can use to analyze the data.\n\n### All Queries\nUsing all queries it will populate three different sets of data.\n\n1. Statistics of all counties - (allStatistics)\n2. Total Cases around the world - (allTotalCases)\n3. List of COVID-19 email subscribers - (allSubscriber)\n\n``````````````````````````````````````````````````````````````````````````````\n{\n  allStatistics {\n    edges {\n      node {\n        code\n        country\n        flag\n        coordinates\n        confirmed\n        deaths\n        recovered\n        states {\n          edges {\n            node {\n              name\n              address\n              latitude\n              longitude\n              confirmed\n              deaths\n              recovered\n            }\n          }\n        }\n      }\n    }\n  },\n  allTotalCases {\n    edges {\n      node {\n        totalConfirmed\n        totalDeaths\n        totalRecovered\n      }\n    }\n  },\n  allSubscriber {\n    edges {\n      node {\n        email\n      }\n    }\n  }\n}\n``````````````````````````````````````````````````````````````````````````````\n\u003cimg src=\"screenshots/all_queries.png\"/\u003e\n\n\n### Mutation Query\nUsing mutation query you can populate the statistics of the individual country by passing the country name.\n\n````````````````````````````````````````````````````````````````````\nmutation {\n  fetchByCountryName(country: \"India\") {\n    statistics {\n      code\n      country\n      flag\n      coordinates\n      confirmed\n      deaths\n      recovered\n      states {\n        edges {\n          node {\n            name\n            address\n            latitude\n            longitude\n            confirmed\n            deaths\n            recovered\n          }\n        }\n      }\n    }\n  }\n}\n````````````````````````````````````````````````````````````````````\n\n\u003cimg src=\"screenshots/mutation.png\"/\u003e\n\n### Note\nTo understand more in-depth I'll highly recommend following the official documentation of [GraphQL](https://graphql.org/code/#python) and [Graphene](https://docs.graphene-python.org/en/latest/quickstart/)\n\n### License\nThis project is licensed under the [MIT License](LICENSE)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshumanpattnaik%2Fpython-graphql-microservices","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanshumanpattnaik%2Fpython-graphql-microservices","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanshumanpattnaik%2Fpython-graphql-microservices/lists"}