This book is a hands-on guide to start writing microservices using Node.js and
the most modern frameworks, especially Seneca and PM2. In the chapters, we will
discuss how to design, build, test, and deploy microservices using the best practices.
We will also discuss a valuable lesson: how to make the right level of compromise
in order to avoid over-designing and get the business requirements aligned with the
What this book covers
Chapter 1, Microservices Architecture, discusses the pros and cons of microserv
oriented architectures. It will be the foundation for the rest of the book.
Chapter 2, Microservices in Node.js – Seneca and PM2 Alternatives, introduces Node.js,
Seneca, and PM2. In it, we will discuss the structure of a Node.js application and how
to run it using PM2. We will also dive into a few alternatives to Seneca and PM2.
Chapter 3, From the Monolith to Microservices, covers how to tackle the organic growth
(unplanned software changes) using microservices. We will also talk about how to
split a monolithic application into microservices.
Chapter 4, Writing Your First Microservice in Node.js, explains how to write our
Chapter 5, Security and Traceability, covers how security and traceability are two
important characteristics of modern systems. We need to keep the information secure
and the actions traceable. In this chapter, we will discuss how to do it using Seneca.
[ viii ]
Chapter 6, Testing and Documenting Node.js Microservices, introduces using the main
frameworks for testing on Node.js: Mocha and Chai. We will also make use of Sinon
(another framework) to mock services. Swagger will be our choice for documenting
Chapter 7, Monitoring Microservices, covers using PM2 to monitor our microservices.
We will use it along with Keymetrics to get the maximum benefit of such an
Chapter 8, Deploying Microservices, explains how, using PM2, we are going to learn
to deploy microservices in our different environments, managing our ecosystem of
applications with a single command and reducing the overhead introduced by the
microservices architecture. We will also discuss Docker, one of the most advanced
systems to deploy applications not only in Node.js, but also in general applications.