the-road-to-graphql / fullstack-apollo-express-postgresql-boilerplate

💥 A sophisticated GraphQL with Apollo, Express and PostgreSQL boilerplate project.
https://roadtoreact.com
MIT License
1.2k stars 261 forks source link

Folder Structure #4

Closed tyagow closed 5 years ago

tyagow commented 6 years ago

First, nice project. I love it! I would like to ask you, what you recommend as folders structure for a bigger project? Your Components folder already has a lot of components. I'm new to React and would be great to know your opinion about it... Maybe we can come up with some ideas and I would happily send a PR with the new layout. A new branch, maybe?

Gamezpedia commented 6 years ago

+1 it's a HOT mess right now :D

ranganathk commented 6 years ago

Extending the above question, I see that you have created folders for each react component and added the component in the index.js of the folder. Any specific reason for this? Would it not be more convenient for searching to have component files like Messages.js instead of Messages/index.js?

rwieruch commented 6 years ago

Usually it's a folder per component. For instance:

Whereas the index.js for the MessageList exports the MessageList component, the index.js for the MessageItem exports the MessageItem component. Both components can either be used in the Message's index.js file or exported from there for the Message folder being a feature folder.

With the other naming convention, these file names would become redundant when having the prefix all the time:

After all, I think there are many ways of doing it. The shorter names with their explicit use cases are my way of doing it. The index.js and the feature folder approach is more driven from Node.js development.

However, I am open for changes to make it appealing for everyone :)

ranganathk commented 6 years ago

I liked the way we could include the storybook, css and spec file in the same folder. I would consider using this in my app. Thanks :+1:

rwieruch commented 6 years ago

Maybe I need to write about these different approaches at some point :)

Gamezpedia commented 6 years ago

hi, sorry i meant to say that it's quite difficult to work in editor, for example you won't know which file is open ; because every file title will be index.js , :) one more point - why don't you use ' apollo-boost ' i mean any specific reason ?.

thankyou :)

rwieruch commented 6 years ago

Wouldn't it be possible to include the path for the search? Something like "Mess MessageList" in the case of the example? That works for me in Sublime at least.

rwieruch commented 6 years ago

@Gamezpedia I see apollo-boost only as a zero-configuration package for getting started quickly with a prototype, but not for using it in larger applications where you have to add your own specific configuration. Does it make sense?