anikethsaha / mern

:tada: This is boilerplate for MERN stack with integrations like Redux and SSR :tada:
https://mern.netlify.com
MIT License
98 stars 44 forks source link

Better Docs #23

Closed anikethsaha closed 4 years ago

anikethsaha commented 5 years ago

Docs

The present documentation is fine but not so good and beginner friendly as most of the boilerplates are used as references by beginners.

It would have been better if it's more information-rich, more emojis (for friendly experience), more supporting links, better looks.

I have a plan to make a better doc using any doc creating tools or any library. Would Love to get help in this too

Maybe you can create a doc site for this using any of the doc site generators like docusaurus, docz, etc and I will host it. Or you can help with the existing documentation with more information on it. Please reach out to me if you have any doubts or suggestions. You can give your suggestions here too.

😃

Thanks

khobabc commented 4 years ago

How may i help?

anikethsaha commented 4 years ago

hey, @khobabc , thanks for responding. Maybe you can create a doc site for this using any of the doc site generators like docusaurus, docz, etc and I will host it. Or you can help with the existing documentation with more information on it. Please reach out to me if you have any doubts or suggestions. You can give your suggestions here too.

khobabc commented 4 years ago

@anikethsaha I would go ahead with docusaurus and a doc site. I'll open PR once done or I hope I can ping you if I have some questions.

anikethsaha commented 4 years ago

Great. Yeah sure do ping me anytime. My twitter Handle @anik220798

khobabc commented 4 years ago

@anikethsaha I got busy with my job and personal stuff and do not see myself completing this in foreseeable future. Please feel free to assign it to anybody else.

anikethsaha commented 4 years ago

@khobabc no issue man !. Will keep it open this for a while !

omaiyea commented 4 years ago

Hi @anikethsaha , I'd be interested in helping out. Actually, I tried to follow both existing setup directions and wasn't able to get the project to build locally, so I would have a few questions first :)

anikethsaha commented 4 years ago

That's strange 😕 please ask your questions!.
You can simply clone and di npm install

omaiyea commented 4 years ago

after I clone and do npm install, then I try npm run build, but I get this error:

ERROR in ./src/common/components/app.jsx
Module not found: Error: Can't resolve '../../client/redux' in '/Users/angelicao/projects/MERN-Boilerplate/src/common/components'
 @ ./src/common/components/app.jsx 9:0-43 31:15-20
 @ ./src/server/controller/ssr.js
 @ ./src/server/index.js

Have you seen it before? Maybe I'm missing something.

and I haven't used the create-web-app before this so I'm not familiar with it, but when I try the steps exactly in the readme, I get this:

ERROR No command specified.

Run $ cwa --help for more info.

I tried to play around with other steps based on a very quick read of the docs. I tried cwa run MERN-Boilerplate --src

but I get this:

FINDING Finding your project MERN-Boilerplate in

ERROR [src] doesn't exist

Do you know the right steps here?

Thanks in advance!!

anikethsaha commented 4 years ago

Don't use cwa with this now.....actually, that is a different project which is using a copy of this project.

Actually, as per your logs, this seems a bug....there must be some import/export mismatched Thanks, @omaiyea for pointing out!

If you can fix that it would be really helpful. Just need to check with the import directories.... You can submit a separate PR for that too. Else I will try to fix it as soon as I get some free time !

ypahalajani commented 4 years ago

Hey @anikethsaha

I was trying to bootstrap your app, Found the getting started section of readme very much misleading 🤔. But, somehow, I managed to get the "Hello" text printed in the web browser 🙂.

Following things were missing:

If you think all the above makes sense, let me know so that I can send the Pull Request (containing the fix and the updated readme) which fixes the repo's setup for others to start contributing in even a better manner 😇.

anikethsaha commented 4 years ago

Thanks a lot for pointing those errors. Yeah I got some export/import mismatch as well

Your suggestions looks good to me , Just few corrections

The export statement in the server's index.js is not required as it causes an error when starting the nodemon server

I guess exporting apps should not create nodemon err. And we need that app in order to tests the server. So I guess you can leave this.

The path to the redux store was incorrect and wrongly placed for store initialization.

Yea this is an issue, go for it 👍

cross-env and nodemon - not mentioned in devDependencies of package.json but are being used as commands in npm scripts.

Yeah add them in the devDependecies 👍

npm run client:dev to start the nodemon server.

it's server:dev not client:dev. 👍

About the last point you can mention that -

You can add these points to the npm scripts description.

1st Priority It will be to fix those exports errors.

ypahalajani commented 4 years ago

Hey, @anikethsaha I was occupied yesterday. I'll pick this up today.

anikethsaha commented 4 years ago

Yeah sure, no hurries :+1:

ypahalajani commented 4 years ago

Hey @anikethsaha

I have a query:

cross-env and nodemon - not mentioned in devDependencies of package.json but are being used as commands in npm scripts.

I think cross-env can be moved to dependencies of package.json while still keeping nodemon in the devDependencies as cross-env is a part of production mode script while nodemon is being used in development mode script only.

Some more findings

The export statement in the server's index.js is not required as it causes an error when starting the nodemon server.

The error was being caused because we were using the import and module.exports in the same file. Check this out

Some more question/s?

Also, do I push the changes in public/ or bin/ because I am not sure how these need to be updated when sending a PR?

anikethsaha commented 4 years ago

as cross-env is a part of production mode script while

Actually those script will be running from developer's terminal so I guess it can be used in devdependencies . While in production. Only public(for frontend) and bin (for server) folder will be shipped. And they should not be hacing any dev-dep. we need dep only related to code. and may be a advance production supporting node runtime wrapper like forever or PM2. So in the server:prod script it can be changed to these. But Still I would Iike to have a discussion upon them. server:prod will be runned on the hosted server 's terminal not in the user's terminal !. and that script is wrong it has to be bin/server/server.js

Also, do I push the changes in public/ or bin/ because I am not sure how these need to be updated when sending a PR?

Also leave the bundled output. Anyway I am going to remove public/js folder. no need of uploading in the repo. Cause it gonna be change

The error was being caused because we were using the import and module.exports in the same file. Check this out

Yea I guess that can be the reason. You can create a separate PR we can discuss there

ypahalajani commented 4 years ago

server:prod will be runned on the hosted server 's terminal not in the user's terminal !. and that script is wrong it has to be bin/server/server.js

ok, 👍

Also leave the bundled output. Anyway I am going to remove public/js folder. no need of uploading in the repo. Cause it gonna be change

👍

Yea I guess that can be the reason. You can create a separate PR we can discuss there.

This fix is available in #102

ypahalajani commented 4 years ago

Yea I guess that can be the reason. You can create a separate PR we can discuss there

Ok, i am removing the change from #102 and creating a separate PR for this.

ypahalajani commented 4 years ago

Also, i'll squash the commits when the PR #102 is reviewed and changes are reflected successfully.

anikethsaha commented 4 years ago

I am going to keep this open as we can have docs + tutorial site for this along with the demo #103 of this.

PS: I tried to add this in @CodeSandbox but I faced some issues regarding the ports may, IDK why !. Also for MongoDB, if @CodeSandbox has mongodb enabled in any of there port say 27017 then we can use using localhost itself but I dont think they have installed or not. I tried to use mongodb cloud and I kept the password in the @CodeSandbox secret which can be accessed by node's env variable but I guess it won't be safe as we can console.log the env variables and it will be logged.

Any other suggestions ?