Well, the other reason $400k in revenue was possible: you were writing about a popular JavaScript framework. There aren't many topics with such a wide audience.
> There aren't many topics with such a wide audience.
What now? The number of people who develop in angular actively is probably in the low 6 figures. In the context of the world that's a very small audience.
In the context of programming languages and tech stacks, that is an astronomical audience though.
I work in a niche where there are two books that have ever been written, by the same author, and there might be a couple thousand people total in the whole world that use this particular SDK. Most technical books appeal to an incredible narrow slice of the already small pie that is software people.
I suspect that the total number of books written on SQL/C/C++/C#/Java etc probably significantly exceeds those written for niche languages. Similarly, Windows/Linux/Unix/iOS or MS Office or Visual Studio... across the various CS domains.
Microsoft Lync/Skype for Business development. Michael Greenleaf has written a couple books, and there are maybe a double handful of people blogging about it.
Can confirm, the subject matter is really important. I accidentally wrote the most-read blog post on our company blog, and this might be my humility / impostor syndrome speaking but, it wasn't due to the content as much, but because it was using the right keywords in the title at the right time.