One of the key points of the book (and DDD in general) is the web stuff is just a detail at the edge of an application. You should be able to replace the web bit (for which they use flask) with any other entry point. In fact, they do this by having an event subscriber entry point and IIRC a CLI entry point. The whole point is it all uses the same core code implementing the domain logic.