The Diminishing API Layer

Rate this content
Bookmark

Apps are hard enough to build without having to worry about layers and layers that sit between your users and the database. In this talk we examine trends in serverless computing, and their impact on modern databases and API layers.

This talk has been presented at GraphQL Galaxy 2020, check out the latest edition of this Tech Conference.

FAQ

GraphQL serves as a higher-level API language that connects the backend with the data store, generating APIs from schemas and minimizing the need for boilerplate code.

The speaker is Tejas from dGraph Labs, working on slash GraphQL.

The main topic of the talk is the diminishing API layer and the evolving relationship between data and code in various programming paradigms.

The speaker shared that he and his partner had a baby girl in 2020.

The speaker mentions the concept of Homo-iconicity, which is the property of a programming language to express its code as data.

The speaker gives Oracle Forms as an example of a system where code and data are tightly coupled.

Tightly coupled systems were difficult to test, deploy, manage, and version, leading to a shift towards more decoupled architectures.

The era of boilerplate refers to a time when APIs were highly decoupled from databases, resulting in complex and difficult-to-manage layers of code and indirection.

Ruby on Rails and REST introduced a more predictable and manageable way to handle APIs, with Rails generating APIs and database schemas automatically based on migrations.

A backend is a system that contains both data and logic, is typically deployed in the cloud, and provides a no-code or low-code experience for developers.

Tejas Dinkar
Tejas Dinkar
30 min
02 Jul, 2021

Comments

Sign in or register to post your comment.

Video Summary and Transcription

The video discusses the diminishing API layer and how logic has shifted between databases and APIs over time. It touches upon the concept of Homo-iconicity, where code is expressed as data, and the rise of domain-specific languages. The speaker explains the challenges faced with tight coupling between code and data in early systems like Oracle Forms and how decoupling led to boilerplate code. The advantages of Rails and its ability to integrate code and database are highlighted, along with the role of GraphQL in automating boilerplate code generation. The video also covers the power of GraphQL directives, such as the auth directive and at lambda directive, for preprocessing and post-processing requests. Finally, the speaker emphasizes how tools like Firebase, Hasura, and Slash GraphQL facilitate the integration of data and logic, making development more efficient.
Available in Español: La Capa API en Disminución

1. Introduction

Short description:

Hi, everyone. My name is Tejas and I work on slash GraphQL at dGraph Labs. Today, I want to talk about the diminishing API layer and how we as a community move all that logic out of databases and then one day suddenly decided to move it all back in. 2020 has been a difficult year for everybody, but one good thing that's happened to me is my partner and I have just had a baby girl. As I read The Very Hungry Caterpillar, it gave me a lot of free time to think about philosophical questions about data and its relationship to logic and code.

Hi, everyone. My name is Tejas and I work on slash GraphQL at dGraph Labs. You can find me on Twitter at At T. Dinker.

Today, I want to talk about a little bit about something that's been interesting to me for a while and I'm calling this talk the diminishing API layer. However, I also had an alternate title for this talk and that was there and back again, or how we as a community move all that logic out of databases. And then one day suddenly decided to move it all back in.

So 2020 has been a pretty difficult year for everybody. It's been a global pandemic and things have been very hard. But one thing that's good that's happened to me is my partner and I have just had a baby girl. And so as I read The Very Hungry Caterpillar for probably the 4000th time this year, it gave me a lot of free time to get inside my head and think a lot about philosophical questions that really may not have any actual practical implications. And one thing I've been thinking a lot about these days is what is data? What actually do we mean when we talk about data and how is it different from logic or actual code?

2. Code and Data Coupling

Short description:

Clojure has the concept of Homo-iconicity, allowing code to be expressed as data. Domain-specific languages have also blurred the line between data and code. This raises the question of whether code should be stored in databases. Early examples of tight coupling between code and data, like Oracle Forms, led to difficulties in testing, deploying, and managing systems. This led to the era of boilerplate, where APIs were decoupled from databases. Unit tests would mock databases, and code would be developed against interfaces like iRepository.

And Clojure has this concept of Homo-iconicity, right? And Homo-iconicity is the property of a programming language to be able to express your code as data, right? So in Clojure, you can actually write a macro, which basically accepts actual code, and you can process it with the same sort of data structures that you would process your regular data with. And even outside of programming languages like Clojure, domain-specific languages have become very popular over the last, I don't know, 10 or 15 years.

And domain-specific languages are simply purpose-built languages where you have various rules which are code, sort of written in some format, and then they're interpreted by whoever's parsing that domain-specific language. So once again, we see over here as well, you really have this distinction between data and code blurring significantly. So this sort of leads me to the next question, that is, if code is data, then is there a difference between your code data versus your data data? And if not, should your code actually be in your database?

