Documentation

API & CLI

Render a route programmatically or use the two focused commands included with the package.

Programmatic API

Import createTinySite from the package and create a site instance:

import { createTinySite } from '@carl.fyi/tinyjs'

const tiny = await createTinySite()
const result = await tiny.render('/about')

render(path) resolves the content document, selected template, nested layouts, site data, generated navigation, and matching response metadata. It returns:

{
  html,
  status,
  headers,
  path,
  sourcePath
}

Command line

tinyjs build [--root path] [--out dist]
tinyjs serve [--root path] [--host 127.0.0.1] [--port 8080]

Run the local binary through npx:

npx tinyjs serve
npx tinyjs build

--root selects a site directory. --out changes static output from the default dist. --host and --port change the HTTP listener.

Package development

When developing TinyJS itself, the package exposes:

npm run build
npm run typecheck
npm test

These are package-development commands rather than requirements for a site using TinyJS.