Deploying a Vite SPA on GoDaddy PaaS

vite, deployment, devops

What we ran into deploying a Vite React app on GoDaddy's Node.js hosting, and how we fixed it.

The setup

Neural Bridge Labs is a React 18 SPA built with Vite 6. No SSR, no static export — just a client-side app that needs a static file server in production.

GoDaddy's PaaS platform runs Node.js. It does npm install, then npm start. There is no separate build step.

Problem 1: no start script

Vite projects don't ship with a start script. The dev server (vite) isn't meant for production. We needed something that builds and then serves the dist/ folder.

{
  "scripts": {
    "prestart": "vite build",
    "start": "serve dist -l tcp://0.0.0.0:${PORT:-3000} --single"
  }
}

The --single flag is important for SPAs. It rewrites all routes to index.html so client-side routing works.

Problem 2: PostCSS config collision

GoDaddy's container ships with a postcss.config.js that requires tailwindcss. We don't use Tailwind. The build failed with Cannot find module 'tailwindcss'.

Fix: override it in vite.config.js:

export default defineConfig({
  css: {
    postcss: { plugins: [] },
  },
});

Problem 3: devDependencies skipped

The platform installs with NODE_ENV=production, which skips devDependencies. Vite and its plugins were in devDependencies. Build failed because vite wasn't installed.

Fix: move build tools to dependencies. Not ideal for a library, but fine for an application that builds on the server.

What worked

Once we sorted all three, deploys just worked. Build runs in under 2 seconds, serve handles static files with caching headers out of the box, and health checks pass on first attempt. Took us longer to figure out than it should have, but that's GoDaddy PaaS for you.