Getting Started
Get started with x
Create a new x project, learn the project structure, and build your first page.
Create a project
The fastest way to start is with the project scaffolder. See Installation for prerequisites and template options. Quick version:
bun create thexjs-app@latest my-appcd my-appbun run dev
Press Enter at the template prompt to use default (recommended) — a single home page. Your app will be running at http://localhost:3000.
Manual setup
If you prefer to set up manually, create a directory and add x:
mkdir my-app && cd my-appbun init -ybun add @thexjs/corecat << EOF > x.config.tsimport { defineConfig } from "@thexjs/core";export default defineConfig({pagesDir: "src/pages",});EOF
Project structure
A typical x project looks like this:
my-app/x.config.tssrc/pages/ // File-based routesindex.tsxabout.tsx_404.tsxblog/[slug].tsxlayouts/ // Nested layoutsmain.tsxapi/ // API routeshello.tsactions/ // Server functionsgreet.tscontent/ // Markdown contentposts/hello-world.md
Your first page
Create src/pages/index.tsx with a simple component:
src/pages/index.tsx
export default function Home() { return ( <div> <h1 className="text-4xl font-bold">Hello x!</h1> <p className="text-muted-foreground">Welcome to your new app.</p> </div> );}Running the dev server
Start the development server with hot reload:
x dev[x] resolving routes...[x] found 3 routes in 12ms[x] dev server running at http://localhost:3000
The dev server watches your src/ directory and automatically reloads when files change.