So the first time I ever sort of came across something like this, where you're very closely coupling your code and your data, was this where sort of something I worked on very early in my career in the late 2000s. And my first experience with something like this was with Oracle Forms. So Oracle Forms is a great example of a very tight coupling between data and your code. And it's not so popular today for various reasons. But back then, Oracle would give you the database. It would give you the language that you would build these tools with. Your inputs would typically be drag-and-drop pages that you've built. And then you operate on them with PLSQL, and you shove it into your database, and then you finally query it out with views and SQL.

So in essence, your code and your data was together one single unit that would be deployed to various places. And it's not that Oracle Forms was the only one who was doing this by any means. There's many of these other things, like for example, FoxPro, for example, comes to mind. And even the systems that had a separate code layer, you would still very often rely on very database-specific features, like triggers and procedures. And this did work. You would have very large systems that are built out with these tools. And they were reasonably easy when you were first building them. But people realized pretty quickly that this was very tough to test. It was hard to deploy, because you'd often be just rewriting a stored procedure in your database. And it was tough to manage. It was impossible to version. There was just so many stuff that needed to happen. And I feel this sort of tight coupling led to everyone going in the exact opposite direction for a long time. And we sort of entered what I'm calling the era of boilerplate. Right?

So in the era of boilerplate, you'd have a bunch of APIs, and just without calling out any specific language, you know, maybe that would be like a Data Bean factory factory implementation. And these APIs would be very decoupled from your actual database. In fact, you would go so far as to be very proud of the fact that unit tests would have your database and stuff mocked. Instead of writing against an actual database, your code would be developed and deployed against the iRepository fit interface, which, you know, you expect the repository to be sort of implemented.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

From GraphQL Zero to GraphQL Hero with RedwoodJS
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
From GraphQL Zero to GraphQL Hero with RedwoodJS
Top Content
Tom Pressenwurter introduces Redwood.js, a full stack app framework for building GraphQL APIs easily and maintainably. He demonstrates a Redwood.js application with a React-based front end and a Node.js API. Redwood.js offers a simplified folder structure and schema for organizing the application. It provides easy data manipulation and CRUD operations through GraphQL functions. Redwood.js allows for easy implementation of new queries and directives, including authentication and limiting access to data. It is a stable and production-ready framework that integrates well with other front-end technologies.
Local State and Server Cache: Finding a Balance
Vue.js London Live 2021Vue.js London Live 2021
24 min
Local State and Server Cache: Finding a Balance
Top Content
This Talk discusses handling local state in software development, particularly when dealing with asynchronous behavior and API requests. It explores the challenges of managing global state and the need for actions when handling server data. The Talk also highlights the issue of fetching data not in Vuex and the challenges of keeping data up-to-date in Vuex. It mentions alternative tools like Apollo Client and React Query for handling local state. The Talk concludes with a discussion on GitLab going public and the celebration that followed.
Get rid of your API schemas with tRPC
React Day Berlin 2022React Day Berlin 2022
29 min
Get rid of your API schemas with tRPC
Today's Talk introduces TRPC, a library that eliminates the need for code generation and provides type safety and better collaboration between front-end and back-end. TRPC is demonstrated in a Next JS application integrated with Prisma, allowing for easy implementation and interaction with the database. The library allows for seamless usage in the client, with automatic procedure renaming and the ability to call methods without generating types. TRPC's client-server interaction is based on HTTP requests and allows for easy debugging and tracing. The library also provides runtime type check and validation using Zod.
Batteries Included Reimagined - The Revival of GraphQL Yoga
GraphQL Galaxy 2021GraphQL Galaxy 2021
33 min
Batteries Included Reimagined - The Revival of GraphQL Yoga
Envelope is a powerful GraphQL plugin system that simplifies server development and allows for powerful plugin integration. It provides conformity for large corporations with multiple GraphQL servers and can be used with various frameworks. Envelope acts as the Babel of GraphQL, allowing the use of non-spec features. The Guild offers GraphQL Hive, a service similar to Apollo Studio, and encourages collaboration with other frameworks and languages.
Rock Solid React and GraphQL Apps for People in a Hurry
GraphQL Galaxy 2022GraphQL Galaxy 2022
29 min
Rock Solid React and GraphQL Apps for People in a Hurry
The Talk discusses the challenges and advancements in using GraphQL and React together. It introduces RedwoodJS, a framework that simplifies frontend-backend integration and provides features like code generation, scaffolding, and authentication. The Talk demonstrates how to set up a Redwood project, generate layouts and models, and perform CRUD operations. Redwood automates many GraphQL parts and provides an easy way for developers to get started with GraphQL. It also highlights the benefits of Redwood and suggests checking out RedwoodJS.com for more information.
Adopting GraphQL in an Enterprise
GraphQL Galaxy 2021GraphQL Galaxy 2021
32 min
Adopting GraphQL in an Enterprise
Today's Talk is about adopting GraphQL in an enterprise. It discusses the challenges of using REST APIs and the benefits of GraphQL. The Talk explores different approaches to adopting GraphQL, including coexistence with REST APIs. It emphasizes the power of GraphQL and provides tips for successful adoption. Overall, the Talk highlights the advantages of GraphQL in terms of efficiency, collaboration, and control over APIs.

