Node Types
KERN has 102 node types organized into 11 categories. Each node compiles to idiomatic code for the active target.
Layout Nodes
Structural containers that define page hierarchy, scrolling regions, and grid systems.
page— Root page node with route and metadatalayout— Shared wrapper across pagesloading— Loading state placeholdererror— Error boundary componentscreen— Root node for React Native targetsrow— Horizontal flex containercol— Vertical flex containercard— Styled container with surface backgroundsection— Semantic section with optional title and idgrid— CSS grid containerscroll— Scrollable region
page name=Dashboard route=/dashboard
col {gap:24,p:40}
row {jc:sb,ai:center}
text value="Dashboard" tag=h1 {fs:32,fw:800}
button text="New Project" {bg:#f97316,c:#fff,br:8}
grid cols=3 {gap:16}
card {p:24,br:12}
text value="Revenue" tag=h3
text value="$42,100" {fs:28,fw:700}
card {p:24,br:12}
text value="Users" tag=h3
text value="1,204" {fs:28,fw:700}
card {p:24,br:12}
text value="Uptime" tag=h3
text value="99.9%" {fs:28,fw:700}Content Nodes
Text, media, and display elements for rendering content.
text— Text element with tag, value, and typography stylesimage— Image with src, alt, width, heightcodeblock— Syntax-highlighted code displayprogress— Progress bar with value and maxdivider— Horizontal rule separator
col {gap:12}
text value="Welcome Back" tag=h1 {fs:36,fw:800,c:#fff}
text value="Your project summary for this week." tag=p {fs:16,c:#a1a1aa}
row {gap:8,ai:center}
text value="Status:" tag=span {fw:600}
text value="Active" tag=label {c:#22c55e,fw:600}
divider
image src="/hero.png" alt="Hero" width=600 height=400
progress value=72 max=100Interactive Nodes
User input controls, navigation, and overlay components.
button— Clickable button with text, onClick, or to (link)input— Text input with type, placeholder, bindtextarea— Multi-line text inputtoggle— Boolean switch controlslider— Range input with min, max, stepselect— Dropdown select with option childrenoption— Option inside a selectmodal— Overlay dialogtabs— Tab group containertab— Individual tab inside tabslink— Navigation link
col {gap:16,p:32,maxW:480}
input placeholder="Email" type=email bind=email
input placeholder="Password" type=password bind=password
select bind=role
option value=admin label="Admin"
option value=editor label="Editor"
option value=viewer label="Viewer"
toggle bind=rememberMe label="Remember me"
slider min=1 max=100 step=1 bind=volume
textarea placeholder="Notes..." bind=notes rows=4
button text="Sign In" onClick=handleSubmit {bg:#f97316,c:#fff,br:8,p:12}Backend Nodes
Server-side nodes for APIs, middleware, real-time streams, and scheduled tasks.
server— Express or FastAPI server rootroute— HTTP route with method and pathmiddleware— Request middleware functionhandler— Route handler logicschema— Request/response schema validationstream— Server-Sent Events endpointspawn— Child process or workertimer— Interval or timeouton— Event listener bindingenv— Environment variable declarationwebsocket— WebSocket endpoint
server name=API port=3000
env name=DATABASE_URL required=true
middleware name=auth
middleware name=cors
route method=get path=/api/users
schema response=User[]
handler name=listUsers
route method=post path=/api/users
schema body=CreateUserInput response=User
middleware name=requireAdmin
handler name=createUser
stream path=/api/events
handler name=sseHandlerCLI Nodes
Command-line application structure with commands, arguments, and flags.
cli— CLI application rootcommand— Named command with descriptionarg— Positional argumentflag— Named flag with type and default
cli name=deploy version=1.0.0 description="Deploy CLI tool"
command name=push description="Push to production"
arg name=service description="Service name" required=true
flag name=force short=f type=boolean description="Skip confirmation"
flag name=region short=r type=string default=us-east-1
command name=rollback description="Rollback last deploy"
arg name=service description="Service name" required=true
flag name=steps type=number default=1 description="Steps to rollback"Terminal Nodes
Rich terminal UI components with ANSI colors, tables, gradients, and live displays.
separator— Horizontal separator linetable— Formatted table with columns and rowsscoreboard— Key-value metrics displaymetric— Single metric inside a scoreboardspinner— Animated loading indicatorbox— Bordered box containergradient— Gradient-colored textstate— Reactive terminal staterepl— Interactive read-eval-print loop
col
gradient value="Build Monitor" from=#f97316 to=#eab308
separator char=─
scoreboard
metric label="Build" value="passing" color=green
metric label="Tests" value="148/148" color=green
metric label="Coverage" value="94.2%" color=yellow
metric label="Deploy" value="pending" color=cyan
separator char=─
table cols=Name,Status,Duration
spinner text="Deploying to production..."
box title="Logs" border=round
text value="[12:01] Starting deploy..."
text value="[12:02] Build complete."
text value="[12:03] Health check passed."Next.js Nodes
App Router conventions for metadata, data fetching, navigation guards, and imports.
metadata— Static page metadata (title, description, og)generateMetadata— Dynamic metadata from paramsfetch— Server-side data fetchingnotFound— Trigger Next.js 404redirect— Server-side redirectimport— Explicit import declaration
page name=BlogPost route=/blog/[slug]
generateMetadata params=slug
fetch url=/api/posts/${slug} as=post
return title=post.title description=post.excerpt
fetch url=/api/posts/${slug} as=post
notFound when=!post
col {gap:24,p:40,maxW:720}
text value=post.title tag=h1 {fs:36,fw:800}
text value=post.date tag=p {fs:14,c:#71717a}
text value=post.content tag=p {fs:16,lh:1.8}Core Language Nodes
Type system, state machines, modules, and domain modeling primitives that compile to pure TypeScript.
type— TypeScript type alias with fieldsinterface— Interface with method signaturesfield— Typed field inside type, interface, or configfn— Function declarationmachine— State machine with typed transitionstransition— State transition inside a machineevent— Event type declarationerror— Custom error typemodule— Module grouping with exportsexport— Named export from a moduleconfig— Typed configuration objectstore— State store declarationunion— Discriminated union typevariant— Variant inside a unionservice— Service class declarationmethod— Method inside a service
type name=User
field name=id type=string
field name=email type=string
field name=role type=admin|editor|viewer
union name=ApiResult
variant name=Success fields=data:T
variant name=Error fields=message:string,code:number
machine name=OrderStatus initial=pending
transition from=pending to=confirmed event=confirm
transition from=confirmed to=processing event=process
transition from=processing to=shipped event=ship
transition from=shipped to=delivered event=deliver
transition from=pending to=cancelled event=cancel
transition from=confirmed to=cancelled event=cancelReact Nodes
React-specific primitives for hooks, context, memoization, and component lifecycle.
hook— Custom hook definitionprovider— Context provider componenteffect— useEffect declarationmemo— useMemo declarationcallback— useCallback declarationref— useRef declarationcontext— React context declarationstate— useState declaration
hook name=useDebounce params=value:T,delay:number returns=T
state name=debounced initial=value
ref name=timer type=NodeJS.Timeout
effect deps=value,delay
callback name=update
set debounced=value
timer name=timer fn=update delay=delay
return debouncedVue Nodes
Vue targets share the same KERN node types as React. The transpileVue and transpileNuxt compilers handle the translation to Vue 3 Single File Components and Nuxt 3 conventions respectively. Layout, content, and interactive nodes compile to their Vue equivalents automatically — no Vue-specific nodes required.
Template Nodes
Reusable template definitions with named slots for code generation patterns.
template— Named template definitionslot— Named insertion point inside a templatebody— Default content body of a template
template name=PageLayout
slot name=header
col {p:40,gap:24,maxW:960,m:0_auto}
slot name=title
body
slot name=footer
page name=About route=/about
use template=PageLayout
fill slot=header
row {jc:sb,ai:center}
text value="About" tag=h1
button text="Contact" to=/contact
fill slot=title
text value="Our Story" tag=h2 {fs:28,fw:700}
text value="We build tools for developers." tag=p