Welcome! New to Spiderz? Get 40% off your first purchase.

Publish an AI-built React or Vue frontend on Spiderz

Tutorial 4 min ·

Build your React or Vue frontend on your computer, upload the result in cPanel, and make sure every page and connection works on your domain. If you uploaded the project folder and got a blank page, this is why: the server needs the built files, not the source.

The examples use Vite, which many AI tools set up. Your project's own README and scripts have the exact commands.

1 Find the build command and output folder

Open package.json and look at scripts. A Vite project usually has:

{
  "scripts": {
    "dev": "vite",
    "build": "vite build",
    "preview": "vite preview"
  }
}
  • dev runs the site while you work on it.
  • build makes the files to publish, usually in a dist folder.
  • preview shows those built files on your computer.

Use your project's own scripts; they may run extra checks. Vite explains static deployment.

2 Set the live addresses before building

The build bakes some addresses into the files, so set them first:

  • Where the site lives. At https://yourdomain.com/, Vite's base is /. In a subfolder such as /app/, set base to /app/ and the router to match. Vite's base option
  • The API address. http://localhost:3000 means "this computer" to a visitor's browser. Use the backend's real https:// address.
  • Sign-in return addresses, if the site has sign-in.

Change any of these later and you'll need to build again. Keep passwords and secret keys in the backend, never in the frontend. Handle API keys, environment variables and databases explains why.

3 Install and build

In the project folder, run the project's install and build commands. For npm with a package-lock.json:

npm ci
npm run build

npm ci installs exactly what the lock file lists. If it fails, give the error to your AI and fix it, rather than deleting the lock file or switching tools. npm ci

When the build finishes, it tells you where the output is, usually dist.

4 Preview the build on your computer

npm run preview

Open the address it prints and click through the pages. The output folder looks something like this:

dist/
  index.html
  assets/
    app-4f2a9c.js
    app-8b1d3e.css

The names in assets change with every build. Upload whatever your build produces.

5 Upload the contents of the output folder

Sign in to your Spiderz Account, open your hosting service and select Open cPanel. In File Manager, go to your domain's document root, usually public_html. Keep a copy of anything already there.

Upload the contents of dist, not the folder itself: index.html and assets/ should sit directly in public_html. Leave out src, node_modules, .git and any settings files.

For connecting the domain and checking HTTPS, follow steps 4 and 5 of Publish an AI-built static website on Spiderz.

6 Make inner pages work when opened directly

Many frontends handle navigation in the browser. Clicking to /dashboard works, but typing that address or refreshing gives a "Not Found" error, because there's no dashboard file on the server.

The fix is to send those requests to index.html and let the app show the right page. In public_html, add this to .htaccess:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.html$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . index.html [L]
</IfModule>

If .htaccess already exists, download a copy first and add these lines; don't replace the file, as it may hold rules cPanel needs. The rule assumes the site is at the domain's root; a subfolder needs a different RewriteBase. Vue Router's deployment notes cover other setups.

With this rule, the server never shows its own "Not Found" page, so make sure your app shows one for addresses it doesn't know.

7 Check outside connections

Open the live site and use each feature that talks to another service.

  • API errors in the browser console mentioning CORS mean the API doesn't yet accept requests from your domain. Add https://yourdomain.com to its allowed origins. http://, https:// and www. count as different.
  • Sign-in sends you back to the preview site. Update the return address in the sign-in provider's settings.

Check the result where it lands: the saved record, the email received, the signed-in session.

8 Test as a new visitor

In a private window and on a phone, open the home page, type an inner address directly, refresh it, and complete the site's main action.

If something fails, Your AI-built site works locally but fails online helps you find the cause. If you see an old version, re-uploading the same build won't help when a wrong address was built in: fix it, build again and upload.

Keep the source, the lock file and a copy of each uploaded build together, so the next update follows the same steps.

Did this solve it?

Reference docs