saurabh2836 / microservice-apis-with-python

Code repository for the book

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Microservice APIs

With Examples in Python

Author: Jose Haro Peralta

image image

Hello and welcome to the GitHub repository for my book Microservice APIs!

The book is conceived as a one-stop guide for learning how to design and build microservices and how to drive their integrations with APIs. There's a strong emphasis on best practices and applying principles and patterns that achieve loose coupling in your code. The book provides full examples of how to design and build a REST API and a GraphQL API.

In this repository, you'll find all the code examples used in the book.

  • You can download two chapters of the book for free from this link.
  • And you can get a 40% discount using the following code: slperalta.

There's complementary material for the book in my blog The Python Geek and in my YouTube channel. If you find my content useful, don't forget to subscribe, like, and share my content, as that helps me enormously to continue producing content.

This repository is structured around the book chapters. There's one folder per chapter. Each folder contains all the code you need to follow along with the examples for the corresponding chapter. Within each folder, you'll find a README file that explains what the chapter is about, the purpose of the code, and how to set it up and get it up and running.

Here's a brief outline of the book

Chapter 1: What are microservice web APIs?

It explains what microrservices architecture is and how it differs from other architectural styles. It also explains what an API is, and it discusses the challenges of building and operating microservice APIs. This chapter doesn't have code examples so it's not reflected in this repository.

Chapter 2: A basic API implementation

Jump straight into the action! This chapter provides an early peek into the kind of work we're going to develop throughout the book. The chapter walks you through the steps of building an API using the popular framework FastAPI.

Chapter 3: Designing and managing microservice APIs

The first part of this chapter explains the different types of protocols you can use to build web APIs, such as REST, GraphQL, and SOAP. The second part explains how to use domain-driven design to the design of a microservices platform.

Chapter 4: Designing a RESTful API

Everything you always wanted to know about REST design principles and best practices, and how we leverage HTTP to create meaningful exchanges through a REST API.

Chapter 5: Producing a REST API specification

It introduces JSON Schema and OpenAPI, and applies them to design of a REST API.

Chapter 6: Implementing REST APIs with Python

It provides a step-to-step guide for implementing REST APIs using FastAPI and Flask with the smorest plugin.

Chapter 7: Service implementation patterns for microservices

Here you learn to implement the business and the data access layers of a service. You'll learn to apply software development principle and patterns to achieve loose coupling in your code, and to keep it readable and maintainable. You'll learn about hexagonal architecture, the repository pattern, the unit of work pattern, and others. You'll also learn to use SQLAlchemy to interact with a database and Alembic to manage database schema changes from code. You'll also learn to run API mock servers with Prism.

Chapter 8: Designing GraphQL APIs

Here you learn how GraphQL works and how to use the Schema Definition Language (SDL). You'll learn about GraphQL's type system, how to define custom types, and how to design queries and mutations.

Chapter 9: Consuming GraphQL APIs

It explains how to interact with a GraphQL server. You'll go from performing simple queries to creating complex query statements with aliases, fragment, and parametrization. You'll also learn to run GraphQL mock servers, and you'll understand how GraphQL queries work behind the scenes.

Chapter 10: Implementing a GraphQL API

In this chapter you learn to implement a GraphQL using the excellent Ariadne framework. You'll learn to create resolvers for GraphQL types, queries, and mutations, and to handle query parameters. You'll also learn to deal with custom types and optimise your queries using field resolves.

Chapter 11: Authorizing access to your APIs

This is your one-stop guide to API authentication and authorization. If there's one thing you need to get right in your APIs, it's this. The chapter explains how Open Authorization 2.0 and OpenID Connect work. It also the explains the main OAuth flows and when to use them. It explains what JSON Web Tokens (JWT) are, how to inspect them, how to produce them, and how to validate them using PyJWT. It also explains how to integrate with an identity service provider such as Auth0.

Chapter 12: Testing REST and GraphQL APIs

Here you learn how to test and validate your APIs. You'll learn about property-based testing, and how to apply it using Python's excellent property-based testing library Hypothesis. You'll also learn how to use the classic API testing framework Dredd, and the more modern and excellent framework Schemathesis.

Chapter 13: Deploying with Docker and Kubernetes

In the final chapter of the book, you'll learn to deploy your microservice APIs with Kubernetes. It's a very packed chapter as there's a lot to learn and to take, but it's also one of the most gratifying chapters of the book. You'll learn to dockerize Python applications. You'll learn to launch a Kubernetes cluster using AWS EKS, and to run your workloads with AWS Fargate. You'll also learn to use the eksctl command line tool to manage your Kubernetes infrastructure, and Kubernete's kubectl to manage deployments. You'll learn to launch a serverless Aurora database and to connect securely to it. You'll also learn to manage your application configuration securely.

About

Code repository for the book


Languages

Language:Python 85.1%Language:Vue 8.2%Language:JavaScript 2.5%Language:TypeScript 1.7%Language:Mako 1.1%Language:Dockerfile 0.9%Language:HTML 0.5%