DEV Community

Cover image for BaseQL - create a GraphQL API from your Airtable backend
Tomek Poniatowicz for GraphQL Editor

Posted on • Edited on • Originally published at blog.graphqleditor.com

BaseQL - create a GraphQL API from your Airtable backend

After writing about some of the biggest libraries out there I think it's time to look at one that hasn't been covered as much, namely BaseQL. If we look at its website it says BaseQL lets you quickly create a GraphQL API from your production ready Airtable backend. In short it combines the benefits of Airtable with GraphQL. I’m going to boldly assume that if you’re here you already know a bit about GraphQL so let’s first look at what Airtable is.

Why Airtable?

To put it simple Airtable is a flexible service which lets you easily create relational datasets. It's like a hybrid of a spreadsheet and a database, you have cells but they can have types like checkbox or drop-down list and can have file attachments, for example images, which can be previewed. Everything is neatly compartmentalized:

  • workspace: an assortment of bases shared among a group of people
  • base: a database with everything you need for the project. You can build it using the customizable templates provided by Airtable, use an existing spreadsheet or database or just make one from scratch.
  • table: bases consist of one or more tables and tables contain all the information, think of them as spreadsheets but with additional useful features. They can be everything, a sales spreadsheet, a products catalogue or a calendar, really just anything you need.
  • fields: each entry in a table is a field, they provide more versatility than your usual spreadsheet, they’re customizable and there’s a lot of them to choose from: checkboxes, drop down lists, file attachments, URLs and a lot more.

While there are both more complex programs for database handling (like FileMaker Pro) and simpler services, better suited for casual use (like Google Sheets) Airtable is the closest to a catch all solution that will work best in most cases. Now if you want to use that solution it could be prudent to combine its benefits with those of GraphQL and luckily there’s just the thing for that.

All you need to do is a way to access the data stored in Airtable and that's what BaseQL was designed for.

Alt Text

Source: Airtable.com

BaseQL

BaseQL gives you a dynamic GraphQL API for your Airtable bases. This means you will be instantly able to query, search and mutate data from your Airtable bases using GraphQL and all its benefits. The key one being optimization as with GraphQL you get exactly what you wanted and just that, with no over or under fetching. Yes, unlike Airtable you’ll need to know the basics of GraphQL, but you’ll likely find it quite easy to get a hang of and BaseQL even provides you with a playground to test it out on their website. It also does not disturb anyone else in the workgroup who can just continue working on Airtable as usual while you get the data you need. The features are quite simple:

  • Advanced GraphiQL Explorer: it will let you easily browse through the documentation and find exactly the queries you need and build complex ones by selecting them from a panel. It's really useful as a learning experience so if getting a hang of GraphQL sounded hard you’ll want to check this out.

  • Data fetching: BaseQL provides you with a lot of tools for querying, filtering, searching and sorting data from your Airtable bases and since it uses GraphQL to do so it's all kept efficient. It also supports nested queries, combining multiple arguments in a single query as well as mutations and pagination.

  • Integrations: the real value is not in querying data yourself but using another app for that and BaseQL does just that. It can be integrated with any frontend framework or no-code tool which gives you a ton of possibilities.

To start you need to install the BaseQL app via Airtable Marketplace (required Airtable PRO) or using Custom Blocks feature.

fetch('https://api.baseql.com/airtable/graphql/appuzDcQEvfnkzXjD', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Accept': 'application/json',
    'Authorization': 'Bearer SECRET_TOKEN',
  },
  body: JSON.stringify({query: "{ people: { name } }"})
})
  .then(r => r.json())
  .then(data => console.log('data returned:', data));
Enter fullscreen mode Exit fullscreen mode
Source: docs.baseql.com

Jack of all trades

To summarize Airtable with GraphQL makes for a pretty powerful combination. On the database side you can have anyone work on it and it requires no knowledge of programming at all. On the other side you can focus on building your app knowing that it will be able to fetch data efficiently via BaseQL from your Airtable bases. It gives you a lot of flexibility especially working in a group with different skills and it's also a great way to start getting into GraphQL if you want to do so. As mentioned before it's not perfect, but as far as working with databases goes it's definitely worth a try.


A guest blog post for GraphQL Editor blog by Michał Tyszkiewicz


Speed up your GraphQL API development

GraphQL Editor is a supportive tool for both advanced GraphQL users as well as those taking their first steps with GraphQL APIs. Our all-in-one development environment for GraphQL will help you build, manage & deploy your GraphQL API much faster. Try GraphQL Editor for free!

New features of GraphQL Editor gif

Top comments (0)