Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here are the steps to deploy a Vite application that utilizes the MERN stack on Render.com:

  1. Initialize a new MERN project using Vite

Run the following command to initialize a new MERN project using Vite:

npx create-vite-app my-app --template mern
  1. Create a new GitHub repository

If you have not already done so, create a new GitHub repository for your project. You can do this from the GitHub website by clicking the "New repository" button.

Make sure to add and commit all your changes using git and push them to the GitHub repository.

  1. Create a new Render.com account

If you do not have a Render.com account, create a new account. Once you have signed up, you will need to link your GitHub account to Render.

  1. Create a new Render deployment

Once your GitHub account is linked, navigate to Render's dashboard and click "Create New" to create a new deployment. Choose GitHub as the repository source and select the repository you just created.

For the build command, enter:

cd client && npm install && npm run build && cd ../server && npm install && npm start

This command will build your client and server code and start the server once the build is complete.

  1. Configure environment variables

In the "Environment Variables" section of the deployment, add the following environment variables:

MONGO_URI=<your mongodb uri>
PORT=3000

Make sure to replace <your mongodb uri> with the URI for your MongoDB instance.

  1. Start the deployment

Click "Deploy" to start the deployment. Render will automatically deploy your application using Docker and create a new instance of the MERN stack on a large number of cloud providers. Once the deployment is complete, your application will be live and accessible via a public URL.

Congratulations! You have successfully deployed a Vite application that utilizes the MERN stack on Render.com.