FOSS4G 2024 Workshop

Creating a GraphQL API with Postgis
12-03, 09:00–13:00 (America/Belem), Room Açaí (C Block)

The goal of this workshop is to explain on a hands-on demo what GraphQL is all about using a spatial database. While showing GraphQL features (including spatial features) we’ll demonstrate how they can be perfectly implemented on top of an existing PostgreSQL/PostGIS spatial database. We’ll discuss pros and cons of this technology over REST, highlighting a few important points in which they differ.

During the workshop we will:

  • Learn how to use, create and manage a fully spatial GraphQL API using PostGraphile and a common, existing PostgreSQL/PostGIS spatial database;
  • Publish spatial and non-spatial data;
  • Create processing/analysis endpoints that rely on PostgreSQL/PostGIS functions;
  • Secure the data with Row-Level Security (RLS) set at the database level and transpose those credentials to the API in a straightforward way. Users can then make use of JWT tokens to authenticate.
  • Extend the GraphQL API using plugins that can be used to create complex endpoints that need to be created at the server level with NodeJs and Javascript or Typescript.

This workshop will be publicly hosted in GitHub. Using guided steps, we’ll start by exploring the basics of GraphQL. Then, we'll create and configure one existing spatial database using PostGIS. From that point onwards we will slowly increase the complexity and learn step by step how to create and configure a GraphQL API.

The workshop will take 4 hours and requires no previous knowledge of GraphQL. However, It is advisable to have basic knowledge in PostgreSQL and PostGIS.