Context
We currently have two concepts named Command:
- API/application commands: the write side of the API, paired with
Query, broadly following CQRS.
- Frontend/UI command pattern: user-triggered capabilities such as buttons, menu entries, command palette items, keyboard-triggered flows, loading state, confirmation, toasts, follow-up side effects, etc.
The duplicate name makes the architecture harder to talk about. Command can mean either a resource/API write request or a user-facing UI capability depending on layer.
We also used Action as an umbrella word inside resource files for things that can be either queries or commands. That now collides with the better frontend name for user-triggered capabilities.
Decision direction
Keep Command for the API/application boundary:
Query = read-side request.
Command = write-side/application intent.
- This remains valid CQRS language even though we do not require event sourcing or eventual consistency.
- Other ecosystems often call write operations
Mutation (TanStack Query, Apollo, GraphQL), but that is not our resource vocabulary.
Rename the frontend command-pattern concept to Action:
Action = something the user can do from the UI.
- An action may orchestrate one or more resource operations, read queries, perform navigation, analytics, local UI state updates, optimistic UI, confirmation, toast handling, cache invalidation, etc.
- This avoids implying a 1:1 mapping between UI affordances and backend commands.
Use Operation as the resource/API umbrella:
Operation = something exposed by a resource.
- A resource operation is either a
Query or a Command.
- This replaces resource-level
Action naming.
Working mental model:
User runs an Action.
An Action may orchestrate one or more resource Operations.
A resource Operation is either a Query or a Command.
Views read via Queries.
Writes/application intents go through Commands.
Short version:
Actions invoke operations.
Operations are queries or commands.
Naming guidelines
Use these terms by layer:
- UI/frontend capability:
Action.
- Resource/API umbrella:
Operation, or ResourceOperation in exported/shared APIs when extra scope helps.
- API/application write request:
Command.
- API/application read request:
Query.
Avoid these terms:
UiAction as the default frontend name. Use plain Action inside frontend/UI packages.
ResourceAction for resource query/command definitions. Use Operation / ResourceOperation instead.
Action as a resource umbrella.
Mutation as our resource write-operation name. Mention it only when comparing to external ecosystems.
Example derived frontend names:
Action
ActionGroup
ActionId
ActionContext
ActionHandler
ActionResult
ActionState
ActionRegistry
useActions
Example derived resource/API names:
Operation
ResourceOperation
OperationKind
operationName
operations
queries
commands
Possible resource shape:
const operations = {
queries: {
Get,
List
},
commands: {
Create,
Update,
Delete
}
}
Plan
- Audit current frontend
Command types, helpers, docs, tests, and examples.
- Audit resource-level
Action naming used as an umbrella for queries and commands.
- Separate UI command-pattern names from API/resource command names.
- Rename UI concepts from
Command* to Action* where they model user capabilities/workflows.
- Rename resource umbrella concepts from
Action* to Operation* where they model query/command definitions.
- Keep API/resource
Command and Query terminology intact.
- Update docs to explain the layer split and the orchestration relationship.
- Add compatibility aliases only if needed for migration, with a clear removal path.
- Include changesets for public package/API changes.
Acceptance criteria
- No layer has two competing meanings for
Command.
- API/resource docs consistently use
Query / Command for operation kinds.
- Resource docs consistently use
Operation / ResourceOperation as the query-or-command umbrella.
- Frontend/UI docs consistently use
Action for user-triggered capabilities.
- Examples show that an
Action may compose multiple operations, queries, commands, and side effects.
- Public exports either use the new names or provide explicitly documented deprecated aliases.
Context
We currently have two concepts named
Command:Query, broadly following CQRS.The duplicate name makes the architecture harder to talk about.
Commandcan mean either a resource/API write request or a user-facing UI capability depending on layer.We also used
Actionas an umbrella word inside resource files for things that can be either queries or commands. That now collides with the better frontend name for user-triggered capabilities.Decision direction
Keep
Commandfor the API/application boundary:Query= read-side request.Command= write-side/application intent.Mutation(TanStack Query, Apollo, GraphQL), but that is not our resource vocabulary.Rename the frontend command-pattern concept to
Action:Action= something the user can do from the UI.Use
Operationas the resource/API umbrella:Operation= something exposed by a resource.Queryor aCommand.Actionnaming.Working mental model:
Short version:
Naming guidelines
Use these terms by layer:
Action.Operation, orResourceOperationin exported/shared APIs when extra scope helps.Command.Query.Avoid these terms:
UiActionas the default frontend name. Use plainActioninside frontend/UI packages.ResourceActionfor resource query/command definitions. UseOperation/ResourceOperationinstead.Actionas a resource umbrella.Mutationas our resource write-operation name. Mention it only when comparing to external ecosystems.Example derived frontend names:
ActionActionGroupActionIdActionContextActionHandlerActionResultActionStateActionRegistryuseActionsExample derived resource/API names:
OperationResourceOperationOperationKindoperationNameoperationsqueriescommandsPossible resource shape:
Plan
Commandtypes, helpers, docs, tests, and examples.Actionnaming used as an umbrella for queries and commands.Command*toAction*where they model user capabilities/workflows.Action*toOperation*where they model query/command definitions.CommandandQueryterminology intact.Acceptance criteria
Command.Query/Commandfor operation kinds.Operation/ResourceOperationas the query-or-command umbrella.Actionfor user-triggered capabilities.Actionmay compose multiple operations, queries, commands, and side effects.