Skip to content

Deployment

How to run the app in development and produce/ship a production build. All commands run from the repo root (d:\WorkSpace\DevArea\NiftyToolKIT\xtract) unless noted.

TL;DR

GoalCommandOutput
Dev servernpm run devhttp://localhost:3000
Production buildnpm run builddist/ at the repo root
Build to another pathnpx vite build --outDir "D:/path/to/out" --emptyOutDirthat path
Preview a build locallynpm run previewserves dist/ on http://localhost:3000

Where is dist/?

The production build always lands in dist/ at the repository rootd:\WorkSpace\DevArea\NiftyToolKIT\xtract\dist. There is no build.outDir override in vite.config.js, so Vite uses its default (dist).


1. Development

bash
nvm use            # Node 20.19.1 (from .nvmrc)
npm install        # first time / after dependency changes
npm run dev        # Vite dev server on port 3000 (HMR)

npm run dev runs vite --host :: --port 3000. Edit files in src/ and changes hot-reload. No build artifact is produced in dev — everything is served from memory.


2. Production build

bash
npm run build

This runs node tools/generate-llms.js && vite build:

  1. generate-llms.js writes public/llms.txt (non-fatal — a failure here no longer blocks the build).
  2. vite build compiles src/ + index.html + public/* into dist/.

A successful run ends with a line like ✓ built in 1m 7s and a list of emitted dist/assets/* chunks. If you don't see that, the build didn't complete — see Troubleshooting below.

What dist/ contains

dist/
  index.html
  assets/…        ← hashed JS/CSS chunks (code-split per route)
  llms.txt  manifest.json  robots.txt  sitemap.xml   ← copied from public/

Preview the build locally

bash
npm run preview     # serves the built dist/ on http://localhost:3000

Use this to sanity-check the production bundle before shipping.


3. Build to a specific path (outside the codebase)

Use Vite's --outDir. When the target is outside the project root, also pass --emptyOutDir (Vite refuses to clear a directory outside the root without it):

bash
# absolute path
npx vite build --outDir "D:/builds/nefoxx" --emptyOutDir

# or via the npm script (args after -- are appended to `vite build`)
npm run build -- --outDir "D:/builds/nefoxx" --emptyOutDir

Notes:

  • A relative --outDir is resolved relative to the repo root (e.g. --outDir ../nefoxx-dist).
  • --emptyOutDir wipes the target directory first — point it at a dedicated build folder, never at a directory that holds other files.
  • generate-llms.js still writes to public/llms.txt in the repo (then Vite copies it into your --outDir).
  • Deploying to a sub-path (e.g. https://host/app/)? Add --base=/app/ so asset URLs resolve.

4. Shipping to production (Hostinger)

Production is static hosting: the contents of dist/ are served as the site root. Per the repo's Change Manifest policy, any src/** change requires a fresh npm run build and a redeploy of dist/; index.html and public/* are copied verbatim into dist/ and can be hand-replaced.

bash
npm run build
# then upload the CONTENTS of dist/ (not the folder itself) to the Hostinger web root,
# replacing the previous deploy.

Checklist before deploying:

  • npm run lint and npm test are green.
  • Environment values (.env.localVITE_*) are correct for the target — see Environment Variables.
  • You previewed with npm run preview.

Troubleshooting

npm run build finishes instantly / dist/ isn't updated. The old build script chained operators as node generate-llms.js || true && vite build. On Windows, npm runs scripts through cmd.exe, which groups that as generate-llms || (true && vite build) — so when generate-llms succeeds, vite build is skipped and the build exits 0 without producing anything. This was fixed: the script is now node tools/generate-llms.js && vite build and generate-llms.js is non-fatal. If you ever hit a similar silent build, run the steps explicitly:

bash
node tools/generate-llms.js     # optional; safe to skip
npx vite build                  # the actual build → dist/

Can't find dist/. It's at the repo root: d:\WorkSpace\DevArea\NiftyToolKIT\xtract\dist. Confirm the build printed ✓ built in …. A dist/ may also be .gitignore-excluded from view in some tools, but it exists on disk after a successful build.

Build is slow (~1 min). Expected for this app size. The > 500 kB chunk warning is informational.


Note: the internal docs portal builds separately

This documentation portal is not part of the app's production build. It has its own commands and output and must never ship to production:

bash
npm run docs:gen      # regenerate auto-generated reference pages
npm run docs:dev      # serve the portal locally
npm run docs:build    # static HTML → documentations/portal/docs/.vitepress/dist

See Contributing to these Docs.