14 ms·
Current stack for creating easy to use GraphQL APIs + Frontend Integration: - Django 3 backed with a Postgres database (standard stuff) [0] - Add Graphene to
by djstein 5y ago
Current stack for creating easy to use GraphQL APIs + Frontend Integration:
- Django 3 backed with a Postgres database (standard stuff) [0]
- Add Graphene to enable Relay [1]
- Setup a fresh TypeScript based NextJS project [2]
- Add graphql-code-generator with a few plugins, mainly the graphql-request one [3]
- THE MAGIC: Generate your sdk by pointing graphql-codegen at your Django GraphQL schema!
- Add react-query, use the newly generated graphql-request client [4]
From here you've enabled the best of frontend technologies (NextJS, react-query) with a fully typed SDK generated by your familiar Python/Django bindings.
You can then move forward to add GraphQL based WebSockets via django-channels [5] + django-channels-graphql-ws [6] that update your existing react-query caches. Combine this with background Celery workers that make push to django-channels via Redis and you've got a a UI that auto updates based on background tasks as well.
[0] https://www.djangoproject.com https://www.djangoproject.com
[1] https://docs.graphene-python.org/projects/django/en/latest/ https://docs.graphene-python.org/projects/django/en/latest/
[2] http://nextjs.org/ http://nextjs.org/
[3] https://www.graphql-code-generator.com https://www.graphql-code-generator.com
[4] https://react-query.tanstack.com https://react-query.tanstack.com
[5] https://github.com/django/channels https://github.com/django/channels
[6] https://github.com/datadvance/DjangoChannelsGraphqlWs https://github.com/datadvance/DjangoChannelsGraphqlWs
[Edit] Line formatting