Documentation
Everything you need to build with X
A fullstack framework for Bun. Static sites, server-rendered pages, API routes, and server functions, all in a single process.
Start here
Introduction
What X is, how the packages fit together, and a minimal page.
Get startedInstallation
Prerequisites, create command, features, and manual setup.
Get startedGetting Started
Project structure, your first page, and running the dev server.
Get startedTutorial: Hello World
Five-minute walkthrough: page, island, dev server, and production build.
Get startedMigration Guide
Move an existing Next.js or TanStack app to X.
Get startedPackages
@thexjs/core
Rendering engine: routing, SSR/SSG, islands, server functions, data layer.
Get started@thexjs/auth
Plug-and-play auth: credentials and OAuth2 (GitHub), sessions, and CSRF.
Get started@thexjs/cli
The x command: dev, build, start, and deployment output.
Get started@thexjs/env
Type-safe environment variable validation with fail-fast errors.
Get started@thexjs/adapter-vercel
Zero-config Vercel Build Output API v3 adapter for serverless deployment.
Get started@thexjs/hooks
SSR-safe React hooks: debounce, media query, localStorage, server actions, forms.
Get started@thexjs/mcp
MCP server that grounds AI coding agents in real X framework conventions.
Get startedGuides
Routing
File-based routing: static pages, dynamic segments, nested routes.
Get startedPages & Loaders
Static pages, server-rendered pages, and data loading.
Get startedLayouts
Nested layouts, dedicated layout directories, and root layouts.
Get startedAPI Routes
Build REST endpoints alongside your frontend pages.
Get startedServer Functions
Call server-side functions from the browser without REST.
Get startedIslands
Selective hydration: ship JS only for the interactive parts.
Get startedIncremental Static Regeneration
Static pages that revalidate on a timer or on demand.
Get startedClient Navigation & Images
SPA-style navigation on every <a> tag by default, plus the remote image proxy.
Get startedContent Collections
Markdown files with frontmatter that become routes.
Get startedMiddleware
Route-level middleware for auth, redirects, and validation.
Get startedData Layer
SQLite and PostgreSQL integration with migrations.
Get startedBuild & Deploy
Production builds, static export, and deployment.
Get startedConfiguration
x.config.ts reference: all options and defaults.
Get startedSecurity
Env isolation, CSRF protection, security headers, and rate limiting.
Get startedObservability
Structured logging, health probes, and APM error tracing.
Get startedAudit Trail
Structured security event logging with automatic secret redaction.
Get startedRequest Tracing
OTel-compatible request-scoped tracing with correlation IDs.
Get startedSecret Redaction
Automatic masking of bearer tokens, passwords, and API keys in logs.
Get startedBackpressure
Per-process admission control to limit concurrent requests.
Get startedThese docs are authored as .tsx components because many pages embed interactive code blocks with syntax highlighting, structured card layouts, and styled callouts that plain Markdown can't express. The rendered output is fully static — every page exports mode = "static" and prerenders to HTML at build time.