newX 1.3 — islands to disk, server-mode islands, image proxy

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 memoryOptions:--cwd <dir>        # run as if started inside <dir>--adapter <name>   # build target, e.g. "vercel" (default: Bun server -> .x/)--outDir <dir>     # output directory for build/start (default: .x)-h, --help         # show help-v, --version      # print installed @thexjs/cli version

x build --adapter vercel emits a .vercel/output tree (Build Output API v3) instead of .x/, and --outDir relocates the build (used by the repo's Dockerfile, which builds to dist).

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 a content/ directory is present, and src/actions is auto-detected for server functions. Port defaults to 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/ holds prerendered HTML for static pages, plus public/ assets. Deployable to any static host.
  • .x/server/index.ts is the server entry for SSR pages and API routes. Requires a Bun-capable host.

x start

Runs .x/server/index.ts with NODE_ENV=production (or --outDir dist). If the build has no server entry (all static), it serves .x/client/ as a plain static server with an SPA index.html fallback. 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.