GraphQL

About GraphQL

8min
although it can feel like a big leap at first, using custom graphql gives you ultimate control over dynamic data we'll guide you through introduction firstly, let's go through a few frequently asked questions about graphql in the next article, we'll then get started on our first query on a new starter site what is it? graphql is an open source querying language which was originally developed by facebook the general idea was to create a language which allowed developers to quickly develop flexible requests for data, while being efficient and only asking for exactly the data they needed the structure of the query, including relationships between different tables, matches the structure of results making it easy to iterate over the data after the query is complete you can read about the open source project on their website here https //graphql org/ how does siteglide use graphql? it's worth noting that you don't need to learn graphql to use siteglide's core features most of the time, siteglide does the querying for you however, learning graphql will allow your agency to take on more challenging projects see the next question although the language is open source, actual implementations of it can be quite different across platforms this is because a graphql implementation has two parts the schema this defines different types of query you can use, which parameters you can add, and what sort of output you can request it reflects, in part, the database structure that the platform uses, so it varies from platform to platform siteglide runs on platformos and we use platformos's implementation of graphql the query language this is the syntax for writing queries it is exactly the same across platforms, but can feel very different when the schema is different if you've used graphql before with a different schema, you will start to see lots of similarities how do liquid and graphql work together? liquid is a templating language; graphql is a query language to put it another way, think of graphql as a re usable question liquid will both ask the question and listen to the answer, using it to build a dynamic website the question itself is in a different language graphql graphql files are stored inside the marketplace builder folder they can be called by liquid and re used as many times as you like how can i learn graphql? graphql can be tricky to get started with, but most of our developers report that at a certain stage, it just 'clicks' for them we want to help any agency who wants to learn to get there we'll provide a series of tutorials, starting off simple and becoming progressively more challenging as part of this, we'll aim to give you the skills you need to carry out further learning yourself often this will mean learning to read the platformos schema finding the type of query you need, and experimenting with how to make it work every time we add a new graphql tutorial, you'll be able to access increased support on that topic via the forum you can see an overview of the topics we've covered so far here in the next tutorial, we'll show you how to use the graphql sandbox to test out queries let's go i'm stuck can you help me build a site with custom graphql? we want to give you all the tools you need to learn graphql and we'll give our general tips, tricks and links to help you solve problems unfortunately, siteglide support can't build a custom page for you or assist with custom graphql questions we want to stick to providing first class support on the core product if you're stuck, here are some things you can try help us improve our general documentation on graphql we'll keep adding and improving on our articles see the "did this page help you" buttons at the bottom of each developer docs page ask the community on discord we have an ever growing community of developers from around the globe, join the discussion siteglide's custom support partner, sitegurus, can provide developers who are experts in using graphql with siteglide create a task with sitegurus maybe this particular solution isn't suited to custom graphql, maybe it's better as an official feature? you can request features on the roadmap when should i use custom graphql? writing graphql queries gives you ultimate control over your dynamic data now, for a small site, it's probably faster to use siteglide's pre built features to cover this for you here are some examples of where some custom graphql could open some doors for your agency we'll update this list with tutorials and suggestions in the future get any data from your siteglide instance reporting your client wants several bespoke, complex queries of data, all organised into tables and charts? graphql can help you be this flexible and if implemented well, can maintain page speed graphql works inside workflow and autoresponder emails with mutations, it can also send transactional notifications and api calls from anywhere in your site performance optimisation we do our best to make sure all siteglide features are delivered to you with the maximum flexibility and performance, but for very bespoke sites we couldn't possibly make the platform guess your priorities understanding graphql could help you optimise your most complex features for faster page load time, while using ready built features to save development time in other areas front end mutations use at your own risk! with mutations, you can change data in the database and trigger this with liquid this can make a lot of complex projects possible see the platformos graphql schema for a full list https //documentation platformos com/api reference/graphql/mutations update data without loading the page when changing page in webapp results, you currently have to wait for the page to reload using siteglide cli and graphql you can build an xhr endpoint to get updated data after the page has loaded (note you can do this with cli, without graphql graphql just gives you more flexibility ) jump ahead of the roadmap we're always updating our roadmap with new functionality and community requests but what if you have that one client that cannot wait? it'll take more time to develop and may not be as re usable as a fully tested official feature, but with graphql and liquid understanding, you've got the power to build your own solutions start learning now! our first tutorial will get you set up on the graphql playground/ sandbox which we make available through siteglide cli