Run on Live server

As a next.js project vercel is recommended for deployment because If you deploy on vercel then it will automatically do everything for us and there will be no need for customization.

Here is simple guide for deploying backend, store and admin on vercel:

  • Create a GitHub account, go to Vercel and sign up with that GitHub account.
  • Create three private repositories on GitHub, then push your backend code in backend repo and store code in store repo, and admin code in admin repository.
  • Watch this Video deploy on vercel, do according to.
  • When you import your GitHub repository on vercel by creating a project, you will see an option for Environment Variables, just click on that and add all of your local variables from .env or .env.local by copy and paste. Then click on deploy.
  • After the backend is deployed successfully, go to the project dashboard then you will find a URL for your API route that will look like this https://kachabazar.vercel.app/, click on there and if it successfully deployed then you will see the message with App works properly!. This live backend URL will need to use in store (NEXT_PUBLIC_API_BASE_URL) and admin(VITE_APP_API_BASE_URL) when you deploy your store and admin project.
  • Now create another two projects for store and admin. Deploy one by one same as backend project and put all .env.local variable On Environment Variables section before clicking on deploy button, then click deploy, it will take some time for build and after that build, you will see you live version of store and admin.

If you do accordingly, then everything will be okay, for now when you make any changes on your local file, you just need to push your code on GitHub, vercel will automatically detect those changes and will redeploy your project with updated features.

Also you will find many videos on youtube and also articles on google about how to deploy next.js and express apps on vercel.

Was this page helpful?