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:

terminal — bun
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.

~/projects — zsh
bun create thexjs-app@latest my-app
cd my-app
bun 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.

template selection
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:

~/projects — zsh
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:

terminal
bun add @thexjs/core
bun add -d @thexjs/cli
package.json
{  "scripts": {    "dev": "x dev",    "build": "x build",    "start": "x start"  }}

Create x.config.ts at the project root:

x.config.ts
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:

terminal
bun add @thexjs/env

See the @thexjs/env docs for the full API.

Verify the install

terminal
x dev
compiling Tailwind CSS...
dev server running at http://localhost:3000