{"id":17717774,"url":"https://github.com/mununki/flask_graphql_api_boilerplate","last_synced_at":"2025-03-14T02:31:15.679Z","repository":{"id":143922193,"uuid":"178313039","full_name":"mununki/flask_graphql_api_boilerplate","owner":"mununki","description":"A Flask + GraphQL API with JWT","archived":false,"fork":false,"pushed_at":"2019-04-03T08:32:30.000Z","size":14,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-24T03:22:04.226Z","etag":null,"topics":[],"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/mununki.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":"2019-03-29T01:55:53.000Z","updated_at":"2024-04-24T03:22:04.227Z","dependencies_parsed_at":null,"dependency_job_id":"f2dd563c-b282-42ce-9452-23dfbc4b2382","html_url":"https://github.com/mununki/flask_graphql_api_boilerplate","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mununki%2Fflask_graphql_api_boilerplate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mununki%2Fflask_graphql_api_boilerplate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mununki%2Fflask_graphql_api_boilerplate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mununki%2Fflask_graphql_api_boilerplate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mununki","download_url":"https://codeload.github.com/mununki/flask_graphql_api_boilerplate/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243511658,"owners_count":20302593,"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":[],"created_at":"2024-10-25T14:29:59.301Z","updated_at":"2025-03-14T02:31:15.666Z","avatar_url":"https://github.com/mununki.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Flask + GraphQL + boilerplate\n\nThis is a Flask + GraphQL API boilerplate with JSON web token.\n\n## Stack\n\n- Flask\n- GraphQL : Flask-GraphQL\n- ORM : Flask-SQLAlchemy\n- Password encryption : bcrypt\n- Authentication: JSON web token\n- DB : Postgres(psycopg2-binary)\n\n## Feature\n\n- GraphQL API\n- User Sign Up / Sign In / Change password / Change profile\n- JSON Web Token Authentication\n- GraphiQL : Playground -\u003e http://localhost:5000/graphql\n\n## Configuration\n\n### Dependencies\n\n```shell\n$ pip install -r requirements.txt\n```\n\n### `config.py`\n\n```python\nSQLALCHEMY_DATABASE_URI = 'postgres://\u003cusername\u003e:\u003cpassword\u003e@\u003cdb_address = localhost\u003e:5432/\u003cdb_name\u003e'\nSQLALCHEMY_TRACK_MODIFICATIONS = True\nJWT_SECRET_KEY = 'secret'  # you must change this.\nJWT_ACCESS_TOKEN_EXPIRES = 2592000\n```\n\n### Set a DB model\n\n```python\n# models.py\n\nfrom app import db\n\n\nclass MyUser(db.Model):\n    __tablename__ = 'myuser'\n    id = db.Column(db.Integer, primary_key=True)\n    email = db.Column(db.String(50), unique=True, nullable=False)\n    firstname = db.Column(db.String(30), nullable=False)\n    lastname = db.Column(db.String(30), nullable=False)\n    password = db.Column(db.String, nullable=False)\n    bio = db.Column(db.String)\n```\n\n### DB initialization and migration\n\n```shell\n$ python db.py db init\n```\n\n```shell\n$ python db.py db migrate\n$ python db.py db upgrade\n```\n\n## Query\n\n### Get Profile\n\n\u003e http request authorization headers -\u003e Authorization: {token}\n\n```graphql\nquery {\n  me {\n    ok\n    error\n    me {\n      id\n      email\n      firstname\n      lastname\n      bio\n      createdAt\n      updatedAt\n    }\n  }\n}\n```\n\n## Mutation\n\n### Sign Up\n\n```graphql\nmutation {\n  signUp(\n    email: \"flask@graphql.com\"\n    password: \"12345678\"\n    firstname: \"graphql\"\n    lastname: \"flask\"\n  ) {\n    ok\n    error\n    user {\n      id\n      email\n      firstname\n      lastname\n      bio\n    }\n  }\n}\n```\n\n### Sign In\n\n```graphql\nmutation {\n  signIn(email: \"flask@graphql.com\", password: \"12345678\") {\n    ok\n    error\n    token\n  }\n}\n```\n\n### Change Password\n\n\u003e http request authorization headers -\u003e Authorization: {token}\n\n```graphql\nmutation {\n  changeProfile(password: \"87654321\") {\n    ok\n    error\n    user {\n      id\n      email\n      firstname\n      lastname\n      bio\n      createdAt\n      updatedAt\n    }\n  }\n}\n```\n\n### Change Profile\n\n\u003e http request authorization headers -\u003e Authorization: {token}\n\n```graphql\nmutation {\n  changeProfile(bio: \"I'm flask user.\") {\n    ok\n    error\n    user {\n      id\n      email\n      firstname\n      lastname\n      bio\n      createdAt\n      updatedAt\n    }\n  }\n}\n```\n\n## Next to do\n\n- [x] Sign Up\n- [x] Sign In with JWT\n- [x] Change profile\n- [x] Change password\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmununki%2Fflask_graphql_api_boilerplate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmununki%2Fflask_graphql_api_boilerplate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmununki%2Fflask_graphql_api_boilerplate/lists"}