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.
| Preview | Live | |
|---|---|---|
| Mode | SSR | SSG |
| What it is | A Next.js server | Static files |
| Content | Read on each request | Read at build time |
| Used by | Visor’s editor and reviewers | Your visitors |
Rendering modes
NEXT_PUBLIC_BUILD_MODE picks the mode at build time.
SSR
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 startscripts/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
| Trigger | What builds |
|---|---|
A push or merge to master | The preview and the live website. |
| Deploy in Visor | The live website of every frontend that is set up. |
| A scheduled publish | The live website of every frontend that is set up. |
| Rebuild preview in Visor | The preview. |
| Setting up a frontend | Both, 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
| Script | What it does |
|---|---|
npm run dev | Starts the development server. |
npm run build | A full production build. prebuild runs first and postbuild after. |
npm start | Starts a production server. SSR only. |
npm run generate:style | Compiles all themes. |
npm run tokens:build | Compiles the design tokens. |
npm run tokens:check | Fails if the compiled tokens differ from their source. |
npm run check:site-layer | Reports template files your site changed, and name clashes. |
npm run agents:sync | Generates the skills for Kiro and Antigravity. Template work. |
npm run agents:check | Fails if those copies differ from their source. |
npm run replicate:site | Captures a website as a design. See Convert a Design to Code. |
npm run design-system:export | Packages the design system for Claude Design. |
npm test | Runs the tests. Also test:watch and test:coverage. |
npm run lint | Runs ESLint. |
API routes
| Route | Live build | Purpose |
|---|---|---|
/api/widgets, /api/layouts, /api/theme | Yes | What the code offers. Visor reads them from the preview. |
/api/search | Yes | The search index. |
/api/image/[id] | Yes | Images. |
/api/draft, /api/data-sources, /api/content-block and others | No, SSR only | The 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.