weft
ir 2.6.0 · warp 1.8.0
Part one · Step 1 of 19

A page

One file is an application. Nothing is configured and nothing is generated by hand.

Goal

Get a page serving from a folder, and see that the route table, the plan and the tier were all derived from where the file sits rather than from anything you wrote down.

Start with a folder. There is no template to instantiate, no config to write, and nothing to register — a route is a file, and this one is the only file you need.

1 · Make the folder

sketch — not compiled
mkdir shop && cd shop
npm init -y && npm i weft
mkdir -p app/routes

2 · Write the one file

sketch — not compiled
// app/routes/index.tsx
import { fragment } from '@weftjs/core'

export default fragment(() => (
  <section>
    <h2>Today</h2>
    <p>Nothing yet.</p>
  </section>
))

3 · Serve it

sketch — not compiled
npx weft dev

4 · Ask the framework what it knows

There is no app/layout.tsx, so the page is wrapped in the framework’s own document. Ask what the plan is:

sketch — not compiled
npx weft routes
npx weft why /

One route, one slot named body, delivery buffered. Nothing streams because nothing asked to, and nothing is keyed because the fragment reads nothing — which means this page is already in the tier where a document is a file. npx weft build writes it as one.