Compile Targets
Write once in KERN. Compile to 11 framework targets.
How targets work
The --target flag tells the KERN compiler which framework to emit. Your .kern source stays the same — the compiler handles imports, idioms, and conventions for each target.
kern dev app.kern --target=nextjs --outdir=app/
kern dev app.kern --target=react
kern dev api.kern --target=express
kern dev api.kern --target=fastapiEvery target reads the same AST and applies its own code generation pass. Shared logic (types, machines, configs) compiles identically across targets. UI and routing nodes adapt to each framework's conventions.
Available targets
Target-specific configuration
Create a kern.config.ts at your project root to set defaults and target-specific options.
import { defineConfig } from '@kernlang/cli';
export default defineConfig({
target: 'nextjs',
outdir: 'app/',
frameworkVersions: {
next: '15',
react: '19',
},
structure: {
// Emit route-based directories (features/page.tsx)
routeDirs: true,
// Co-locate loading.tsx / error.tsx with page.tsx
conventions: true,
},
});When kern.config.ts is present, the CLI reads it automatically. You can still override any option via flags: kern dev app.kern --target=vue overrides the config target.
Choosing a target
Pick the target that matches your runtime.
Full-stack web
Use Next.js for apps that need SSR, metadata, and file-based routing. Use Nuxt if your team prefers Vue.
Client-only UI
Use React for SPAs and embedded components. Add Tailwind when your project already uses utility-first CSS. Use Vue for Vue 3 standalone components.
Mobile
Use React Native for iOS and Android. KERN maps to View, Text, and StyleSheet automatically.
Backend APIs
Use Express for Node.js APIs. Use FastAPI for Python APIs with Pydantic validation and async support.
CLI and terminal
Use CLI for argument-driven tools built on Commander.js. Use Terminal for ANSI output with gradients, spinners, and tables. Use Ink for interactive terminal UIs built with React.