Installation
Install x
x requires the Bun runtime. Scaffold a new project with the create command, or add the packages manually to an existing app.
Prerequisites
Install Bun — x uses Bun.serve, Bun.file, and other Bun-only APIs. Verify with:
bun --version
Create a new project
The fastest path is the project scaffolder. It copies a template, generates package.json, resolves the latest @thexjs/core and @thexjs/cli versions, and runs bun install.
bun create thexjs-app@latest my-appcd my-appbun run dev
When prompted for a template, press Enter to accept default (recommended) — a single home page to start from. Other templates include basic, blog, saas, and landing.
Available templates:default Blank slate with a single home page. (recommended)basic Minimal starter: pages, API route, auth, dashboard.blog Markdown content collections.saas Dashboard, settings, pricing, auth, data layer.landing Marketing site with docs pages.Choose a template (default/basic/blog/saas/landing) (default):
Pass a template explicitly with --template or -t:
bun create thexjs-app@latest my-app --template default
Add to an existing project
Install the core packages and wire up scripts in package.json:
bun add @thexjs/corebun add -d @thexjs/cli
{ "scripts": { "dev": "x dev", "build": "x build", "start": "x start" }}Create x.config.ts at the project root:
import { defineConfig } from "@thexjs/core";export default defineConfig({ pagesDir: "./src/pages", port: 3000,});Optional: environment validation
Add @thexjs/env when you want typed, validated environment variables:
bun add @thexjs/env
See the @thexjs/env docs for the full API.
Verify the install
x devcompiling Tailwind CSS...dev server running at http://localhost:3000