Introduction to gRPC
gRPC is a modern framework that lets two programs talk to each other over a network — even if they are written in different programming languages. Google created it in 2015 and later open-sourced it. Today it powers millions of internal calls inside companies like Netflix, Dropbox, and Spotify.
The Problem gRPC Solves
Imagine your mobile app is written in Swift, your server is written in Java, and a separate reporting tool is written in Python. Each team writes its own way of sending and receiving data. Keeping these three pieces in sync wastes weeks every time something changes.
gRPC gives every team a single shared contract called a proto file. Anyone who has that file can generate working client and server code automatically — in over a dozen languages.
A Simple Real-World Analogy
Think of gRPC like a standardised electrical socket. Every country that adopts the same socket standard lets any appliance plug in anywhere. gRPC is the socket standard for software services.
┌─────────────────────────────────────────────────────────┐ │ gRPC Communication │ │ │ │ [Mobile App] ──────────────► [Server] │ │ (Swift) proto contract (Java / Python / Go) │ │ │ │ • Sends a Request Message │ │ • Receives a Response Message │ │ • Both sides use auto-generated code │ └─────────────────────────────────────────────────────────┘
What gRPC Stands For
The "g" in gRPC stands for Google (its creator). "RPC" stands for Remote Procedure Call. A remote procedure call means: call a function on another machine as if it were a local function on your own machine.
Local Call vs Remote Call
Local Call (same machine):
result = calculateTax(price)
Remote Call with gRPC (different machine, same syntax feel):
result = taxService.calculateTax(price)
▲
└── gRPC handles all the network complexity behind the scenes
Key Components of gRPC
Every gRPC system has three building blocks:
┌──────────────┐ ┌───────────────────┐ ┌──────────────┐
│ Proto File │───►│ Code Generator │───►│ Client Code │
│ (.proto) │ │ (protoc) │ │ Server Code │
└──────────────┘ └───────────────────┘ └──────────────┘
▲
│
Defines:
• Data structures (messages)
• Available functions (services)
• Request and response types
Proto File
A proto file is a plain text file that describes what data looks like and what functions are available. It acts as the contract between the client and the server.
Code Generator (protoc)
The protocol buffer compiler reads the proto file and generates ready-to-use code. You run it once, and it writes thousands of lines of boilerplate for you.
Generated Client and Server Code
The generated code handles serialisation (turning data into bytes), network connections, and error parsing. You only write the actual business logic.
Where gRPC Is Used
gRPC works best in three situations:
┌────────────────────────────────────────────────────┐ │ USE CASE 1: Microservices talking to each other │ │ OrderService ──► InventoryService ──► ShipService │ ├────────────────────────────────────────────────────┤ │ USE CASE 2: Mobile app to backend │ │ iOS App ──────────────────────► Go Backend │ ├────────────────────────────────────────────────────┤ │ USE CASE 3: Real-time data streaming │ │ Sensor Device ─── continuous stream ──► Dashboard │ └────────────────────────────────────────────────────┘
What gRPC Is Not
gRPC is not a database. It does not store data. It only transports data between programs. It also does not replace a message queue like Kafka — those systems are for situations where the sender and receiver do not need to be running at the same time.
Summary
gRPC is a contract-first communication framework. You define what data looks like and what operations are available in a proto file. A compiler generates code for both sides. Programs then call each other over a fast, secure network connection — regardless of the language each program is written in.
