You'll want to create two separate project folders for this project: client and broker. Create these folders and run the following command:
npm init -y
In the client folder, run the following command:
npm i --save mqtt dotenv
In the broker folder, run the following command:
npm i --save mosca
Then, in both folders, create an index.js and a .env file.