A comprehensive guide and working examples of REST and gRPC API implementations across 33 programming languages.
This repository contains the complete source code and manuscript for the book "REST APIs and gRPC in 33 Languages: A Polyglot's Guide to Modern API Creation, Implementation, and Usage" by David Christian Liedle.
The project demonstrates how to implement the same Task Management API using both REST and gRPC protocols in 33 different programming languages, providing a unique comparative perspective on API development across the modern programming landscape.
REST-gRPC-in-33-Languages/
├── book/ # Book manuscript and documentation
│ ├── manuscript/ # Chapter content in Markdown
│ │ ├── frontmatter/ # Foreword, preface, acknowledgments
│ │ ├── chapters/ # 33 language chapters
│ │ └── appendices/ # Installation guides, tools, etc.
│ └── resources/ # Images, diagrams, references
├── code/ # Working code examples
│ ├── shared/ # Shared protocol definitions
│ │ ├── protos/ # Protocol Buffer definitions
│ │ └── openapi.yaml # OpenAPI 3.0 specification
│ └── [language]/ # Per-language implementations
│ ├── rest/ # REST API implementation
│ │ ├── server/
│ │ └── client/
│ └── grpc/ # gRPC implementation
│ ├── server/
│ └── client/
└── LICENSE
All implementations provide the same Task Management API functionality:
GET /tasks- List all tasks with filtering and paginationGET /tasks/{id}- Get a specific taskPOST /tasks- Create a new taskPUT /tasks/{id}- Update a taskPATCH /tasks/{id}/status- Update task statusDELETE /tasks/{id}- Delete a task
ListTasks- Server streaming: list tasks with filtersGetTask- Unary: get a single taskCreateTask- Unary: create a new taskUpdateTask- Unary: update an existing taskDeleteTask- Unary: delete a taskWatchTasks- Bidirectional streaming: real-time task updates
✅ JavaScript (Node.js with Express and gRPC)
✅ TypeScript (Deno with Oak and gRPC)
✅ Dart (Shelf framework and gRPC)
✅ Go (Gin and native gRPC)
✅ Ruby (Sinatra and gRPC gem)
✅ PHP (Slim Framework and gRPC)
✅ Python (FastAPI and grpcio)
✅ Java (Spring Boot and gRPC)
✅ Rust (Actix-web and Tonic)
✅ Kotlin (Ktor and gRPC)
✅ Swift (Vapor and gRPC-Swift)
✅ C# (ASP.NET Core and gRPC)
✅ F# (Giraffe and gRPC on .NET)
✅ C++ (Crow and gRPC++)
✅ Scala (Akka HTTP and ScalaPB)
✅ Objective-C (GCDWebServer and gRPC-ObjC)
✅ Elixir (Phoenix and grpc-elixir)
✅ Clojure (Ring/Compojure and Protojure)
✅ Erlang (Cowboy and grpcbox)
✅ Haskell (Servant and grpc-haskell)
✅ Crystal (Kemal - gRPC alternatives discussed)
✅ Perl (Mojolicious - Grpc::XS documented)
✅ Lua (OpenResty - lua-grpc limitations shown)
✅ R (Plumber - grpc package examples)
✅ D (Vibe.d - gRPC binding challenges explained)
✅ C (Custom HTTP server - gRPC requires C++)
✅ Zig (Built-in HTTP - awaiting gRPC ecosystem)
✅ OCaml (Dream - ocaml-grpc immature)
✅ Nim (Jester - no production gRPC)
✅ Julia (HTTP.jl - gRPC.jl experimental)
✅ Gleam (Mist - too new for gRPC)
✅ V (vweb - young language, no gRPC)
✅ Io (Socket-based - niche language, gRPC infeasible)
- Docker (recommended for consistent environments)
- Or native development tools for each language
# Clone the repository
git clone https://github.com/cloudstreet-dev/REST-gRPC-in-33-Languages.git
cd REST-gRPC-in-33-Languages
# Start JavaScript REST server
cd code/javascript/rest/server
npm install
npm start
# In another terminal, start gRPC server
cd code/javascript/grpc/server
npm install
npm start
# Test with clients
cd code/javascript/rest/client
node client.js
cd code/javascript/grpc/client
node client.jsEach language implementation includes a Dockerfile:
cd code/javascript
docker build -t task-api-js .
docker run -p 8080:8080 -p 50051:50051 task-api-js- Introduction to REST and gRPC
- Protocol Buffers vs JSON
- API Design Principles
- The Task Management Domain
33 chapters, each covering:
- Language overview and philosophy
- REST API implementation
- gRPC implementation
- Performance comparisons
- Best practices and patterns
- Quick reference guide
- Installation guides for all languages
- Development environment setup
- API testing tools
- Enterprise considerations
- Framework comparisons
Each implementation showcases:
- RESTful resource design
- HTTP status codes
- Request/response headers
- Content negotiation
- CORS handling
- Authentication patterns
- Error handling
- Pagination
- Filtering and sorting
- Protocol Buffer definitions
- Unary RPC calls
- Server streaming
- Client streaming
- Bidirectional streaming
- Error handling with status codes
- Metadata handling
- Interceptors/middleware
- Load balancing patterns
Each chapter includes benchmarks comparing:
- Latency (REST vs gRPC)
- Throughput
- Payload size
- CPU usage
- Memory consumption
- Streaming performance
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Areas where help is needed:
- Additional language implementations
- Performance optimizations
- Security enhancements
- Documentation improvements
- Test coverage
- Docker optimizations
David Christian Liedle
- Email: [email protected]
- GitHub: @davidliedle
With AI Co-authorship by Claude (Anthropic)
This book represents a collaboration between human expertise and AI assistance, with Claude helping to implement code examples, write documentation, and ensure consistency across all 33 language implementations.
This project is licensed under the MIT License - see the LICENSE file for details.
- The open-source community for the amazing tools and libraries
- My children, Tegan and Solomon, for their patience and inspiration
- All who have supported this ambitious project
Version 1.0.0 Complete! 🎉
All 33 language implementations are complete with comprehensive REST API examples and gRPC implementations or documentation where applicable.
- Project structure and shared specifications
- All 33 programming language implementations
- REST API implementation for all languages
- gRPC implementation for 22 languages with mature support
- gRPC considerations documented for 11 languages with limitations
- Complete manuscript with all 33 chapters
- Comprehensive documentation and code examples
- Performance comparisons and best practices
- Tagged v1.0.0 release
- Additional shell/scripting language supplements
- Enhanced performance benchmarks
- Video tutorials and walkthroughs
- Interactive online playground
- Community contributions and optimizations
- Publisher review for print edition
- Translations to other languages
For questions, issues, or discussions:
- Open an issue on GitHub
- Email the author
- Join the discussion in the repository's Discussions tab
"The best way to learn is to teach, and the best code is written to meet one's own needs."
This book is a labor of love, created to be the reference I wish I had on my desk.