Packages

@thexjs/cli

The x command-line tool — dev server, production build, and production start, built on Bun.

terminal
bun add @thexjs/cli

Requires Bun on your PATH. The CLI shells out to bun and uses Bun-only APIs (Bun.serve, Bun.argv).

Commands

commands
x dev              # start the dev server with hot reloadx build            # build for production -> .x/x start            # run the production server (run x build first)x run dev          # "run" is optional  alias for npm/bun muscle memory-h, --help         # show help-v, --version      # print installed @thexjs/cli version--cwd <dir>        # run as if started inside <dir>

package.json scripts

package.json
{  "scripts": {    "dev": "x dev",    "build": "x build",    "start": "x start"  }}

Configuration

The CLI reads x.config.ts (or .js / .mjs) and passes its defineConfig(...) export to @thexjs/core:

x.config.ts
import { defineConfig } from "@thexjs/core";export default defineConfig({  pagesDir: "./src/pages",  contentDir: "./src/content",  port: 3000,});

Without a config file, defaults apply: src/pages for pages, content for content collections if present, port 3000.

What each command does

x dev

Auto-compiles src/styles/globals.css via bunx tailwindcss when that file exists, watches src/styles, then starts createApp() under Bun.serve. If the port is taken, tries up to 20 ports upward.

x build

Compiles Tailwind in production mode, then writes:

  • .x/client/ — prerendered HTML for static pages, plus public/ assets. Deployable to any static host.
  • .x/server/index.ts — server entry for SSR pages and API routes. Requires a Bun-capable host.

x start

Runs .x/server/index.ts with NODE_ENV=production. Exits with an error if the build output is missing.

Deployment

If every page uses mode = "static" and you have no API routes, deploy .x/client/ to any static host. Server-mode pages need a host that keeps a Bun process running (Fly.io, Railway, Docker, VPS) and runs x start.