Frameworks
Deploy a React + Vite app to StaticHero
Build a React app with Vite, upload the dist folder, enable SPA routing and connect a domain — the complete walkthrough.
The StaticHero Team · · 1 min read
This guide takes a React app built with Vite from your laptop to a live HTTPS site. It takes about five minutes.
1. Build the app
In your project folder:
npm install
npm run buildVite writes the production files to dist/. Open dist/index.html to check it’s there — you should also see an assets/ folder with hashed JavaScript and CSS files.
Base path
If you changed base in vite.config.ts, set it back to "/". StaticHero serves every site from the root of its domain.
2. Create a site
Sign in to StaticHero, click New site, and choose an address.
3. Upload the dist folder
Drag the contents of dist — or the dist folder itself — onto the upload area. Folders are zipped in your browser and unpacked on our side, and if everything is inside a single folder we lift it automatically.
4. Turn on SPA mode
If you use React Router (or any client-side router), open Settings → Behaviour and enable Single-page app mode. Now /dashboard/settings serves index.html and React Router takes over, so refreshes and deep links work.
Alternatively, commit the rule with your code. Create public/_redirects:
/* /index.html 200Vite copies everything in public/ into dist/ on each build.
5. Check caching
Vite’s hashed asset names (like index-3f9a2c1d.js) are detected automatically and cached by browsers for a year, while index.html is always revalidated. You don’t need to configure anything.
6. Connect your domain (optional)
On a paid plan, go to Domains, add app.yourdomain.com, and create the CNAME record shown. HTTPS is automatic.
Updating
Run npm run build again and drop the new dist folder onto the same site. Each upload is a new version — if something breaks, use Restore on the previous one.
Put your site online in seconds — free.
Keep reading
Your site could be live in the next minute.
One site free, forever. No credit card, no setup, no servers.