According to most recent starter kits for modern SPA frameworks client app code usually lies in src folder. Here couple samples
https://github.com/kriasoft/react-starter-kit
https://github.com/AngularClass/angular2-webpack-starter
https://github.com/aurelia/app-contacts
May be it better to rename ClientApp folder to src? Or at least allow to change it in yo generato? (this name use in couple places accross app (index.cshtml, webpack.configs).
Good question.
It doesn't seem necessarily appropriate to use the name src for that, because this project includes both server and client aspects, both of which are "source" files. This is different from the starter kits you've linked to, which are client-only apps (and as such, have no source files besides their React/Angular/Aurelia code).
We could rename it to ClientSrc but I'm not sure if that's really any better.
What do you think?
I strongly prefer src folder. I talk to some front-end guys, and they used to see some src or app folder as front app folder. But you are right - this for UI only apps, but for combined it could be difference. ClientSrc is not quite good imho, since it still not proper cased for front-end app. Usualy they have different from .net naming convention for folder. It can be client or may be client-src. The case is pretty serious thing when you tolk about front-end, since it usually builded on linux machines (you know case sensitive folder etc :cold_sweat: ). Usually front-end do not use any came case notations for folders.
In my opinion if there will be such option in yo generator it would be really nice! :cat:
how about wwwroot/src?
Also keep in mind the latest structure for ASP dotnet core solutions in Visual Studio (and possibly other project types?) is to create a src folder that contains all projects under the solution folder. Renaming ClientApp to src would be confusing I think.
@VishalMadhvani - I would prefer the code not to be in wwwroot/src. It would be better for the source be outside the tree as that would be .ts files.
wwroot/clientapp should contain the emitted es5 code for the browser to consume (or whatever depending on the rules done by the developer to pack the emitted code). The key takeway is the source outside wwwroot and emitted/bundled code inside it.
I would prefer clientsrc. But it definitely needs to be lower case to match javascript developer conventions.
Typically it would just be named app since that's where the main components / etc are located. Also since it's being server-side rendered it's not "just" a client-side app :)
I prefer it will not be called just src, since someone will put their HomeController.cs there. It not a good idea to mix *.ts and *.cs files in the same folder.
I have seen some projects, which include both server and client side code, have "src" folder containing "server" and "client".
Based on this discussion, it doesn't look like there will be one particular layout that everyone would consider ideal, so whatever we do will be arbitrary.
My best recommendation is that you rename ClientApp to whatever you like best in your own project. With this starting point, at least it's easy to rename and then search-replace for any references to the string ClientApp. Also, having a shared starting point for everyone makes the documentation much easier to understand (vs having warnings in every code snippet that you might have chosen a different name).
Most helpful comment
Also keep in mind the latest structure for ASP dotnet core solutions in Visual Studio (and possibly other project types?) is to create a src folder that contains all projects under the solution folder. Renaming ClientApp to src would be confusing I think.