Hacker Newsnew | past | comments | ask | show | jobs | submit | alex-lawrence's commentslogin

This library provides selected useful features of modern UI libraries, while staying at a minimal size. Without the need for compilation and extensive tooling, it is easy and straight forward to use.

Originally, this project started out as an experiment. After using React/Preact for some time, I thought about alternative approaches without the VDOM (and JSX). Soon, I encountered libraries such as htm, hyperHTML, lighterhtml, lit-element and lit-html. All of the mentioned projects are definitely worth checking out.

I would love to hear your feedback on the library. Even more, if you have a scenario where adequate could be useful, please let me know! Also, feel free to ask me anything about the project, be it about its functionalities or about bundle size optimizations.


Since I am asked from time to time about the technology choices for my book, I decided to write a blog post to explain my reasoning: https://www.alex-lawrence.com/posts/why-my-book-uses-nodejs-... Some of my arguments pretty much match with your statements.


I will definitely look into this. What I can already say is that it has the best name for a ES/CQRS library!


Thank you!


I think this is a great recommendation for any new project that is considering to use Microservices. I like the approach of an in-memory event-driven system. This helps to enforce a message-only relationship between different conceptual parts from the start.

In fact, I did the same in one project. Also, while I am not covering Microservices in my book, the Sample Application uses a similar approach. The different contexts integrate via event communication. At first, this is an in-memory implementation and everything is running in a single process. Later on, it is replaced with a filesystem-based variant and the individual contexts are operated as individual programs.


Thanks for the feedback. Happy to hear that you appreciate the UI chapter. For me, it was important to explain how to approach the User Interface. I often had the feeling that this part was a bit neglected when reading about CQRS & Event Sourcing.

The book contains numerous standalone examples throughout the chapters, which are all executable. At the end of each chapter, the explained concepts are applied to the Sample Application context.

The Sample Application is a greatly simplified task board. Users can register, login, create projects, manage team members and work with a task board. The task board is essentially a collection of items, grouped into three columns. Individual tasks contain details such as title, description, status, assignee, etc.

While there are some constraints/invariants in the Domain Model, I would consider the Sample Application fairly trivial. It does not represent a complex domain problem. One reason for this is that I personally did not encounter any highly complex domain so far. It would have been weird if I tried to explain something I am not really experienced in.

> what if domain logic can be optimized in the database?

IMHO, the question is a bit too generic. The generic recommendation would be to not put domain logic into the database. However, one would need to look at what the domain logic in question is. Also, what does "in the database" mean? Are we talking about code that is being executed in the database environment, such as PL/SQL?

> examples where you have property method on a model that goes and performs additional queries

This sounds a bit like the Active Record pattern or the use of an ORM, where one "model" is somehow linked to another. Again, a generic answer would be that domain objects should stay free of infrastructural concerns. If you have posts and comments and need to get the latest comment on a post, this represents a use case. Use cases are executed by an Application Service. This part is allowed to query any number of domain objects / data sources. If you would be using CQRS, you would likely have a denormalized Read Model that contains comments per post.


In fact, the book was called "Implementing DDD, CQRS and Event Sourcing in Node.js" up until the release of its complete version. I thought about this for a longer time and decided to remove the "in Node.js" part from the title. Instead, I made it clear in the book description. In my opinion, the book can be valuable for anyone who is interested in the concepts, regardless of technology choices.

I think that it is fair to say that my book is partially also about Node.js, but not primarily. I wouldn't say though it is about JS. In fact, many of the code examples would look similar in other languages. Furthermore, the use of Node.js helps to provide concise code examples and executable code without much ceremony.

When reading "Implementing Domain-Driven Design" by Vaughn Vernon, all the code examples are in Java. The book "Enterprise Integration Patterns" has a lot of code examples and all of them are also in Java. The most recent edition of "Refactoring" by Martin Fowler uses JavaScript. Still, I wouldn't say that these books are about a particular programming language.


In one project, where we could have done otherwise, we went consciously full Event Sourcing. In another project, the Domain Model was inherently event-based. In my book, the Sample Application first persists domain objects and is later refactored towards Event Sourcing.

While I read about the possibility of doing both at the same time, I never encountered this practice in a project. How I see it, there is always only one source of truth. If you apply Event Sourcing, it is the event log. Any other representation should be seen as derivation/projection.

The one long-term project where we applied Event Sourcing showed quite some challenges you can face with this pattern. For me, the most challenging aspect is the versioning of an event-sourced system. When the Domain Model evolves, it might necessitate changes to events or the introduction of new ones. Greg Young even wrote a book on this topic: https://leanpub.com/esversioning (I haven't read it though).


Can you tell me a bit a more about the long-term project where you applied full ES? What kind of domain/business context informs this decision?

I am aware of the costs of the approach, but would like to know the real world problems it solved for you.


Please note that I have limited experience with domains where Event Sourcing is without a doubt the weapon of choice. Hope my input still helps. Maybe there are other people that can give more qualified input on that. In the end, I am not trying to advocate for the pattern.

The project was about building a SaaS for structured meetings, both for on-site and remote use. It involved topical areas such as collaboration, moderation and presentation. The model defined that every meeting consists of six steps, where each is facilitated with one specific method (out of multiple). There were also additional functionalities such as a collaborative whiteboard and audio/video communication.

I briefly mentioned this in another comment: With regard to software architecture and pattern use, the project is a negative example. CQRS and Event Sourcing was prescribed on a system level. Regardless of conceptual/technological boundaries, every part made use of it. This decision was by no means reinforced with domain- or business-specific arguments. However, for us as developers, it was a great learning opportunity.

In terms of significant benefits for specific contexts, I can only think of the whiteboard part. However, even for that, it is about a feature we never got to implement. At some point, we wanted to add a "Undo" functionality. With Event Sourcing, you can simply append events that represent the reversal of previously persisted state transitions.

Independent of domain-specific aspects, I experienced three universal benefits. I hate to say it, but one was in fact reporting. Another benefit is the increased possibility to solve concurrency conflicts in a domain-specific way. Third, an event-sourced service is an ideal foundation for sending notifications, such as when publishing Domain Events. In the project, it helped us to build a real-time reactive User Interface. Of course, I'm not saying you necessarily need Event Sourcing for that.


I have to say that my recommendations on JavaScript education resources might be pretty outdated. The book that helped me a lot with the JavaScript language (in 2010) was https://www.goodreads.com/book/show/2998152-javascript. However, this was before the ECMAScript standard and the Web APIs developed as fast as they are doing today. Node.js I learned exclusively from reading the documentation and experimenting with it.

Similar to what zeroc8 said, I heard that people liked "You don't know JS". Also, I agree with joshxyz that you can learn a lot from the MDN and the Node.js API docs. Especially MDN is a great resource for learning specific concept. As example, look at their Promises tutorial: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe... Furthermore, I also think the publications from Axel Rauschmayer are worth checking out (exploringjs.com).

The section in the Preface of my book might sound a bit daunting. Even if you don't know JavaScript, but have experience with at least one other programming language, that might be fine. I think the most challenging aspect is the asynchronous programming part, which is being used extensively due to Node.js.


That is a good question and, ideally, I should be able to answer it. Unfortunately, I don't know. The book started as a passion project and I never analysed the market in any useful way. However, I think that there is a certain potential for extending the existing market by making people interested in the topics.


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: