The first step to improve our project structure is to create a source directory and relocate our entry file. Our main goal is to keep organized our application, and then remember to update our package.json file.
If everything is well, we should be able to restart the application and expect the same result. From this point, we don't want to keep manually restarting our application. Hopefully, there is a tool for that named nodemon, just remember to install it as a development dependency.
We add a new script and we call it dev. It will run nodemon on our index file.
In this case, we only care about changes on our source directory, so we can limit its scope with the watch flag. Going back to the terminal, we execute churn run dev. Now, we can go modify and save any of our files, and the server will automatically restart.