Deploying a static site
This guide is for deploying node apps with a React/SPA frontend and no backend.
Add custom build and start scripts
Add this script to your package.json
:
"render:build": "npm install && npm run build && npm prune --omit=dev",
Sign in to Render and create a Static Site
Go to render.com and sign in.
Click “New > Static Site”.
Authenticate your GitHub account if prompted.
You should see a list of repos to choose from. Select the one you want to deploy.
Choose branch and runtime
- Select the branch you want to deploy from (Render will auto-deploy from this branch)
Then set your commands in the Render service settings:
- Build Command:
npm run render:build
- Publish Directory:
dist
Click Deploy Static Site
That’s it!
Once your deploy completes, Render will show you the URL to your live site 🎉