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 first, since 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 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
The scaffolder is feature-based: it prompts with a multi-select of tailwind, auth, content, hooks, and shadcn; pick nothing for a plain blank project. Ready-made example apps live under examples/ in the repo if you prefer a fuller starting point.
Pass features non-interactively instead: --tailwind, --auth, --content, --hooks, --shadcn. Also available: --no-install (skip bun install).
bun create thexjs-app@latest my-app --tailwind --auth
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 dev[x] compiling Tailwind CSS...[x] dev server starting...✓ dev server running at http://localhost:3000
(The Tailwind line only appears when src/styles/globals.css exists, which the default template ships.)