Why doesn'tn it work in a real codebase?
You're not limited to keeping everything in 1 file. You can split them up as you need. If you have a user service with a 100 methods, maybe you're coupling too much in that service and probably have to look at your domain modelling again. If you do need a 100 methods, then you're free to split them into more files.
All of this is group/packaed in the appropriate layers so you can always add more files if you need to split things up.