How to structure GraphQL server with flask+graphene
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github/ISSUE_TEMPLATE
Server
.gitignore
CODE_OF_CONDUCT.md
LICENSE
README.md
requirements.txt

README.md

Flask-GraphQL-Large-Application-Example Awesome

Summary

This is how I structure my GraphQL server with Flask + Graphene

About

This is basic example of large Flask+Graphene server. all essential use examples have been covered and advanced use examples will be added step by step

  • Features
    • Query example
    • Mutauion example
    • Union example
    • Field example
    • Relay example
    • InputObjectType example
    • Dataloader example
    • Middleware example
    • Interfaces example
    • AbstractTypes example
    • Basic authentication example
    • MongoDB example
    • MySQL(SQLAlchemy, PeeWee) example
  • ToDo
    • Layered Architecture(Clean Architecture)

Project defendencies

  • GraphQL framework
    • Graphene
  • HTTP serving
    • Flask-GraphQL
    • Flask
  • Database ORM
    • Mongoengine
  • Authentication

How to test this example?

This repository implemented minitwit to cover examples. Use the following command to run the server

pip install -r requirements.txt
python run_server.py

GraphiQL enabled by default.

Diagrams

not covered

Core components

/Server/app/schema

GraphQL 서버를 구성하는 필드, 쿼리, 뮤테이션을 담고 있습니다.

This directory contains fields, queries, and interactions that make up the GraphQL schema

/Server/app/schema/init.py

GraphQL 스키마를 구성하고 구성된 스키마를 Flask 인스턴스에 할당합니다.

Structure GraphQL schema and add schema with flask.add_url_rule

/Server/app/schema/fields

GraphQL 쿼리와 뮤테이션에서 사용하는 필드들로 구성된 디렉터리입니다.

This directory contains the fields that make up the GraphQL schema.

/Server/app/graphql_view/unions

GraphQL 쿼리와 뮤테이션에서 사용하는 유니온들로 구성된 디렉터리입니다.

This directory contains the unions that make up the GraphQL schema.

/Server/app/schema/queries

이 디렉터리는 쿼리와 쿼리 resolver들로 구성됩니다. 유연한 구조를 위해 resolver들을 독립적인 파일에 담습니다

This directory consists root query class and query resolvers. Place the resolver in an independent file for flexible structure

/Server/app/schema/mutations

이 디렉터리는 뮤테이션들로 구성됩니다. 유연한 구조를 위해 뮤테이션 들을 독립적인 파일에 담습니다

This directory consists mutations. Place the mutation in an independent file for flexible structure

I refered

People

Syrus Akbary

Repository

Flask-Large-Application-Example

Website

Designing GraphQL mutations
Authorization in GraphQL
GraphQL ansd authentication

Library Docs

Graphene