Site / foldkit-site

60-second example

ts
import { Site } from 'foldkit-site'

const Home = Site.route(homeRouter, AppRoute.Home, { title: () => 'Routing' })
const Person = Site.route(personRouter, AppRoute.Person, {
  title: ({ personId }) => `Person ${personId} | Routing`,
  section: 'People',
})

const AppSite = Site.make(Home, Site.mount(People, [Person]))

// One declaration builds the value and the address together.
const target = Site.target(Person, { personId: 3 })
target.route // AppRoute.Person({ personId: 3 })
target.url // '/people/3'

// And the tree answers structural questions off route values.
Site.chainOf(AppSite, target.route) // [People, Person]
Site.titleOf(AppSite, target.route) // 'Person 3 | Routing'
Site.sectionOf(AppSite, target.route) // 'People'

Site.route takes an existing full Foldkit Router — literal, slash, query, mapTo, all of it — and the route case it builds. The router stays the whole URL story; the Site adds hierarchy, metadata, and inspection without re-parsing anything.