How to use GraphQL

How to use and implement Graphql in webiny. Documentation is not enough to understand. Need some examples with implementation.

1 Like

Hi @Teja, working on a scaffolding feature as we speak ( Please hold on, we realize this is a pain point for our users, so we are eager to release this ASAP.

While you wait, just a brief explanation.

Basically, you want to register a set of plugins. A good example is the existing “security” GraphQL service (crossed irrelevant files):


So, in your /api folder, create a new folder which will contain plugins organized like in the screenshot, and once you’re done, open your serverless.yml, and add a new entry in it. A good example is the i18n service:

  component: "@webiny/serverless-apollo-service"
    region: ${vars.region}
    memory: 512
    debug: ${vars.debug}
    webpackConfig: ./webpack.config.js
      - factory: "@webiny/api-plugin-create-apollo-handler"
        options: ${vars.apollo}
      - factory: "@webiny/api-plugin-commodo-db-proxy"
          functionArn: ${dbProxy.arn}
      - factory: "@webiny/api-security/plugins/service"
        options: ${}
      - "your-plugin-here" // <=============== reference your index.js that gather all plugins you've created

This is a brief overview. You can start playing with it and ask questions along the way.

I can also notify you once the scaffolding feature is released if you’d like.

How front end and back end can be connected? How to implement back end? Can you please explain in step wise clearly. How commodo data models can be connected to front end? How to check data models they are working or not?

1 Like

I understand your position @Teja.

The code I linked above shows how to create a GQL service, that consists of models, and a GraphQL schema - all defined via plugins.

The models (folder models) contains Commodo models, which help you connect your code with the database data and work with it. Check the introduction and crash-course pages to get yourself familiarized with the Commodo lib.

These models are exposed to the frontend app via the GraphQL schema, which you also define in your service (folder graphql).

How does the schema you create fit into the bigger picture? The schema you create is a federated schema, meaning it’s a part of a much larger schema, that will be constructed on the Apollo Gateway. Take a look at how it all works together here.

To understand how your apps and API are connected, you can also check out the resources article.

Note that, there is no local API development, but only local React app development, which is based on the popular CRA. Please take a look at our Cloud Native Development principles. This will give you an overview of how development is generally done.

As mentioned, the CLI scaffolding and the hello-world docs are our current top-priorities. I can notify you as soon as these are up if you want, to get a more step-by-step guide on how to achieve all of these fundamental tasks.

Let me know your thoughts when you get a chance.


I have done all of them mentioned above. Can you please tell me what to do next?

Hi Teja,

can we jump on a call maybe so you could show me the current state of your project?

I think it’ll be faster.

If you’re interested, let me know what time would be good for you. Thanks!

P.S.: You can also find us on Gitter.

I am ready to talk right now. Thanks

Hi Teja, can you ping me privately on Gitter?

My username is @doitadrian.

Hi @doitadrian, May I know the status of Scaffolding CLI documentation?
and also are you using in your project?

Hi @Teja,

Sorry I didn’t give you an update yet.

We’re working on this as fast as possible. Believe me, we are aware that it’s something our users desperately need.

Unfortunately, it will still require some time because a few significant DX issues were discovered along the way, and we want to resolve these before releasing the whole scaffolding feature.

The only thing I can offer you right now is just to remain patient for a bit.

Don’t worry, as soon this is released, I will update you.

If you have any other questions, feel free to ask.

Thanks again for your time and patience!


P.S. Checked the lib, looks interesting. For now, we’ll stick with the regular JSON payloads since it’s a standard practice. But who knows, if the community expresses the desire to move away from it, we might be giving this a look. Thanks for the suggestion.

Hi @Adrian_Smijulj, May I know the status of the documentation please?

@Teja we’re working on an improved setup for API services, and a much better build system so we will not be documenting our current setup. New documentation will be available once we release our Headless CMS, because that release will also include all the setup improvements.

Sorry for the wait, but we’re doing our best. Judging by the current state of things, you will love the setup we’re working on. It will be much more straightforward and easier to customize.

Stay tuned! :rocket: :heart:

Hi @Teja,

just wanted to add that I have you already on my who-to-contact list, so you will be updated as soon as we release this.

Thanks again!