Start
Getting started
Install the CLI globally, create a site from the starter and run it.
#Install the CLI
Install White.js globally with the latest tag. This gives you the white command everywhere:
npm install -g white-js@latestOther package managers:
pnpm add -g white-js@latest
yarn global add white-js@latest
bun add -g white-js@latestCheck it:
white --versionYou can also skip the global install and run the installer once with npx:
npx white-js@latest install example:site my-siteThe package exposes two binaries, white and white-js. Both point at the same file.
#Create a site
white install example:site my-site
cd my-site
npm run devOpen http://localhost:3000. The wizard asks for a folder, whether to install dependencies and whether to create a git repository, then shows live progress. Existing directories are never overwritten.
Skip the questions with arguments:
white install example:site my-site --yes # defaults, no questions
white install example:site my-site --no-install # only download
white install example:site my-site --git # also run git initWithout a terminal (CI, pipes) the installer prints plain lines and uses the defaults. Set NO_COLOR=1 to disable colors or WHITE_NO_ANIMATION=1 to disable decorative animation.
#Add White.js to an existing project
npm install white-jsAdd two scripts to package.json:
{
"type": "module",
"scripts": {
"start": "white run",
"dev": "white run dev"
}
}Create a page and its view:
white make route aboutThen run npm run dev for development or npm start for production.
#The starter at a glance
server/
routes/
client/index.js GET /
api/status.js GET /api/status
app/
views/ layout, pages, partials, error page
public/ styles, scripts, static assets
white.config.js optional: only what you change
.env PORT, LOG_LEVEL (copy from .env.example)Routes are discovered from files under server/routes. Templates live in app/views, and static files are served from app/public.
#Next steps
- Learn how routing maps files to URLs.
- Read Views and static files for the template helpers.
- Run
white doctorto check the project andwhite routesto list every route. - When you are ready, deploy to Vercel.