Learn to Build a Microservices App Today!

With Bootstrapping Microservices, Second Edition by Ashley Davis

Manning Publications
9 min readMay 24, 2023

--

This book jumps right into building microservices, giving you just enough knowledge to build, while not getting mired in theory.

Read on to learn more.

As software continues to become larger and more complicated, we need better ways of managing and mitigating its complexity. As it grows alongside our business, we need better ways of dividing it up so that multiple teams can participate in the construction effort.
As our demanding customer base grows, we must also be able to expand our software. At the same time, our applications should be fault-tolerant and able to scale quickly to meet peak demand. How do we then meet the demands of modern business while evolving and developing our application?

Microservices are an architectural pattern that plays a pivotal role in contemporary software development. A distributed application composed of microservices solves these problems and more, but typically it is more difficult, more complex, and more time-consuming to architect than a traditional monolithic application. If these terms are new — microservices, distributed application, and monolithic application — they will be explained soon.
Conventional wisdom says that microservices are too difficult. We are told to start “monolith-first” and later restructure to microservices when necessary to scale. But I argue that this attitude doesn’t make the job of building an application any easier! Your application is always going to tend toward complexity and, eventually, you will need to scale it. When you do decide you need to change, you now have the extremely difficult job of safely converting your monolith to microservices when staff and customers already depend on it.
Now is also the perfect time to be building microservices. The confluence of various factors — accessible and cheap cloud infrastructure, ever improving tools, and increasing opportunities for automation — is driving an industry-wide movement toward smaller and smaller services, aka microservices. Applications become more complex over time, but microservices offer us better ways to manage such complexity. There is no better time than now to go “microservices-first.”
In this book, I will show you that a microservices-first approach is no longer as daunting as it once was. I believe the balance is firmly tipping toward microservices. The remaining problem is that learning microservices is difficult. The learning curve is steep and holds back many developers in their quest to build microservices. Together, we will break the learning curve. We will say “Boo” to the monolith, and we’ll build from the ground up a simple but complete video-streaming application using microservices.

This book is practical

Why are you reading this book? You are reading this because you want or need to build a microservices application, which is an important skill set for modern developers, but it’s a difficult skill set to obtain, and you need some guidance. You may have read other books on microservices and been left wondering where do I begin? I understand your torment.
Microservices are tough to learn. Not only do you have to learn deep and complicated tools, you must also learn to build a distributed application. This requires new design patterns, protocols, and methods of communication. That’s a lot to learn in anyone’s book.
In this book, we cut through the seemingly impenetrable learning curve of building microservices applications. We’ll start as simple as possible and, piece-by-piece, we’ll build up to deploying our application to production.
This book is about busting through the learning curve and bootstrapping a working application that will last indefinitely, an application that we can continuously update and build on to satisfy the ongoing and changing needs of our customers and users. Figure 1 illustrates this idea of cutting through the learning curve. While our example application is small and simple, from the start, we will build-in pathways to scalability that will later allow it to be expanded out to a truly massive distributed application.

Figure 1 Cutting through the learning curve. In this book, we’ll learn only the bare minimum, i.e. just enough to bootstrap our application.

How is this book different from all the other books on microservices? Other books are notably theoretical. That’s a good approach for an experienced developer or architect looking to broaden their knowledge, but acquiring practical skills that way is challenging and doesn’t help you navigate the minefield of bootstrapping a new application. The technical choices you make at project inception can haunt you for a long time.
This book is different; this book is not theoretical. We will take a practical approach to learning. There is a small amount of theory interspersed throughout, and we will actually build a substantial microservices application. We will start from nothing and work through bringing our application into existence and getting it into production. We’ll build and test the application on our development workstation (or personal computer), and ultimately, we’ll deploy it to the cloud.
Together we’ll get our microservices application off the ground without having to learn the deepest details of any of the tools or technologies. An example of this book’s learning model is illustrated in figure 2.

Figure 2 The learning model for this book. We will skim the surface of these deep and complicated technologies to only use what is necessary to bootstrap our application.

What will I learn?

Throughout the book, we will progress from easy to more difficult. We’ll start with the simplest task — creating a single microservice. Over 12 chapters, we’ll build up to a more complex application and infrastructure, but we’ll do it in incremental steps so that you never get lost. After reading this book and practicing the skills taught, you can expect to be able to:

  • Create individual microservices
  • Package and publish microservices using Docker
  • Develop a microservices application on your development workstation using Docker Compose
  • Test your code, microservices, and application using Jest and Cypress
  • Integrate third-party servers into your application (like MongoDB and RabbitMQ, as examples)
  • Communicate between microservices using HTTP and RabbitMQ messages
  • Store the data and files your microservices need to operate
  • Deploy your microservices to a production Kubernetes cluster
  • Create production infrastructure using Terraform

