Introduction

Preparation process

You need to be sure to have install some components so you can work fine. The first one is node.js, you can check if you already have it or not just write node -v in the terminal.
If you don't have it just need to go to Node.js and continue the instructions.
Then you have to create an initial react package, you can create a complete proyect using node, just write npx create-react-app <app-name> this code will create a directory with all you need to start the application.

Let's Start

First you need to have a directory where you are going to work. Once there, the first command you should do is npm init, and answer all the questions it ask you you set it up.

Modules dependencies

For deployment

We are going to install some dependencies, in this case the first one will be Express, to do it just write npm i express, then we also need Concurrently, this is used to let the future client use the app easy, it is not necessary if you don't want it. To install il just write npm i concurrently.
If you want to organize better all the routes, if your app have many routes also include the next module: npm i express-mongo-db, and also, as we are going to work with mongodb in this case, run npm i mongodb

For development

For development, we will install another dependencie, it is call Nodemon, this let you run the server and automatically refresh it when you change something so you don't have to stop and start again. to do it just write npm i nodemon --save-dev, the command is a little bit different so you can save it just for development.
To work better with environment variables, just add npm i --save-dev dotenv

Lets continue

Now just go to the package.json file to make some changes, in the scripts section, lets put the next ones:


Now you need to create a server.js file. And lets start working on it.