Skip to Content
Developer GuideBuild and Hosting

Build and Hosting

Visor sets up and hosts each frontend for you, so you don’t usually build by hand. Each frontend has two websites, built from the same master.

PreviewLive
ModeSSRSSG
What it isA Next.js serverStatic files
ContentRead on each requestRead at build time
Used byVisor’s editor and reviewersYour visitors

Rendering modes

NEXT_PUBLIC_BUILD_MODE picks the mode at build time.

Renders each page on each request, so content is always fresh. The output is a standalone server. This is the mode that supports Visor’s editor, and the local dev server always uses it.

NEXT_PUBLIC_BUILD_MODE=ssr npm run build npm start

scripts/switchPage.js makes this work by copying page.<mode>.tsx over page.tsx, and route.<mode>.ts over route.ts, for the template’s routes. After a build it restores the SSR files, so if a local build fails, check git status before you commit.

Use ssr and ssg. The template still contains isr page files, but ISR mode isn’t currently usable.

What starts a build

TriggerWhat builds
A push or merge to masterThe preview and the live website.
Deploy in VisorThe live website of every frontend that is set up.
A scheduled publishThe live website of every frontend that is set up.
Rebuild preview in VisorThe preview.
Setting up a frontendBoth, for the first time.

The site’s GitLab repository runs its tests on master, then passes the code to the hosting.

A build’s status appears on the frontend’s Builds tab, and a failure shows an alert in Visor. The website keeps showing its previous build until a new one succeeds.

npm scripts

ScriptWhat it does
npm run devStarts the development server.
npm run buildA full production build. prebuild runs first and postbuild after.
npm startStarts a production server. SSR only.
npm run generate:styleCompiles all themes.
npm run tokens:buildCompiles the design tokens.
npm run tokens:checkFails if the compiled tokens differ from their source.
npm run check:site-layerReports template files your site changed, and name clashes.
npm run agents:syncGenerates the skills for Kiro and Antigravity. Template work.
npm run agents:checkFails if those copies differ from their source.
npm run replicate:siteCaptures a website as a design. See Convert a Design to Code.
npm run design-system:exportPackages the design system for Claude Design.
npm testRuns the tests. Also test:watch and test:coverage.
npm run lintRuns ESLint.

API routes

RouteLive buildPurpose
/api/widgets, /api/layouts, /api/themeYesWhat the code offers. Visor reads them from the preview.
/api/searchYesThe search index.
/api/image/[id]YesImages.
/api/draft, /api/data-sources, /api/content-block and othersNo, SSR onlyThe editor and data for browser code.

A build reads content as the site’s read-only account, at up to GODAAS_MAX_RPS requests per second per process. A large site’s live build takes longer for this reason.

Last updated on