What’s new in this edition?

For this edition, there is a new chapter (a simpler guide to production deployment), a completely reworked chapter (converting from Bitbucket Pipelines to GitHub Actions), numerous updates for new versions of tools and software, and important revisions and updates to all other chapters based on feedback from the first edition.

What do I need to know to be able to use this book?

You might be wondering what you need to know going into this book. I have made an effort to write this book with as few assumptions as possible about what you already know. We are going on a journey that takes you from absolute basics all the way through to some very complicated concepts. I think there’s something here for everyone, no matter how much experience you might have already as a developer.
It’s best coming into this book if you have some entry-level understanding of computer programming. I don’t think you’ll need much, so long as you can read code and get the gist of what it’s doing. But don’t worry; I’ll explain as much as possible about anything important that is happening in the code.
If you have a background in programming, you’ll have no problem following along with the examples in this book. If you are learning programming while reading this book, you could find it quite challenging, but not impossible, and you might have to put in extra work.
This book uses Node.js for examples of microservices, but starting out, you don’t need to know JavaScript or Node.js. You’ll pick up enough along the way to follow along. This book also uses Microsoft Azure for examples of production deployment. Again, starting out, you don’t need to know anything about Azure either.
Rest assured that this book isn’t about Node.js or Azure; it’s about building microservices applications using modern tooling like Docker, Kubernetes, and Terraform. Most of the skills you will take away from this book are transferable to other languages and other cloud providers. Because I had to pick a programming language and cloud vendor that I could use to demonstrate the techniques in this book, I chose Node.js and Azure. That’s a combination I have used extensively in production for my own software products.
If Node.js and Azure aren’t your thing, with some extra research and experimentation on your part, you’ll be able to figure out how to replace Node.js and JavaScript with your favorite programming language and replace Azure with your preferred cloud vendor. In fact, the main reason I use Docker, Kubernetes, and Terraform in the first place is precisely because these tools offer freedom — freedom of choice for programming language and freedom from cloud vendor lock-in.

A few words on managing complexity

A microservice application, like any application, will become more complex over time. But it doesn’t need to start that way! This book takes the approach that we can begin from a simple starting point and that each iteration of development can also be just as simple. In addition, each microservice is small and simple. As you read this book, you’ll find that it isn’t as difficult as you might think to build applications with microservices (despite what some people say).

Microservices give us a way to manage complexity at a granular level, and it’s the level we work at almost every day — the level of a single microservice. At that level, microservices are not complex. In fact, to earn the name microservice, they have to be small and simple. A single microservice is intended to be manageable by a single developer or a small team!

It is true, though, that through continued development and evolution, a complex system will emerge. There’s no denying that a microservices application will become complex. But such complexity doesn’t evolve immediately; it takes time. Although our applications tend towards complexity, microservices themselves are the cure to, rather than the cause of, that complexity. During development we use microservices to manage the growing complexity of our application so that it doesn’t become a burden.

It might seem that the infrastructure required for microservices can add significant complexity to our development process. Yes, to some extent this is the truth, but then again all applications require infrastructure and in my experience microservices don‘t add a whole lot more. In fact you’ll see that by chapter 8 we’ll build a continuous delivery pipeline that automates delivery of our application code to production. For any team that does this, they find that the deployment and operational complexity of microservices tends to fade into the background and seem like magic.

Maybe it’s just that we are noticing the complexity of our infrastructure more now because we have to deal with it more frequently. In the past we had an operations team and possibly a build or testing team who would handle most of that work for us and hide the complexity. More and more, though, microservices are handing power back to the developers and with that we can clearly see the complexity that was always there in our development, testing and operational infrastructure.

Any complexity added by microservices must be offset by their benefits. Like all design or architectural patterns, to get value from microservices we must be sure that their advantages outweigh the cost of using them. That’s a tough call that we must make on a project-to-project basis, but for an increasing number of scenarios microservices will more than pull their weight.

A microservices application is a form of complex adaptive system, where complexity emerges naturally from the interactions of its constituent parts. Even though the system as a whole can become far too complex for any mere mortal to understand, each of its components remains small, manageable, and easy to understand. That’s how microservices help us deal with complexity, by breaking the complexity apart into small, simple and manageable chunks. But don’t worry; the example application we build in this book isn’t very complex.

Development with microservices (with help from our tools and automation) allows us to build extremely large and scalable applications without being overwhelmed by the complexity. And, after reading this book, you’ll be able to zoom in and look at any part of the most complex microservices application and find its components to be straightforward and understandable.

Learn more about the book here.

--

--

Manning Publications

Follow Manning Publications on Medium for free content and exclusive discounts.