Search code examples
amazon-web-servicesgraphqlaws-amplify

How to reuse existing schema and generate code for queries and mutation for existing AWS AppSync Graphql end point?


I have created graphql schema and api endpoint in one amplify project but now want to reuse that in separate javascript project. What is the flow of reusing this existing graphql endpoint and corresponding schema in second project to also generate mutations and queries in graphql folder in amplify project?


Solution

  • You can use a multi-frontend workflow for that.

    Check their documentation for more on how to use it.

    This post has a step by step guide.

    You have to:

    • Create a new Amplify project
    • Pull your app backend: amplify pull --appId ************* --envName *******
    • Choose "No" when asked if you gonna modify your backend

    The appId you can find on your Amplify Console.

    You are ready to go.