Skip to content
ChatfuelSDK
Reference

Scripts in the generated app

Every npm script the scaffolded app ships with — what it runs, when you reach for it, and what has to be true first.

Every command below is npm run <name> from the app root, except npm start and npm test, which npm lets you type without the run.

The scripts

ScriptWhat it runsWhen you reach for itWhat has to be true first
devviteDay to day. Serves the app on port 5173 with the Chatfuel proxy plugin registered, so the token stays server-side.Dependencies installed, and a .env with CHATFUEL_TOKEN.
buildvite build && vite build -c vite.server.config.tsBefore start, and in a Docker image. Builds both halves.The VITE_* values you build with must match the ones the server will run with.
build:clientvite buildThe browser bundle alone. This is also what Vercel runs.Same.
build:servervite build -c vite.server.config.tsThe server bundle alone, into server/dist/entry.js. Plugin-free on purpose — it never touches the client.
startnode server/dist/entry.jsRunning the built app on your own host. Serves dist/ and proxies Chatfuel traffic, HTTP and WebSocket, with the token injected server-side.build or build:server has run. Listens on PORT, default 3000.
deploynode scripts/deploy-vercel.mjsPutting the app on Vercel, with no Git repository and no dashboard.A .env that passes its checks.
connect-gitnode scripts/connect-git.mjsMaking git push deploy, once there is a repository.A linked Vercel project — .vercel/project.json, written by deploy — and an origin remote.
checktsc --noEmit && tsc -p tsconfig.scripts.jsonBefore a commit. Two passes, because the app's tsconfig.json covers src, server, api and the two Vite configs and nothing else; the second pass is scripts/, which is JavaScript and is only type-checked because that config turns checkJs on.
testvitest runBefore a commit, and after any change to a module's root component.

Vercel builds with build:client only. server/entry.ts is never built or run there — the Vercel deployment answers Chatfuel traffic from api/chatfuel.ts instead, through the rewrite in vercel.json. A change you make to the Node server shows up under npm start and in Docker, and nowhere on Vercel.

What deploy actually does

Re-running is the normal case, so every step is idempotent: an existing .vercel/project.json is kept and the project is never re-created.

What test covers

Every module ships a render test that mounts its root component and renders the tree to a string. It runs without a browser, which is the point: nothing else in the app can catch a component that type-checks, passes every other gate and renders nothing.

The suite is the app's own. The design system and the API client are vendored as sources, but their tests are stripped on the way in — a scaffolded app should not hand you failing runs for code you did not write. Modules you did not select are deleted from the tree, so their tests go with them.

On this page