Deployment Documentation - asrithadaida/GDP_ECommerce_Project GitHub Wiki

Requirements for deploying the code

  • Server: You need a server to host both the backend (NodeJS) and frontend (ReactJS) of the application.
  • Node.js and npm: Ensure that Node.js and npm are installed on the server for running both the backend and the frontend.
  • Database: Set up a MongoDB database to store application data.
  • Environment Variables: Set up environment variables for sensitive information like database connection strings, API keys, etc., to maintain security.

Steps to deploy the code to production

  • Prepare the codebase: Ensure that the code is properly structured and all necessary dependencies are listed in the package.json files for both the backend and frontend.
  • Set up the server environment: Install Node.js and npm on the server if not already installed. Set up MongoDB database and configure it with the backend.
  • Clone the repository: Clone the repository containing the project code onto the server.
  • Install dependencies: In the backend folder, run npm install command to install backend dependencies. In the frontend folder, run npm install command to install frontend dependencies.
  • Build frontend: In the frontend folder, run npm run build command to create a production build of the frontend.
  • Start the backend: In the backend folder, run npm start command to start the NodeJS server. Ensure it is listening to the appropriate port.
  • Serve the frontend: Configure the server to serve the static files from the frontend build directory.
  • Monitor and test: Monitor the deployed application for any issues, and conduct thorough testing to ensure everything is functioning as expected in the production environment.