|
| 1 | +# devframe-starter |
| 2 | + |
| 3 | +Self-contained starter for a single [devframe](https://github.com/devframes/devframe) integration: a vanilla-TS Vite client, a CLI dev/build/MCP shell, single + hub playgrounds, and unit + e2e tests. Copy this folder out of the monorepo as the seed for a new devframe - it pins real dependency versions (no `catalog:`/`workspace:*`) so it installs standalone. |
| 4 | + |
| 5 | +## Run |
| 6 | + |
| 7 | +```sh |
| 8 | +pnpm install |
| 9 | +pnpm run build # build the vanilla-TS SPA into dist/client |
| 10 | +pnpm run dev # CLI dev server - http://localhost:7391/__devframe-starter/ |
| 11 | +pnpm run cli:build # static deploy in ./dist/static |
| 12 | +pnpm run play:single # Vite playground: SPA at /, RPC bridge at /__devframe-starter/ |
| 13 | +pnpm run play:hub # Vite playground: mounted as a dock inside a devframes hub |
| 14 | +pnpm run test # unit tests (vitest) |
| 15 | +pnpm run test:e2e # e2e tests (playwright, against the single playground) |
| 16 | +pnpm run lint |
| 17 | +pnpm run typecheck |
| 18 | +``` |
| 19 | + |
| 20 | +`pnpm run dev` and both playgrounds gate by default: opening the printed URL walks you through devframe's interactive OTP handshake (a 6-digit code) before the SPA can call RPC. That's intentional - see the `auth` comments in `src/devframe.ts` and `playground/*/vite.config.ts` before reaching for `auth: false`, which trusts every connection that can reach the port. For a one-off loopback-only session, pass `--no-auth` to the CLI instead (`pnpm run dev -- --no-auth`). |
| 21 | + |
| 22 | +## File map |
| 23 | + |
| 24 | +| Path | Purpose | |
| 25 | +|------|---------| |
| 26 | +| `src/devframe.ts` | The single `DevframeDefinition` every surface below consumes. | |
| 27 | +| `src/rpc/` | The one RPC function (`get-state` - a query+snapshot returning runtime info and a directory listing) and its namespace declaration. | |
| 28 | +| `src/client/` | The vanilla-TS SPA: `index.html`, `main.ts`, `app.ts`, `styles.css`. | |
| 29 | +| `src/shared/base-path.ts` | The devframe's base path, shared between the node-side definition and browser-side client entries. | |
| 30 | +| `bin.mjs` | `createCac(devframe).parse()` - exposes `dev`, `build`, `mcp`. | |
| 31 | +| `playground/single/` | Vite dev-serves the SPA (with HMR) while `devframeViteBridge` answers RPC/discovery at the devframe's own base - see the comment in its `vite.config.ts` for why the two can't share one base. | |
| 32 | +| `playground/hub/` | A minimal `@devframes/hub` host that mounts this devframe as an iframe dock (requires `pnpm run build` first). | |
| 33 | +| `test/` | Unit tests - RPC functions over a real WebSocket, no browser. | |
| 34 | +| `e2e/` | Playwright tests against the single playground, using the checked-in `e2e/fixtures/` directory as a fixed working directory. | |
| 35 | + |
| 36 | +## Versioning |
| 37 | + |
| 38 | +Dependencies here are real semver ranges, not the monorepo's pnpm catalog - so this folder is copy-paste ready outside the workspace. When developed in-repo, pnpm links `devframe`/`@devframes/*` to the local workspace packages automatically. See the root `AGENTS.md`'s `starter/` note for how a repo-wide `bumpp -r` release keeps these versions in sync. |
0 commit comments