DeployServer
Node.js server
Run a krantho site as a Node process in a container or on a VM, with SQLite on a disk or Postgres, and pages rendered per request or cached by Next.js.
Every krantho site can run as a plain Node process: next start, a SvelteKit build from @sveltejs/adapter-node, or your Express server. It runs in any container or on any VM, with no CDN required. SQLite on a disk is enough for one server; Postgres serves several.
Set up
- Build and start.
next buildthennext start;vite buildthennode buildfor SvelteKit; your own server withNODE_ENV=productionfor Express. - Data. SQLite keeps everything in one file,
.krantho/content.dbby default. Putpaths.dataDiron a persistent volume. For several instances, use Postgres. - Media. The local store writes to disk and suits one server with a volume that the framework serves at
media.local.urlPrefix. Several instances need a disk they all share, or an object store: Vercel Blob, an S3-compatible bucket or Google Cloud Storage. - Sign-in. With
auth.modeatnone, every visitor to the admin is an admin. Turn on token or OIDC sign-in before the site serves real traffic; in production the server warns at startup when it is off.
- Build and start.
Configure
KRANTHO_SITE_BASE_URL=https://example.com # used by the sitemap, robots.txt and canonical links KRANTHO_PATHS_DATA_DIR=/data # the SQLite file on a persistent volume KRANTHO_JWT_SECRET=... # secret, one value for every instance # Next.js: keep each page until a change invalidates it KRANTHO_CACHE_PAGES=next-isr # Next.js on several instances: one page cache in the site's database, # set for the build and every start (next.config.ts sets the cache handler) KRANTHO_CACHE_SHARED=databaseCache
noneEvery request renders the page.SvelteKit and Express keep the default
cache.pages: 'none'. Every request renders the page from reads the content loader keeps forcontent.cache.ttlMs(five minutes by default), so a publish shows within that time. SetKRANTHO_CONTENT_CACHE_ENABLED=falseto read the database on every request instead. For pages kept at the edge, put CloudFront or Cloud CDN in front.Next.js with
cache.pages: 'next-isr'renders each page on its first request and serves it from Next's cache until a change in the admin invalidates what it shows. A publish refreshes the page at once; a change to a global or a list marks the pages that show it stale, served once more while they re-render in the background.next devcaches nothing.Next.js keeps that cache per instance. With several instances behind a load balancer, an invalidation reaches only the instance that took the write, so set
cache.shared: 'database': every instance then serves one cache from the site's own SQLite or Postgres database and sees every invalidation. The cache handler opens the database from the environment alone, and the filesystem provider has no database to share. See Rendering modes.Verify
- The server is up.
curl -s https://example.com/api/capabilitiesanswers with the site's capabilities, and/adminserves the admin. - A cached Next.js page. Request a page twice with
curl -sI. The second response carries Next'sx-nextjs-cache: HIT. - A publish. Change a page in the admin and publish it. The next request shows the change — at once with
next-isr, withincontent.cache.ttlMswithnone. - Startup warnings. In production the server logs a warning when
auth.modeisnone, or when sign-in is on andKRANTHO_JWT_SECRETis unset.
- The server is up.