Workshops on related topic

Build with SvelteKit and GraphQL
GraphQL Galaxy 2021GraphQL Galaxy 2021
140 min
Build with SvelteKit and GraphQL
Top Content
Featured WorkshopFree
Scott Spence
Scott Spence
Have you ever thought about building something that doesn't require a lot of boilerplate with a tiny bundle size? In this workshop, Scott Spence will go from hello world to covering routing and using endpoints in SvelteKit. You'll set up a backend GraphQL API then use GraphQL queries with SvelteKit to display the GraphQL API data. You'll build a fast secure project that uses SvelteKit's features, then deploy it as a fully static site. This course is for the Svelte curious who haven't had extensive experience with SvelteKit and want a deeper understanding of how to use it in practical applications.

Table of contents:
- Kick-off and Svelte introduction
- Initialise frontend project
- Tour of the SvelteKit skeleton project
- Configure backend project
- Query Data with GraphQL
- Fetching data to the frontend with GraphQL
- Styling
- Svelte directives
- Routing in SvelteKit
- Endpoints in SvelteKit
- Deploying to Netlify
- Navigation
- Mutations in GraphCMS
- Sending GraphQL Mutations via SvelteKit
- Q&A
Build Modern Applications Using GraphQL and Javascript
Node Congress 2024Node Congress 2024
152 min
Build Modern Applications Using GraphQL and Javascript
Featured Workshop
Emanuel Scirlet
Miguel Henriques
2 authors
Come and learn how you can supercharge your modern and secure applications using GraphQL and Javascript. In this workshop we will build a GraphQL API and we will demonstrate the benefits of the query language for APIs and what use cases that are fit for it. Basic Javascript knowledge required.
End-To-End Type Safety with React, GraphQL & Prisma
React Advanced Conference 2022React Advanced Conference 2022
95 min
End-To-End Type Safety with React, GraphQL & Prisma
Featured WorkshopFree
Sabin Adams
Sabin Adams
In this workshop, you will get a first-hand look at what end-to-end type safety is and why it is important. To accomplish this, you’ll be building a GraphQL API using modern, relevant tools which will be consumed by a React client.
Prerequisites: - Node.js installed on your machine (12.2.X / 14.X)- It is recommended (but not required) to use VS Code for the practical tasks- An IDE installed (VSCode recommended)- (Good to have)*A basic understanding of Node.js, React, and TypeScript
GraphQL for React Developers
GraphQL Galaxy 2022GraphQL Galaxy 2022
112 min
GraphQL for React Developers
Featured Workshop
Roy Derks
Roy Derks
There are many advantages to using GraphQL as a datasource for frontend development, compared to REST APIs. We developers in example need to write a lot of imperative code to retrieve data to display in our applications and handle state. With GraphQL you cannot only decrease the amount of code needed around data fetching and state-management you'll also get increased flexibility, better performance and most of all an improved developer experience. In this workshop you'll learn how GraphQL can improve your work as a frontend developer and how to handle GraphQL in your frontend React application.
Build a Headless WordPress App with Next.js and WPGraphQL
React Summit 2022React Summit 2022
173 min
Build a Headless WordPress App with Next.js and WPGraphQL
Top Content
WorkshopFree
Kellen Mace
Kellen Mace
In this workshop, you’ll learn how to build a Next.js app that uses Apollo Client to fetch data from a headless WordPress backend and use it to render the pages of your app. You’ll learn when you should consider a headless WordPress architecture, how to turn a WordPress backend into a GraphQL server, how to compose queries using the GraphiQL IDE, how to colocate GraphQL fragments with your components, and more.
Relational Database Modeling for GraphQL
GraphQL Galaxy 2020GraphQL Galaxy 2020
106 min
Relational Database Modeling for GraphQL
Top Content
WorkshopFree
Adron Hall
Adron Hall
In this workshop we'll dig deeper into data modeling. We'll start with a discussion about various database types and how they map to GraphQL. Once that groundwork is laid out, the focus will shift to specific types of databases and how to build data models that work best for GraphQL within various scenarios.
Table of contentsPart 1 - Hour 1      a. Relational Database Data Modeling      b. Comparing Relational and NoSQL Databases      c. GraphQL with the Database in mindPart 2 - Hour 2      a. Designing Relational Data Models      b. Relationship, Building MultijoinsTables      c. GraphQL & Relational Data Modeling Query Complexities
Prerequisites      a. Data modeling tool. The trainer will be using dbdiagram      b. Postgres, albeit no need to install this locally, as I'll be using a Postgres Dicker image, from Docker Hub for all examples      c. Hasura