CQRS pattern apply to javascript