Platform · web

Web

Static sites, single-page apps and server-rendered apps, all from the same app folder. Installable as a PWA with one option.

  • Static
  • SPA
  • SSR
  • PWA
kitr add web site --mode ssr

First time? Run npm i -g kitr once. Inside a project, the global kitr runs your project's own version.

// kitrrc.ts
import { defineKitrConfig } from 'kitr/app'
import { web } from 'kitr/web'

export default defineKitrConfig({
  platforms: {
    www: web({ mode: 'static' }),
    site: web({ mode: 'ssr', pwa: { name: 'Acme', themeColor: '#2D6CF0' } }),
    admin: web({ mode: 'spa', port: 3002 }),
  },
})

Three rendering modes, one option

static prerenders every route to HTML, spa serves one shell with client routing, and ssr renders on request through TanStack Start. Switch with kitr config site mode ssr.

Installable when you want it

pwa: true adds the web manifest and a service worker. useInstallPrompt and useServiceWorker from kitr/web/client show the install button and the update banner.

Search engines read it

kitr add seo writes config/seo.ts: page heads, share previews, the prerender list, the sitemap and robots.txt come from that one file.

As many sites as you need

A marketing site, an app and an admin panel are three named web platforms in one project, each with its own mode and port.

Same commands as every platform

Every platform answers to kitr dev, kitr build and kitr start, by the name you gave it. Leave the name off to run them all.

kitr dev site
Vite with hot reload on port 3000
kitr build site
dist/site/client, plus dist/site/server/server.js in ssr mode
kitr start site
serves the build with srvx

Packages that work here

25 packages run on web. Each one is a single kitr add away.

All packages →

Learn more

Start from a kit

A kit sets up the platforms, the packages and a first page in one command. Kits with web: app, fullstack, site, saas, realtime.

kitr new my-app --kit app

First time? Run npm i -g kitr once. Inside a project, the global kitr runs your project's own version.

Add another platform

Platforms share the app/ folder, so adding one is a command, not a rewrite.

Mix and match →