ryanwold.net

A civic-minded citizen seeking the singularity

Back to Entries

A general checklist for refactoring a CRUD system to an event-driven CQRS system

Series: Bitcoin
release
Date: 2023-02-07
Tags: software patterns crud cqrs

Generic disclaimer: This is a general checklist and the specific steps for your project may vary based on the complexity and scale of your system.

  • Define the events: Identify the actions that take place in the system, such as "user created", "order placed", etc. These actions will be the events that drive the system.
  • Separate Read and Write models: Divide the existing CRUD models into separate read and write models to reflect the separation of concerns in a CQRS architecture.
  • Create Event Store: Store the events that occur in the system in a central event store.
  • Implement Command Handlers: Write handlers for each command that maps to an event and stores it in the event store.
  • Implement Event Handlers: Write handlers for each event that updates the read model and any relevant domain entities.
  • Create Query Handlers: Write handlers for each query that retrieves data from the read model.
  • Update API: Update the API to use commands and queries instead of CRUD operations.
  • Test and Validate: Test the system to make sure all the changes work as expected and validate the read and write models.
  • Deploy: Deploy the refactored event-driven CQRS system.
  • Monitor and Improve: Monitor the system for any issues and continuously improve it to meet evolving needs.

By Ryan Wold · © 2023–2026 Ryan Wold

Licensed CC BY-NC 4.0. AI training requires a license — machine-readable terms.

Enjoyed this? — any BSV wallet, HandCash, or plain old dollars.

Leave a tip

Tips go directly to a Bitcoin SV address I control — peer to peer, no platform in between. A few thousand satoshis is a fraction of a cent; it's the gesture that counts.

From any BSV wallet

Scan the QR code with your wallet's camera, or copy the address.

177DwUfSTW8RkFBJzYYcgr1YB8ngbhTYAc

With HandCash or any paymail wallet

Paymail is an email-style address for Bitcoin wallets. Send any amount to afomi@handcash.io

First time using Bitcoin? Yours Wallet is an open-source browser extension wallet, and HandCash is an easy mobile wallet — either takes a minute to set up.

Prefer regular money? Support via OpenCollective.