An adapter converts the compiler's IR into a template your server can render. The same JSX source produces correct output for any adapter.
JSX Source
↓
[Phase 1] → IR (backend-agnostic)
↓
[Phase 2a] IR → Adapter → Marked Template (server)
[Phase 2b] IR → Client JS (browser)#Available Adapters
| Language | Backend | Package |
|---|---|---|
| TypeScript | Hono | @barefootjs/hono |
| Go | html/template | @barefootjs/go-template |
| Perl | Mojolicious | @barefootjs/mojolicious |
| Perl | Text::Xslate | @barefootjs/xslate |
| Ruby | ERB | @barefootjs/erb |
| Python | Jinja2 | @barefootjs/jinja |
| PHP | Twig | @barefootjs/twig |
| PHP | Laravel Blade | @barefootjs/blade |
| Rust | minijinja | @barefootjs/rust |
| Java | Pebble | @barefootjs/pebble |
| — | CSR (browser only) | @barefootjs/client |
CSR is not an IR→template adapter. It renders components directly in the browser using client-side template functions — use it when the server can't (or shouldn't) emit the initial HTML.
The GoTemplateAdapter is web-framework-agnostic: its html/template output runs on any Go server. npm create barefootjs@latest ships scaffolds for Echo, Gin, Chi, and net/http (via --adapter) — see Go Template Adapter → Server integration.
For a backend not listed here, see Writing a Custom Adapter.
#How every backend renders
Each adapter emits two things per component: a marked template in the backend's own template language, and the client JS that hydrates it. On the server, a small runtime object written in the host language — bf in every template — renders the template. It supplies the hydration markers, context propagation, child-component rendering, script registration, and a JS-compatible helper library (string, truthy, array and string helpers, spread_attrs, …) so the template evaluates expressions the way the browser does.
Perl and PHP each share one runtime across two engines (Mojolicious and Text::Xslate; Twig and Blade). None of the runtimes require a web framework: they take a template directory and return HTML, so any HTTP layer can call them.
#Common Vite setup
Every adapter package exports the same Vite plugin from @barefootjs/<adapter>/vite:
import { barefoot } from '@barefootjs/erb/vite'
export default defineConfig({
plugins: barefoot({ components: ['components'], templates: 'templates' }),
})vite build writes the compiled templates to templates and the client JS to Vite's own build.outDir. Serve build.outDir as static assets; templates is a server-side source directory that your app reads and must never be served. See Vite Plugin for the options.