Create an app

5 min·Assumes: nothing

One command gets you a running app. Then you change a line, watch the page update, and build it for production. Takes roughly 5 minutes to learn.

Create your app

Here is a pretend terminal. Press Enter to see what the command creates, then hover any file to see what it's for. Prefer pnpm, Yarn or Bun? Type that instead, and every command on this page switches to match.

A pen-and-ink drawing of a desk. A sheet of paper drawn as a terminal waits at a shell prompt that takes the create command of npm, pnpm, yarn or Bun, the other managers named at the foot of the sheet: type one and press Enter, or press Enter on the empty line to take the suggestion. The commands on this page then follow the package manager you ran. It then asks the real questions one at a time: what you are building, the app's name, where it runs, whether to install dependencies and initialize git, and whether to create the app. Arrow keys move, Enter picks, typing names the app, Escape starts over. Below lies a closed folder labelled with the app's name. On Create app it opens and every file the chosen starter writes drops into it as a sheet of paper; the first page's name is washed yellow. Hover, tap or focus a sheet to read what that file is for.

Now do it in your real terminal:

npm create markless@latest

pnpm create markless

yarn create markless

bun create markless

Every question has a sensible default, so Enter, Enter, Enter is fine. Nothing touches your disk until you pick Create app.

Start the dev server

The dev server is what runs while you work. It serves your app at localhost:3000 and updates the page every time you save. Try it here first:

A pen-and-ink drawing of a desk. A sheet of paper drawn as a terminal shows cd my-markless-app already run, and a prompt waiting for you to run the dev script with npm, pnpm, yarn or Bun, the other managers named at the foot of the sheet. Below it lies a browser window at localhost:3000, still blank. Type one and press Enter, or press Enter on the empty prompt to take the suggestion: the dev server prints its Local address, and the browser shows the starter page frompages/index.tsrx, a Markless Router heading and a Count button. Press that button to count, as the real page does. Escape starts over.

Now in your real terminal:

cd my-markless-appnpm run dev
cd my-markless-apppnpm run dev
cd my-markless-appyarn run dev
cd my-markless-appbun run dev

Open localhost:3000. You'll see a heading and a button that counts.

Make a change

That whole page is one file, pages/index.tsrx. Here is the same file with a stylesheet and one extra attribute on <main>, so a seedling grows as you count. Click Count 0 a few times, then work through these:

PlaygroundRestored your edit

Markless Router

Try this
  1. To do: Change the heading to My first app.
  2. To do: Start the count at 10 instead of 0. It opens in full flower.
  3. To do: Under the button, add <p>Clicked {count} times</p>. Click the button, and both lines update.

Now make the same edits in your real file and save. The page updates on its own.

One thing worth knowing: the file name is the URL. index is /, so pages/about.tsrx is /about.

Build for production

When you're ready to put it online, build it and preview the build. This is exactly what your users get:

npm run buildnpm run preview
pnpm run buildpnpm run preview
yarn run buildyarn run preview
bun run buildbun run preview

The build is a Node server out of the box. Deploying to Vercel or another host? Deploying walks you through it.

Where to go next

You just edited your first .tsrx file without anyone telling you what it all means. Reading a .tsrx file fixes that, line by line.