CQRS by Example
CQRS by Example
$9.99
Minimum price
$14.99
Suggested price
CQRS by Example

This book is 15% complete

Last updated on 2020-06-03

About the Book

Four years have passed since our first publication, we established what we think is a solid ground for DDD building blocks and Hexagonal Architecture. It is time to explore how to solve the limitations some projects may face at scale.

We think CQRS is the next natural step forward and we want to guide you through it.CQRS is usually discussed along with Event Sourcing, a pattern where application state is a projection of the Domain Events that happen through its lifetime. Event Sourcing relies on having a stream of Domain Events to reconstitute state. Something convenient for operations that modify the state of the application, known as Commands; however, querying the system requires some special mechanisms that aren't that trivial. We can say than in Event Sourced systems CQRS is mandatory in order to generate the required information to be able to query later, but the opposite isn't true. We can develop a CQRS system without Event Sourcing, so worry not, this book won't cover Event Sourcing.

In this book, we'll explore Hexagonal Architecture drawbacks, and we'll dive into CQRS by exploring plenty of real examples that you can use in your projects. Even though code examples are written in PHP, the patterns and techniques described in this book are applicable to any programming language and likely any paradigm you may be using. We can't thank you enough for purchasing this book and be an active contributor of Domain-Driven Design, Hexagonal Architecture, and CQRS!

About the Authors

Carlos Buenosvinos
Carlos Buenosvinos

I am an Extreme Programmer (XP) and DevOps with more than 20 years of experience in developing Web and Mobile Applications. For the last ten years, I have played various leading roles such as Tech Lead, VP of Engineering and CTO. I have mentored engineering and product teams up to 150 members in multiple different markets such as E-commerce, E-Learning, Payment Processing, Classifieds, and Recruiting Market.

As an employee and consultant, I have contributed to the success of start-ups and well-established brands. Some examples are SEAT, XING, Atrápalo, PCComponentes, Emagister, eBay, Lowpost, Vendo, Riplife, Universitat International de Catalunya (UIC), and many more.

I am the happy creator of Ansistrano, the most starred Ansible Galaxy role. I am also the author of the book Domain-Driven Design in PHP. I am also a conference speaker, and since 2016, I have a video blog about Development Best Practices called Rigor Talks. I organized the DevOps Barcelona Conference and the PHP Barcelona Conference.

My main areas of expertise are the Agile Team Management (Scrum and Kanban), Best Development Practices (Extreme Programming, Domain-Driven Design, and Microservice Architectures) and Digital Transformation (Agile, XP, and DevOps).

Christian Soronellas
Christian Soronellas

Christian is an Extreme Programmer and has over 15 years of experience helping tech companies succeed from a broad variety of roles, from Software Engineer to CTO. He has helped companies such as a Privalia, Emagister, Atrápalo, Enalquiler, PlanetaHuerto, PcComponentes or Opositatest. He is the author of the book Domain-Driven Design in PHP as well as a conference co-organizer of DevOps Barcelona Conference and PHP Barcelona Conference

Keyvan Akbary
Keyvan Akbary

Keyvan is an Engineering Leader and programmer with more than 15 years of experience crafting products customers love and helping teams succeed. He understands technology as a medium for providing value, not the end itself. He has a passion for Distributed Systems, Software fundamentals, SOLID principles, Clean Code, Design Patterns, Domain-Driven Design and Testing; as well as being a sporadic Functional Programmer. For the last 7 years he has also focused on growing teams in high scaleup product companies, advocating for customer-centric product development, Extreme Programming, DevOps, Lean and Kanban.

He has worked on countless projects as a freelancer, on video streaming at Youzee, tradesman marketplace at MyBuilder, in addition to founding his own crowdfunding startup Funddy, and leading FinTech teams at TransferWise. Currently he is leading engineering in the ride-hailing space as Head of Engineering at Cabify.

He is also the author of the book Domain-Driven Design in PHP.

Table of Contents

  • Preface
    • First Book: Domain-Driven Design in PHP
    • DDD acceptance has rapidly grown
    • Second Book: CQRS by Example
    • Who Should Read This Book
    • Summary of Chapters
    • Code, Typos, and Examples
  • Acknowledgements
    • Cover
    • Contributors
  • About the Authors
    • Carlos Buenosvinos
    • Christian Soronellas
    • Keyvan Akbary
  • CQRS and Domain-Driven Design
    • What is all the fuzz about?
    • Why Domain-Driven Design Matters
    • The Three Pillars of Domain-Driven Design
    • Considering Domain-Driven Design
    • The Tricky Parts
  • A Journey Towards CQRS
    • Introducing Cheeper, a Twitter Clone
    • Typical Architectural Styles
    • A brief analysis
  • Anatomy of CQRS
    • Hexagonal Architecture limitations
    • Command-Query Separation
    • CQRS
    • The Command Side
    • The Query Side
    • Syncing the Command and Query sides
    • Wrap-Up
  • Command Side and the Write Model
    • Commands
    • Command Handlers
    • Command Bus
  • Query Side and the Read Models
    • Queries
    • Query Handlers
    • Query Bus
  • Synchronizing the Write and Read Models
    • Multiple Read Models
    • No Synchronizing
    • Database
    • Software
    • Projections
    • Projectors
    • Optimizing Projections
  • What’s Next
    • CQRS Heuristics
    • Event Sourcing
    • My Write Model as another Read Model
    • Final Words
  • The End

Authors have earned$9,095,176writing, publishing and selling on Leanpub,
earning 80% royalties while saving up to 25 million pounds of CO2 and up to 46,000 trees.

Learn more about writing on Leanpub

The Leanpub 45-day 100% Happiness Guarantee

Within 45 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers), EPUB (for phones and tablets) and MOBI (for Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses! Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks. Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. It really is that easy.

Learn more about writing on Leanpub