NestJSInterview preparation
Intermediate·Concept·2 min read

What are WebSockets, microservices and CQRS used for?

Practice this question

Definition:

WebSockets maintain a two-way connection for ongoing messages, microservices split an application into separately operated services, and CQRS separates command/write handling from query/read handling. These solve different problems and can be used independently. Each adds complexity that should be justified by a concrete requirement.

Key points:

  • WebSockets allow ongoing two-way updates, such as chat.

  • Microservices separate deployable services but add network and operational complexity.

  • CQRS separates read and write logic; it does not require separate databases.

  • CQRS can begin with separate code paths in one application and one database; event sourcing is a separate decision.

Interview point:

  • Describe the user or scaling need before proposing WebSockets, distributed services or CQRS.
Adapted from 03_NESTJS.md · “What are WebSockets, microservices and CQRS used for?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.