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=fastapi

Every 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

Next.js

TypeScript

App Router, metadata, server components, route conventions

Learn more →

React

TypeScript

Hooks, state, effects, providers, memoization

Learn more →

Tailwind

TypeScript

React + Tailwind CSS utility classes

Learn more →

React Native

TypeScript

StyleSheet, View, Text, mobile-first

Learn more →

Express

TypeScript

Routes, middleware, schema guards, SSE

Learn more →

FastAPI

Python

Routes, Pydantic models, async, CORS

Learn more →

Vue

HTML+TS

Vue 3 SFCs with Composition API

Learn more →

Nuxt

HTML+TS

Nuxt 3 pages, layouts, server routes

Learn more →

CLI

TypeScript

Commander.js apps with args, flags, commands

Learn more →

Terminal

TypeScript

ANSI UI, spinners, tables, gradients

Learn more →

Ink

TypeScript

React for terminal, interactive TUIs

Learn more →

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.