README: what wayBetter is, an architecture diagram, the npm create waybetter quick start with its real output, the packages, and wayBetter for X as the showcase (assets/readme: hero, SVGs, one muted looping clip)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
CRTkafa 2026-10-02 00:46:10 +07:00
parent 82c42b0986
commit 2a2175c999
8 changed files with 247 additions and 37 deletions

128
README.md
View file

@ -1,22 +1,35 @@
# waybetter <p align="center"><img src="assets/readme/hero.webp" width="880" alt="wayBetter, the framework, and wayBetter for X, the first app built on it"></p>
A framework for desktop apps that run one website (or a web app you would otherwise use through a <h1 align="center">wayBetter</h1>
heavy Electron client) in a small native window and extend it in place, the way BetterDiscord
extends Discord. You get tabs, split panes, several signed-in accounts side by side, themes,
plugins, a signed store for them, backups and updates. You write a small adapter that says what
the site is.
The first app built on it is [wayBetter for X](https://git.crt.fyi/CRT/waybetter-for-x). <p align="center"><b>Make the apps you use way better.</b> A framework for light desktop apps that wrap one
License: GPL-3.0-or-later. website and extend it in place, the way BetterDiscord extends Discord.<br>
GPL-3.0-or-later · <code>npm create waybetter</code></p>
```sh <p align="center"><a href="https://waybetter.fyi"><b>waybetter.fyi</b></a> ·
npm install waybetter # page runtime, shell, CLI tools <a href="https://www.npmjs.com/package/waybetter">npm</a> ·
npm create waybetter # scaffold a plugin, a theme or a whole app <a href="docs/ARCHITECTURE.md">Architecture</a> ·
``` <a href="docs/STORE.md">Store</a> ·
<a href="docs/STRING-PACKS.md">String packs</a> ·
<a href="https://git.crt.fyi/CRT/waybetter-for-x">wayBetter for X</a></p>
Links: [source](https://git.crt.fyi/CRT/waybetter) · [npm](https://www.npmjs.com/package/waybetter) · [waybetter.fyi](https://waybetter.fyi) You bring a site and a small adapter that says what the site is. wayBetter gives you the rest: a
Tauri 2 window with tabs, split panes and every account signed in side by side; a page runtime with
a plugin API, a theme engine and string packs; a signed Store with a safe install screen; backups,
encrypted sync and signed updates; and the tooling to scaffold, sign, scan and release it.
## The three layers | What you get | |
| --- | --- |
| **A window around the site** | Tabs in the titlebar, split panes, an address bar per tab, command palette, decks of columns, workspaces. One WebView profile per account, so all of them stay signed in. |
| **Plugins** | `*.plugin.js` files with a declared `@permissions` line, a themed UI kit (toast, dialog, prompt), commands in the palette, live reload in developer mode. |
| **Themes** | One JSON document: colours with contrast enforced, fonts per role (Google Fonts downloaded once, after asking), shapes, layout, decoration, icon packs, per-pane and per-account themes, a Theme Builder with a doctor report. |
| **String packs** | Data that re-words the site's own interface: a language it does not offer, a fix, your own wording. Never code. |
| **A signed Store** | One Ed25519-signed catalog for every wayBetter app, `waybetter://install` links, drag-and-drop and Open With, all through one install screen that shows the source, SHA-256, permissions and code first. |
| **Release tooling** | `waybetter store`, `release`, `privacy-scan`, `build-env`, `i18n` and `strings`: sign the catalog, build binaries free of the builder's paths, and refuse to ship a build with a privacy hit. |
## How it fits together
<p align="center"><img src="assets/readme/architecture.svg" width="880" alt="Architecture: a Tauri 2 window with a trusted shell webview and untrusted site-tab webviews running the page runtime, the Rust host underneath that re-checks every command, the app's adapter on the side and the waybetter tooling"></p>
A wayBetter app is one Tauri 2 window with several webviews. The framework has one piece for each A wayBetter app is one Tauri 2 window with several webviews. The framework has one piece for each
layer and does not need to know which site you wrap. layer and does not need to know which site you wrap.
@ -27,9 +40,58 @@ layer and does not need to know which site you wrap.
| Page runtime | `packages/runtime` (TypeScript, no dependencies) | Injected into tabs that are on the site's exact origin: one DOM hub and one fetch/XHR hub, the plugin API and its themed UI kit, the theme engine, split-view navigation, link routing, account reporting, deck columns, string packs. | | Page runtime | `packages/runtime` (TypeScript, no dependencies) | Injected into tabs that are on the site's exact origin: one DOM hub and one fetch/XHR hub, the plugin API and its themed UI kit, the theme engine, split-view navigation, link routing, account reporting, deck columns, string packs. |
| Shell | `packages/shell` (TypeScript and React) | The local UI around the tabs: `createShell(site)` gives tabs in the titlebar, split panes, address bar, command palette, account switcher, decks and workspaces; `createPanel(site)` gives the app's own settings tab (appearance, theme builder, plugins, store, backup, developer mode). | | Shell | `packages/shell` (TypeScript and React) | The local UI around the tabs: `createShell(site)` gives tabs in the titlebar, split panes, address bar, command palette, account switcher, decks and workspaces; `createPanel(site)` gives the app's own settings tab (appearance, theme builder, plugins, store, backup, developer mode). |
Both TypeScript packages ship as the npm package `waybetter` (plain ESM with `.d.ts`). The Rust Details of every module are in [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md).
crate is used from source, as a git submodule or a path dependency. Details of every module are in
[docs/ARCHITECTURE.md](docs/ARCHITECTURE.md). ## Quick start
```sh
npm create waybetter app kickapp -- --site kick.com --name "wayBetter for Kick" --yes
```
<p align="center"><img src="assets/readme/create-terminal.svg" width="820" alt="Terminal output: Created a wayBetter app in kickapp (32 files), then the next steps: cd kickapp, add the framework as a git submodule, npm install, npm run build, npm run tauri dev"></p>
The same tool starts a plugin or a theme:
```sh
npm create waybetter plugin -- --name "Hide Trends" # add --ts for TypeScript
npm create waybetter theme -- --name "Midnight Mint" --accent "#3ddc97"
```
The app scaffold adds the framework as a git submodule at `waybetter/` by default (`--host-source
path` and `--host-source git` are the alternatives). After `npm run tauri dev`, replace the
placeholder selectors in `src/site.ts` and `src-tauri/src/site.rs`. All flags:
`npm create waybetter -- --help`, and [packages/create-waybetter](packages/create-waybetter/README.md).
Inside an app, plugins and themes are plain files, the docs and examples are built in, and developer
mode reloads them as you save:
<video src="/CRT/waybetter/media/branch/main/assets/readme/make.mp4" poster="/CRT/waybetter/media/branch/main/assets/readme/make.webp" autoplay loop muted playsinline width="860"></video>
## Packages
| Package | Where | What it is |
| --- | --- | --- |
| [`waybetter`](https://www.npmjs.com/package/waybetter) | `packages/waybetter` | The npm package: the built runtime and shell (plain ESM with `.d.ts`), JSON Schemas for themes, icon packs, catalogs and i18n, the locales, and the `waybetter` command (`dev`, `store`, `release`, `i18n`, `strings`, `privacy-scan`, `build-env`) |
| `create-waybetter` | `packages/create-waybetter` | `npm create waybetter`: scaffolds a plugin (JS or TypeScript), a theme or a whole app. No dependencies |
| `@waybetter/runtime` | `packages/runtime` | The page runtime (published inside `waybetter`) |
| `@waybetter/shell` | `packages/shell` | Shell models, frame, panel and Store screens (published inside `waybetter`) |
| `waybetter-host` | `crates/waybetter-host` | The Rust host crate (features `tauri`, `net`, `app`), used from source as a git submodule or a path dependency |
## Built with wayBetter
<table>
<tr>
<td width="50%"><a href="https://git.crt.fyi/CRT/waybetter-for-x"><img src="assets/readme/showcase-panes.webp" alt="wayBetter for X: a theme per pane, two accounts in one window"></a></td>
<td width="50%"><a href="https://git.crt.fyi/CRT/waybetter-for-x"><img src="assets/readme/showcase-themes.webp" alt="wayBetter for X: fourteen themes, each a full redesign"></a></td>
</tr>
<tr>
<td colspan="2"><b><a href="https://git.crt.fyi/CRT/waybetter-for-x">wayBetter for X</a></b> (x.com; macOS, Windows, Linux). Tabs, split panes,
every account side by side, a deck, 14 themes, eight area plugins, string packs, drafts, and fixes
for X's own bugs. <a href="https://waybetter.fyi/x/">waybetter.fyi/x</a></td>
</tr>
</table>
Built something on wayBetter? Add it here with a pull request.
## A minimal adapter ## A minimal adapter
@ -92,21 +154,6 @@ The app itself is `waybetter_host::app` configured with an `AppConfig` and a `Si
implementation (what only your site knows: page scripts, legacy domains, link routing). Anything implementation (what only your site knows: page scripts, legacy domains, link routing). Anything
else the app needs is an ordinary `#[tauri::command]` in your crate. else the app needs is an ordinary `#[tauri::command]` in your crate.
## Start a project
```sh
npm create waybetter plugin -- --name "Hide Trends"
npm create waybetter theme -- --name "Midnight Mint" --accent "#3ddc97"
npm create waybetter app kickapp -- --site kick.com --name "wayBetter for Kick" --yes
```
The app scaffold adds the framework as a git submodule at `waybetter/` by default (`--host-source
path` and `--host-source git` are the alternatives). Its next steps, as the tool prints them:
`git init && git submodule add https://git.crt.fyi/CRT/waybetter.git waybetter`, then
`npm install`, `npm run build`, `npm run tauri dev`, then replace the placeholder selectors in
`src/site.ts` and `src-tauri/src/site.rs`. Flags: `npm create waybetter -- --help`.
See [packages/create-waybetter](packages/create-waybetter/README.md).
## The dev loop ## The dev loop
In a scaffolded app, `npm run dev` runs `waybetter dev --watch "node scripts/build.mjs --watch"`: In a scaffolded app, `npm run dev` runs `waybetter dev --watch "node scripts/build.mjs --watch"`:
@ -195,12 +242,19 @@ bun run test:create # scaffolds each kind into temp folders and checks them a
`test:create` also runs `cargo check` on a generated app (about a minute cold); `test:create` also runs `cargo check` on a generated app (about a minute cold);
`WAYBETTER_SKIP_CARGO_CHECK=1` skips that step. Requires Bun 1.4.2+, Node 24+ and Rust 1.88+. `WAYBETTER_SKIP_CARGO_CHECK=1` skips that step. Requires Bun 1.4.2+, Node 24+ and Rust 1.88+.
## Docs
- [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md): every module of the host, runtime and shell
- [docs/STORE.md](docs/STORE.md): the signed catalog, install links and the install screen
- [docs/STRING-PACKS.md](docs/STRING-PACKS.md): the string pack format and `waybetter strings check`
- [packages/waybetter](packages/waybetter/README.md), [packages/create-waybetter](packages/create-waybetter/README.md), [packages/runtime](packages/runtime/README.md), [packages/shell](packages/shell/README.md)
- A full app on the framework: [wayBetter for X](https://git.crt.fyi/CRT/waybetter-for-x), whose docs cover themes, plugins, area plugins and translating
## Contributing ## Contributing
Issues and pull requests go to [git.crt.fyi/CRT/waybetter](https://git.crt.fyi/CRT/waybetter). Issues and pull requests go to [git.crt.fyi/CRT/waybetter](https://git.crt.fyi/CRT/waybetter).
Keep the split: generic mechanisms belong here, site-specific ones in the app. If you built Keep the split: generic mechanisms belong here, site-specific ones in the app.
something on wayBetter, add it to the list below with a pull request.
| Project | Target | What it is | ## License
| --- | --- | --- |
| [wayBetter for X](https://git.crt.fyi/CRT/waybetter-for-x) | x.com | Tabs, split panes, real accounts side by side, themes, plugins, drafts and fixes for X's own bugs. | GPL-3.0-or-later. Made by [@CRTkafa](https://x.com/CRTkafa).

View file

@ -0,0 +1,127 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1200 760" width="1200" height="760" role="img" aria-label="wayBetter architecture: one Tauri 2 window with a trusted shell webview and one webview per site tab, a Rust host underneath, your adapter on the side, and the waybetter command for store, release and privacy tooling">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#0b1020"/>
<stop offset="1" stop-color="#06070c"/>
</linearGradient>
<radialGradient id="glow" cx="0.5" cy="0" r="0.7">
<stop offset="0" stop-color="#1d3a8a" stop-opacity="0.55"/>
<stop offset="1" stop-color="#1d3a8a" stop-opacity="0"/>
</radialGradient>
<linearGradient id="accent" x1="0" y1="0" x2="1" y2="0">
<stop offset="0" stop-color="#3b82f6"/>
<stop offset="0.55" stop-color="#22d3ee"/>
<stop offset="1" stop-color="#a855f7"/>
</linearGradient>
<marker id="arr" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="7" markerHeight="7" orient="auto-start-reverse">
<path d="M0 0L10 5L0 10z" fill="#64748b"/>
</marker>
<style>
.t{font-family:ui-sans-serif,"Segoe UI",system-ui,-apple-system,Helvetica,Arial,sans-serif;fill:#e6e9f2}
.m{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace}
.h{font-size:22px;font-weight:700;letter-spacing:-0.01em}
.k{font-size:12px;font-weight:600;letter-spacing:0.14em;fill:#7dd3fc}
.s{font-size:14px;fill:#a3acc2}
.c{font-size:13px;fill:#cbd5e1}
.box{fill:#0f1626;stroke:#24304a;stroke-width:1.2}
.trust{fill:#101b33;stroke:#3b82f6;stroke-width:1.4}
.site{fill:#140f26;stroke:#7c3aed;stroke-width:1.4}
.chip{fill:#17213a;stroke:#2b3a5c}
.ln{stroke:#64748b;stroke-width:1.4;fill:none}
.dash{stroke-dasharray:5 5}
</style>
</defs>
<rect width="1200" height="760" rx="18" fill="url(#bg)"/>
<rect width="1200" height="380" rx="18" fill="url(#glow)"/>
<!-- title -->
<text class="t k" x="48" y="54">— ARCHITECTURE</text>
<text class="t" x="48" y="92" font-size="32" font-weight="760" letter-spacing="-0.02em">One window, three layers, one small adapter.</text>
<rect x="48" y="104" width="560" height="3" rx="1.5" fill="url(#accent)"/>
<!-- the site -->
<rect x="48" y="138" width="760" height="64" rx="12" fill="none" stroke="#334155" stroke-dasharray="6 6"/>
<text class="t h" x="72" y="170" font-size="18">The website you already use</text>
<text class="t s" x="72" y="190">loaded live from its exact https origin, never copied: x.com, kick.com, …</text>
<!-- window -->
<rect x="48" y="226" width="760" height="300" rx="16" class="box"/>
<text class="t k" x="72" y="256">TAURI 2 WINDOW · SYSTEM WEBVIEW</text>
<!-- shell -->
<rect x="72" y="272" width="300" height="234" rx="12" class="trust"/>
<text class="t h" x="92" y="304">Shell</text>
<text class="t m s" x="92" y="326" font-size="12">packages/shell · local, trusted</text>
<g class="t c">
<text x="92" y="356">Tabs, split panes, address bar</text>
<text x="92" y="380">Command palette, accounts, decks</text>
<text x="92" y="404">Settings panel, theme builder</text>
<text x="92" y="428">Store and the install screen</text>
<text x="92" y="452">Workspaces, backup, updates</text>
</g>
<text class="t s" x="92" y="488" font-size="12">the only webview allowed to change anything</text>
<!-- tabs -->
<rect x="392" y="272" width="396" height="234" rx="12" class="site"/>
<text class="t h" x="412" y="304">Site tabs</text>
<text class="t m s" x="412" y="326" font-size="12">one webview + profile per tab · packages/runtime</text>
<g>
<rect x="412" y="342" width="110" height="30" rx="8" class="chip"/><text class="t c" x="425" y="362">Plugin API</text>
<rect x="530" y="342" width="106" height="30" rx="8" class="chip"/><text class="t c" x="543" y="362">Theme engine</text>
<rect x="644" y="342" width="124" height="30" rx="8" class="chip"/><text class="t c" x="657" y="362">String packs</text>
<rect x="412" y="380" width="110" height="30" rx="8" class="chip"/><text class="t c" x="425" y="400">DOM hub</text>
<rect x="530" y="380" width="106" height="30" rx="8" class="chip"/><text class="t c" x="543" y="400">Fetch / XHR hub</text>
<rect x="644" y="380" width="124" height="30" rx="8" class="chip"/><text class="t c" x="657" y="400">Link routing</text>
<rect x="412" y="418" width="110" height="30" rx="8" class="chip"/><text class="t c" x="425" y="438">Accounts</text>
<rect x="530" y="418" width="106" height="30" rx="8" class="chip"/><text class="t c" x="543" y="438">UI kit</text>
<rect x="644" y="418" width="124" height="30" rx="8" class="chip"/><text class="t c" x="657" y="438">Deck columns</text>
</g>
<text class="t s" x="412" y="488" font-size="12">untrusted: may only report about itself</text>
<!-- arrows site -> tabs -->
<path class="ln" d="M590 202 V268" marker-end="url(#arr)"/>
<!-- host -->
<rect x="48" y="550" width="760" height="166" rx="16" class="box"/>
<text class="t k" x="72" y="580">NATIVE HOST · RUST</text>
<text class="t h" x="72" y="612">waybetter-host</text>
<text class="t m s" x="258" y="612" font-size="12">crates/waybetter-host</text>
<g class="t c">
<text x="72" y="644">Every command re-checks its caller (webview label, exact origin)</text>
<text x="72" y="668">Profiles, settings, plugins, themes, fonts, workspaces</text>
<text x="72" y="692">Signed Store (Ed25519), backup, encrypted sync, signed updates</text>
</g>
<path class="ln" d="M222 506 V546" marker-end="url(#arr)" marker-start="url(#arr)"/>
<path class="ln dash" d="M590 506 V546" marker-end="url(#arr)"/>
<text class="t s" x="236" y="532" font-size="12">all commands</text>
<text class="t s" x="604" y="532" font-size="12">a short, reviewed list</text>
<!-- adapter -->
<rect x="836" y="138" width="316" height="300" rx="16" fill="#0f1a1a" stroke="#14b8a6" stroke-width="1.4"/>
<text class="t k" x="860" y="168" style="fill:#5eead4">YOUR APP</text>
<text class="t h" x="860" y="200">The adapter</text>
<text class="t s" x="860" y="222">what only your site knows</text>
<rect x="860" y="242" width="268" height="52" rx="10" class="chip"/>
<text class="t m c" x="876" y="264">site.rs · SiteSpec</text>
<text class="t s" x="876" y="283" font-size="12">hosts, account rules</text>
<rect x="860" y="304" width="268" height="52" rx="10" class="chip"/>
<text class="t m c" x="876" y="326">site.ts · SiteAdapter</text>
<text class="t s" x="876" y="345" font-size="12">selectors, API marks, links</text>
<rect x="860" y="366" width="268" height="52" rx="10" class="chip"/>
<text class="t m c" x="876" y="388">capabilities/*.json</text>
<text class="t s" x="876" y="407" font-size="12">who may call what</text>
<path class="ln dash" d="M836 290 H812" marker-end="url(#arr)"/>
<!-- tooling -->
<rect x="836" y="462" width="316" height="254" rx="16" fill="#151022" stroke="#a855f7" stroke-width="1.4"/>
<text class="t k" x="860" y="492" style="fill:#d8b4fe">NPM · waybetter</text>
<text class="t h" x="860" y="524">The tooling</text>
<g class="t m c">
<text x="860" y="558">npm create waybetter</text>
<text x="860" y="584">waybetter dev --watch</text>
<text x="860" y="610">waybetter store build|sign|verify</text>
<text x="860" y="636">waybetter strings check</text>
<text x="860" y="662">waybetter release</text>
<text x="860" y="688">waybetter privacy-scan</text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 7.4 KiB

View file

@ -0,0 +1,29 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 400" width="1000" height="400" role="img" aria-label="Terminal: npm create waybetter app kickapp creates a wayBetter app in kickapp (32 files) and prints the next steps">
<defs>
<linearGradient id="bg" x1="0" y1="0" x2="0" y2="1">
<stop offset="0" stop-color="#0d1222"/>
<stop offset="1" stop-color="#080a12"/>
</linearGradient>
<style>
.m{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,"Liberation Mono",monospace;font-size:15px;fill:#cbd5e1}
.p{fill:#22c55e}.d{fill:#7c8aa5}.o{fill:#e6e9f2;font-weight:600}.a{fill:#7dd3fc}
</style>
</defs>
<rect width="1000" height="400" rx="14" fill="url(#bg)" stroke="#24304a"/>
<rect width="1000" height="36" rx="14" fill="#121a2e"/>
<rect y="22" width="1000" height="14" fill="#121a2e"/>
<circle cx="22" cy="18" r="6" fill="#ef4444" opacity=".8"/><circle cx="42" cy="18" r="6" fill="#f59e0b" opacity=".8"/><circle cx="62" cy="18" r="6" fill="#22c55e" opacity=".8"/>
<text class="m d" x="500" y="23" text-anchor="middle" font-size="13">npm create waybetter</text>
<g class="m">
<text x="28" y="76"><tspan class="p">$</tspan> npm create waybetter app kickapp -- --site kick.com --name "wayBetter for Kick" --yes</text>
<text x="28" y="120" class="o">Created a wayBetter app in kickapp (32 files).</text>
<text x="28" y="160">Next:</text>
<text x="52" y="186"><tspan class="a">cd kickapp</tspan></text>
<text x="52" y="210"><tspan class="a">git init &amp;&amp; git submodule add https://git.crt.fyi/CRT/waybetter.git waybetter</tspan></text>
<text x="52" y="234"><tspan class="a">npm install</tspan></text>
<text x="52" y="258"><tspan class="a">npm run build</tspan></text>
<text x="52" y="282"><tspan class="a">npm run tauri dev</tspan></text>
<text x="52" y="306" class="d">then replace the PLACEHOLDER selectors in src/site.ts and src-tauri/src/site.rs</text>
<text x="28" y="356"><tspan class="p">$</tspan> <tspan class="d">▍</tspan></text>
</g>
</svg>

After

Width:  |  Height:  |  Size: 2 KiB

BIN
assets/readme/hero.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

BIN
assets/readme/make.mp4 Normal file

Binary file not shown.

BIN
assets/readme/make.webp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 60 KiB