gRPC vs GraphQL vs REST? What's the best API Technology for Golang?



gRPC vs GraphQL vs REST? What's the best API Technology for Golang?

gRPC vs GraphQL vs REST? What's the best API Technology for Golang?

gRPC? GraphQL? REST? What is the best API Technology for Go/Golang? What tools are available for implementing them?

In this video I cover the key differences between these three popular API technologies, introducing you to them, sharing with you the pros and cons and giving you my opinion regarding what’s the best API Technology to use depending on the use case, also with some example of tools to use in Go/Golang.

== What is REST?

REST is an acronym for REpresentational State Transfer coined by Roy Fielding and introduced in his doctoral dissertation, it is an architectural style that defines guidelines when building web services, it’s not a standard but it does use standards like HTTP (and its verbs to represent actions) and payload/message formats (like JSON or XML), to mention a few.

==== Pros
■ Easy to implement and use
■ Mature, literally all programming languages allow you to implement and build REST APIs

==== Cons
■ Overfetching, indicates responses include data that is not needed by the customer
■ Underfetching, indicates the need to call multiple resources to get all the needed data

==== Tools
■ https://github.com/goadesign/goa
■ https://github.com/go-swagger/go-swagger
■ https://github.com/deepmap/oapi-codegen

== What is GraphQL?

GraphQL is an open-source data query and manipulation language for APIs, and a runtime for fulfilling queries with existing data.

==== Pros
■ No overfetching, every field is explicitly indicated.
■ Strongly Typed

==== Cons
■ Complex Backend Querying, because all the querying logic is shifting to the Backend
■ Caching is more difficult

== What is gRPC?

gRPC is an efficient open source remote procedure call (RPC) that generates cross-platform client and server bindings defined in Protocol Buffers.

==== Pros
■ Includes tools for code generation
■ Highly performant

==== Cons
■ Harder to implement
■ There’s no (default) browser support

== When to use REST, GraphQL or gRPC?
My recommendations are:
■ Use REST when building an API that has a though deadline and where the domain can be easily mapped to resources
■ Use GraphQL when building an API that is heavy on querying resources or when payload performance is needed
■ Use gRPC when building Backend APIs with high throughput and concrete requirements.

== Relevant links

■ Software Architecture and System Design in Go/Golang: https://www.youtube.com/playlist?list=PL7yAAGMOat_GCd12Lrv_evJ3Zhv1dl8B-

== All Go/Golang Playlists

■ Building Microservices in Go/Golang: https://www.youtube.com/playlist?list=PL7yAAGMOat_Fn8sAXIk0WyBfK_sT1pohu
■ Go/Golang Tools and Packages: https://www.youtube.com/playlist?list=PL7yAAGMOat_HEEOvH99agDs_5g51A0Ls3
■ Learning Concurrency Patterns in Go/Golang: https://www.youtube.com/playlist?list=PL7yAAGMOat_Fhj_px_DzNzTsXs-mRwv1t
■ Learning Go/Golang : https://www.youtube.com/playlist?list=PL7yAAGMOat_F7bOImcjx4ZnCtfyNEqzCy
■ Learning Relational Databases in Go/Golang: https://www.youtube.com/playlist?list=PL7yAAGMOat_EgwoQTvNUflrYL_4qzdB7f
■ Testing in Go/Golang: https://www.youtube.com/playlist?list=PL7yAAGMOat_HSeW4zF0uRL9EaHadE4ZZq

== Socials

■ https://twitter.com/MarioCarrion
■ https://www.instagram.com/mario.carrion
■ https://linkedin.com/in/MarioCarrion

00:00 – Start
00:12 – What is Data Exchange?
00:35 – REST: Data Exchange, Pros and Cons
04:32 – GraphSQL: Data Exchange, Pros and Cons
07:12 – gRPC: Data Exchange, Pros and Cons
10:25 – What is the best API Technology?

=== Who am I?

Hello👋🏼! I’m Mario, a Hands-on Software Architect and Lead Backend Engineer with more than 16 years of professional experience building all kinds of software including on-premise Industrial Automation Systems, Linux Accessibility Desktop and Browser Components as well as Distributed Advertising Microservices.

Every week I will share with you different topics I’ve learned while working for small startups and large companies including the processes I’ve followed over the years for successfully delivering complex enterprise systems from start to end.

Subscribe if you like Software Development, Software Architecture and System Design!

Keep it up. Don’t give up!

#golang #softwarearchitecture #systemdesign

=== Our Vlog Channel

https://www.youtube.com/c/RubyCarrion/videos

=== Affiliate links

■ Amazon Shop 🛒 https://www.amazon.com/shop/rubycarrion
■ Technical/Non-technical Books – Recommended by Mario Carrion 📚 https://www.amazon.com/shop/rubycarrion?listId=P8KAGIWTNH3X&ref=cm_sw_em_r_inf_list_own_rubycarrion_dp_dyqYP6yk67Hif

DISCLAIMER: Some of the links shared above are affiliate links. As a member of these affiliate programs, I earn a small commission from your purchases at no additional cost to you. Thank you in advance for your support!

Comments are closed.