I know this is a slightly subjective question, but I would appreciate insight from experienced web app engineers.
I am currently working on a medium size webapp in node.js with a REST API/Single Page App type of architecture. On the server side I am always struggling to know when it is the best time to split a single file and use a require() to call a block of code.
I understand that file complexity is unlikely to affect the final production server performance, I want to know the goldilocks range to balance readability with directory structure complexity.
There is a similar question aimed specifically at classical languages like vb.net here and there is an excellent question about web application architecture here.