All Projects β†’ correttojs β†’ graphql-codegen-apollo-next-ssr

correttojs / graphql-codegen-apollo-next-ssr

Licence: other
Autogenerate apollo code for nextjs ssr

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to graphql-codegen-apollo-next-ssr

graphql-codegen-vscode
vscode extension which runs graphql-codegen whenever you save a query/mutation
Stars: ✭ 41 (-76.7%)
Mutual labels:  codegen, graphql-code-generator, graphql-codegen
UmaSupporter.WebClient
πŸƒπŸ½β€β™€οΈ μš°λ§ˆλ¬΄μŠ€λ©” μœ‘μ„± λ„μš°λ―Έ 'μš°λ§ˆμ„œν¬ν„°'의 ν”„λ‘ νŠΈμ—”λ“œ μ• ν”Œλ¦¬μΌ€μ΄μ…˜μž…λ‹ˆλ‹€.
Stars: ✭ 14 (-92.05%)
Mutual labels:  apollo-client, codegen
Graphql Codegen Hasura
code-generator plugins for hasura/apollo-gql/typescript development
Stars: ✭ 113 (-35.8%)
Mutual labels:  apollo-client, codegen
graphql-java-codegen
Make your GraphQL Java application schema-driven.
Stars: ✭ 167 (-5.11%)
Mutual labels:  codegen, graphql-codegen
bookshelf
My GraphQL playground
Stars: ✭ 64 (-63.64%)
Mutual labels:  apollo-client, graphql-codegen
apollo-graphql-full-stack
Full-stack Apollo GraphQL app using React and Node JS
Stars: ✭ 31 (-82.39%)
Mutual labels:  apollo-client
react-native-appsync-s3
React Native app for image uploads to S3 and storing their records in Amazon DynamoDB using AWS Amplify and AppSync SDK
Stars: ✭ 18 (-89.77%)
Mutual labels:  apollo-client
startle
Startle C Library
Stars: ✭ 15 (-91.48%)
Mutual labels:  codegen
apollo-fragment
Use Apollo Link State to connect components to GraphQL fragments in the Apollo Cache
Stars: ✭ 112 (-36.36%)
Mutual labels:  apollo-client
fullstack-jobs
Real(ish) demo using Angular with ASP.NET Core GraphQL and IdentityServer.
Stars: ✭ 84 (-52.27%)
Mutual labels:  apollo-client
react-apollo-fragments
True Fragment component for react-apollo
Stars: ✭ 13 (-92.61%)
Mutual labels:  apollo-client
graphql-java-codegen-gradle-plugin
Gradle plugin for graphql-java-codegen
Stars: ✭ 19 (-89.2%)
Mutual labels:  codegen
devto-monorepo
Source code for the Dev.to article - Next.js, Apollo Client and Server on a single Express app
Stars: ✭ 33 (-81.25%)
Mutual labels:  apollo-client
apollo-cache-instorage
Apollo Cache implementation that facilitates locally storing resources
Stars: ✭ 98 (-44.32%)
Mutual labels:  apollo-client
butte
No description or website provided.
Stars: ✭ 69 (-60.8%)
Mutual labels:  codegen
rosetta
Easy to use Rust i18n library based on code generation
Stars: ✭ 37 (-78.98%)
Mutual labels:  codegen
pokedex-react
A Pokedex App using and teaching Apollo and React
Stars: ✭ 47 (-73.3%)
Mutual labels:  apollo-client
ogen
OpenAPI v3 code generator for go
Stars: ✭ 436 (+147.73%)
Mutual labels:  codegen
chanyeong
πŸ‘¨β€πŸ’» chanyeong's portfolio and blog webpage
Stars: ✭ 39 (-77.84%)
Mutual labels:  apollo-client
graphql-ts-client
Typescript DSL for GraphQL.
Stars: ✭ 124 (-29.55%)
Mutual labels:  codegen

⚠ Maintaner needed ⚠

An alternative solution based on swr and gql-request can be found here

graphql-codegen-apollo-next-ssr

Generate apollo code for nextjs ssr

Motivations

Nextjs recently introduced getServerSideProps which doesn't allow to use the HOC pattern adopted by the official apollo graphql plugin (based on getInitialProps). At the same time the SSR method offered by apollo client (getDataFromTree ) enforces the react app to render multiple times in order to collect and fetch all the relevant queries. By declaring a top level query we can save rendering time and provide a simpler pattern which works with getServerSideProps . This plugin generates a typesafe version of getServerSideProps for each server query, and the corresponding HOC to wrap the react component returning the cache result. The limitation/advantage of this solution is that all the queries embedded into inner react components are ignored, unless covered by the top level cache.

Configuration

  • excludePatterns (default: null): regexp to exclude operation names
  • excludePatternsOptions (default: ''): regexp flags to exclude operation names
  • reactApolloVersion (default: 2): apollo client version
  • apolloCacheImportFrom (default: apollo-cache-inmemory): apollo-cache-inmemory dependency
  • apolloImportFrom (default: apollo-client v2 or @apollo/client v3): apollo client dependency
  • apolloCacheImportFrom (default: apollo-cache-inmemory v2 or @apollo/client v3): apollo cache client dependency
  • apolloStateKey (default: apolloState): Key used for storing Apollo state
  • withHooks (default: false): Customized the output by enabling/disabling the generated React Hooks.
  • withHOC (default: true): Customized the output by enabling/disabling the HOC.
  • customImports (default: ''): full custom import declaration
  • contextType (default: 'any'): Contex type passed to getApolloClient
  • contextTypeRequired (default: false): If the context should be required when called from getServerSideProps
  • pre (default: ''): custom code before each function
  • post (default: ''): custom code after each function
  • apolloClientInstanceImport(default: ''): Add apolloClient instance imports
  • replaceQuery (default: false): Replace "query" keyword inside the generated operations
  • replacePage (default: false): Replace "page" keyword inside the generated operations
  • reactImport (default: import type React from 'react';): custom react import

Example config

overwrite: true
schema:
    - 'https://myschema/graphql'
documents:
    - 'src/**/*.graphql'
generates:
    src/@types/codegen/graphql.tsx:
        plugins:
            - 'typescript'
            - 'typescript-operations'
            - 'typescript-react-apollo'
    src/@types/codegen/page.tsx:
        config:
            documentMode: external
            importDocumentNodeExternallyFrom: ./graphql
        preset: import-types
        presetConfig:
            typesPath: ./graphql
        plugins:
            - ./build/src/index.js
hooks:
    afterAllFileWrite:
        - prettier --write

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].