This is a simple template for building "MEVN" stack with authentication.
it's simple you can deploy frontend and backend separately.
π» Frontend you can choose render, vercel, netify etc...
ποΈ Backend you can choose render, vercel etc...
π€ How to deploy frontend and backend together on Render ?
π» Frontend
-
set your website address in .env file
example:
VITE_API_URI="https://mevn-deploy.onrender.com" -
run cmd
npm run build -
copy all files from dist folder on frontend then paste into public folder on backend
ποΈ Backend
-
add your website address in allowed_origin.js file
example:
const origins = [ "http://localhost:3000", "http://localhost:5173", "http://192.168.1.13:5173", "http://localhost:5174", "http://192.168.1.13:5174", "https://mevn-deploy.onrender.com" ]; export default origins; -
push all of your source code into github
βοΈ Render
-
login > new > web service > build and deploy from a git repository
-
select your repo that you want to deploy > connet
-
input the information that render require and your enviroment variables
example:
- create web service then wait it until build successful
That's it, congratulation π₯³
go to backend and frontend folder and check ReadMe.md file.
π good luck, see you there.
