← Back to design patterns map
Design Pattern

Command

Wrap an action as an object so it can be queued, logged, or undone.

behavioral

Visual Diagram

Client creates command
-> queue/log/execute
-> optional undo

When To Use

  • ->Undo and redo
  • ->Background jobs
  • ->Retry queues
  • ->Audit logging actions
Used in: BullMQ jobs, task queues, undo stacks
command.js

Live Editor

Loading...

Output

Run code to see output...

Comments

Sign in to leave a comment. Your name and photo come from Google; nothing else is shared.

Loading comments...