{"id":22170891,"url":"https://github.com/elhanarinc/user-microservice","last_synced_at":"2026-04-09T07:09:06.547Z","repository":{"id":94737300,"uuid":"229431474","full_name":"elhanarinc/user-microservice","owner":"elhanarinc","description":"User Microservice with mysql support","archived":false,"fork":false,"pushed_at":"2019-12-22T15:48:24.000Z","size":119,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T17:52:56.422Z","etag":null,"topics":["docker","docker-compose","flask","mysql","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":false,"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/elhanarinc.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-12-21T13:30:32.000Z","updated_at":"2020-05-30T12:18:23.000Z","dependencies_parsed_at":"2023-07-29T06:15:17.819Z","dependency_job_id":null,"html_url":"https://github.com/elhanarinc/user-microservice","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/elhanarinc/user-microservice","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fuser-microservice","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fuser-microservice/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fuser-microservice/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fuser-microservice/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/elhanarinc","download_url":"https://codeload.github.com/elhanarinc/user-microservice/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/elhanarinc%2Fuser-microservice/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259603667,"owners_count":22883190,"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":["docker","docker-compose","flask","mysql","python"],"created_at":"2024-12-02T06:56:31.754Z","updated_at":"2025-12-30T22:35:27.222Z","avatar_url":"https://github.com/elhanarinc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# User Microservice\n\nUser management microservice written with Flask Framework.\n\n- Since this project is a microservice, Flask should be more than enough due to its lightweight and fast architecture.\n- Flask alone is not enough for production use, so i have added [gunicorn](https://gunicorn.org/) to make it more scalable.\n- _healthcheck_ endpoint is actually not required but services in clouder providers like **AWS-ECS** or load balancers require this healtcheck.\n- In order to use this microservice **5000** and **3306** ports should be available on your local development machine.\n\nThis project assumes you had already installed these tools:\n\n1. [docker](https://www.docker.com/)\n2. [docker-compose](https://docs.docker.com/compose/)\n\n### Database Usage\n\nYou can connect the database using an ordinary mysql client. Configurations are below:\n\n```\nMYSQL_HOST = 127.0.0.1\nMYSQL_PORT = 3306\nMYSQL_USER = root\nMYSQL_PASSWORD = root\nMYSQL_DB = user_db\n```\n\n### API Usage\n\nIn order to use the API, all you have to do is run docker compose on the root directory of this project.\n\nBelow are the sample usage:\n\n```\ncd \u003cthis directory\u003e\ndocker-compose up -d\n```\n\nAfter starting the system, API will expose itself through port: `5000`\n\nThere are different endpoints for this API:\n\n1. `/health-check`\n\n- This endpoint accepts _GET_ request.\n\n  - This endpoint is just useful for understanding of the application live status.\n\n2. `/register`\n\n- This endpoint accepts _POST_ request.\n  - If user is not on the database; it hashes the password, inserts the user into database and returns a **token**.\n  - Body Params:\n  ```\n  {\n    \"username\": \"arincelhan\", [must]\n    \"email\": \"elhanarinc@gmail.com\", [must]\n    \"password\": \"arinc456\", [must]\n    \"name\": \"arinc\", [optional]\n    \"surname\": \"elhan\", [optional]\n    \"age\": 27 [optional]\n  }\n  ```\n\n3. `/login`\n\n- This endpoint accepts _POST_ request.\n  - If user is on the database, it returns a **token**.\n  - Body Params:\n  ```\n  {\n      \"email\": \"dummy@gmail.com\", [must]\n      \"password\": \"123456\" [must]\n  }\n  ```\n\n4. `/reset-password`\n\n- This endpoint accepts _POST_ request.\n  - User can reset and create a new password for his/hers account by using this endpoint.\n  - `Authorization` token should be on the request header.\n  - Body Params:\n  ```\n  {\n    \"password\": \"arinc123\" [must]\n  }\n  ```\n\n5. `/delete`\n\n- This endpoint accepts _DELETE_ request.\n\n  - User can remove himself/herself from the database by using this endpoint.\n  - `Authorization` token should be on the request header.\n\n6. `/update`\n\n- This endpoint accepts _PUT_ request.\n  - User can update his/hers name, surname and age by using this endpoint.\n  - `Authorization` token should be on the request header.\n  - Body Params:\n  ```\n  {\n    \"name\": \"john\", [must]\n    \"age\": 32, [must, should be greater than 15]\n    \"surname\": \"doe\" [must]\n  }\n  ```\n\n7. `/users`\n\n- This endpoint accepts _GET_ request.\n  - User can get information about the users on the database.\n  - `Authorization` token should be on the request header.\n  - User can search through on `email` or `username` fields by using\n    **search_param** query parameter.\n  - **search_param** can be `NULL`.\n  - Ex:\n  ```\n        127.0.0.1:5000/users?search_param=johndoe\n        127.0.0.1:5000/users\n  ```\n\n### Test Scenarios\n\n**login** and **register** test scenarios has been covered. In order to run tests, commands below could be used:\n\n```\ncd \u003cthis directory\u003e\ncd api\nvirtualenv be-venv -p python3\nsource be-venv/bin/activate\npip install -r requirements.txt\ncd src\npython -m unittest discover\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felhanarinc%2Fuser-microservice","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Felhanarinc%2Fuser-microservice","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Felhanarinc%2Fuser-microservice/lists"}