{"id":51439757,"url":"https://github.com/lucid-softworks/browser","last_synced_at":"2026-07-05T10:30:21.489Z","repository":{"id":366408667,"uuid":"1276158245","full_name":"lucid-softworks/browser","owner":"lucid-softworks","description":"A web browser written from scratch — a platform-agnostic Rust engine (networking, HTML/CSS parsing, DOM, style, layout, paint) with a thin native app shell per OS.","archived":false,"fork":false,"pushed_at":"2026-06-28T23:45:56.000Z","size":3850,"stargazers_count":55,"open_issues_count":26,"forks_count":8,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-06-29T01:19:12.589Z","etag":null,"topics":["appkit","browser","browser-engine","css","dom","from-scratch","html-parser","layout-engine","rendering-engine","rust","swift","web-browser"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lucid-softworks.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-21T16:02:07.000Z","updated_at":"2026-06-28T23:51:30.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/lucid-softworks/browser","commit_stats":null,"previous_names":["lucid-softworks/browser"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/lucid-softworks/browser","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucid-softworks%2Fbrowser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucid-softworks%2Fbrowser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucid-softworks%2Fbrowser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucid-softworks%2Fbrowser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lucid-softworks","download_url":"https://codeload.github.com/lucid-softworks/browser/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lucid-softworks%2Fbrowser/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35151638,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-05T02:00:06.290Z","response_time":100,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["appkit","browser","browser-engine","css","dom","from-scratch","html-parser","layout-engine","rendering-engine","rust","swift","web-browser"],"created_at":"2026-07-05T10:30:19.000Z","updated_at":"2026-07-05T10:30:21.463Z","avatar_url":"https://github.com/lucid-softworks.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# browser\n\nA web browser written from scratch.\n\n- **Rust** is \"the inners\": the actual engine — networking, parsing, DOM, style,\n  layout, and paint. The engine is **platform-agnostic** and produces an RGBA framebuffer.\n- The **app shell** (window, URL bar, tabs, event loop) is a thin **native** layer per OS:\n  - **macOS** — Swift / AppKit *(current)*\n  - **Linux** — GTK4 *(planned)*\n  - **Windows** — Win32 *(planned)*\n\n## Guiding constraint\n\nThe **eventual goal is to rewrite everything in Rust**, including the parts we currently\nreuse. So every reused crate is walled off behind *our own* module boundary, and swapping\nit for a hand-written implementation later is a localized change, not a refactor:\n\n| Reused today | Hidden behind | Eventually replaced by |\n|---|---|---|\n| `ureq` (HTTP/TLS) | `net::fetch` → `net::Response` | hand-written HTTP/1.1 (TLS likely stays reused — DIY TLS is unsafe) |\n| `fontdue` (glyph raster) | `paint::GlyphRasterizer` trait | hand-written rasterizer |\n| `v8` (JS VM) | `js::Runtime` / `js::eval` | hand-written JS engine |\n| `cbindgen` (header gen) | build script only | n/a (build tooling) |\n\nEverything else — HTML tokenizer/tree-builder, CSS parser, DOM, cascade, layout, the\ncompositor — is ours.\n\n## Build \u0026 run\n\n### Prerequisites\n\n- **Rust** (stable) — install via [rustup](https://rustup.rs).\n- For App Shell: **Xcode command-line tools** (`xcode-select --install`)\n\nEnable the versioned git hooks (a `pre-push` hook that runs the same `rustfmt` +\n`clippy` gate as CI, so lint never fails the PR after the fact):\n\n```sh\ngit config core.hooksPath .githooks   # one-time, per clone\n```\n\n### Engine / tests only\n\nThe engine is plain Rust and builds on **macOS, Linux, and Windows**:\n\n```sh\ncargo build --workspace # Build\ncargo test --workspace  # Build and run tests\n```\n\n### The App shell (macOS only)\n\nThe app shell currently ships for **macOS** (Swift / AppKit), so a graphical browser today requires macOS.\nRun from the repo root:\n\n```sh\nbash scripts/build.sh              # debug: Rust lib + the Swift app\n./swift/.build/debug/Browser       # launch\n\nbash scripts/build.sh release      # optimized, bare executable\n./swift/.build/release/Browser     # launch\n\nbash scripts/build.sh release-app  # optimized + packaged + signed dist/Browser.app\nopen dist/Browser.app              # launch\n```\n\n## Architecture\n\n```\nURL ─▶ net (fetch) ─▶ html::parse ─▶ DOM ─▶ style (cascade) ─▶ layout ─▶ paint ─▶ RGBA\n                                                                                   │\n                                            crates/ffi (C ABI) ◀──────────────────┘\n                                                   │\n                                       Swift app blits the framebuffer to a layer\n```\n\nRust paints an RGBA framebuffer; Swift uploads it to an `NSView` via `CGImage` each frame.\nThis is the simplest possible Rust↔Swift boundary. (A display-list + CoreText path, or a\nGPU surface, can replace it later without touching the engine.)\n\n### Rust workspace (`crates/`)\n- `net` — fetch a URL → bytes + content-type *(reuses `ureq`)*\n- `html` — hand-written HTML tokenizer + tree builder → DOM\n- `css` — CSS tokenizer + parser *(stub; Phase 3)*\n- `dom` — arena-based node tree\n- `js` — JS runtime + DOM/`window`/`self` bindings; runs page scripts. Compile-time backend\n  switch: `backend-v8` (default, *reuses `v8`*) or `backend-lumen` (the from-scratch engine)\n- `css` — hand-written CSS parser (`\u003cstyle\u003e` blocks + inline `style=\"\"`)\n- `style` — cascade (UA + author + inline) → computed styles, box + flex/grid/position props\n- `layout` — block/inline/inline-block, **flexbox**, basic **grid**, and **positioning**\n  (relative/absolute/fixed) → positioned box tree (`TextMeasurer` decouples fonts)\n- `paint` — RGBA framebuffer + fill/text primitives; `GlyphRasterizer` trait\n- `engine` — orchestrates the pipeline; produces the framebuffer\n- `ffi` — C ABI (`staticlib`); `cbindgen` generates `include/browser.h`\n\n### Swift app (`swift/`)\n- `CBrowser` — system-library target wrapping `include/browser.h`\n- `Browser` — AppKit app linking `libbrowser_ffi.a`\n\n## Memory model\n\nTabs are **not** capped at 4 GiB. Unlike Chrome — which isolates each tab in its own\nrenderer process and runs V8 with pointer compression that effectively caps a tab's JS heap\nnear 4 GiB — every tab here is just heap inside our single **64-bit** process, and the JS\nengine (V8) uses no pointer compression. A tab is therefore limited only by the machine's\nRAM + swap. We set no `rlimit`, and size types on the hot paths are 64-bit (`net`'s body\nbackstop sits at 16 GiB, the DOM arena indexes with `usize`).\n\n## Contributing\n\nThis project is built **LLM-first**. We strongly prefer changes authored by a capable coding\nmodel — **Claude 4.8** or **GPT-5.5** — over hand-written code. The engine is large and intricate,\nand the agents are faster and more thorough here. Drive a model, review its work, and ship that.\nNote the model/tooling on your PR.\n\n- **PRs only.** `main` is protected; every change lands through a pull request.\n- **Conventional Commits.** The PR title must be `feat(...)`, `fix(...)`, `ci: …`, etc. CI enforces\n  it, and `release-plz` uses it to bump versions and write CHANGELOGs.\n- **CI on every PR:** `cargo test` on macOS / Linux / Windows, `fmt` + `clippy`, and the **WPT\n  conformance suite** (via the real `wpt run` harness over WebDriver) — it writes a pass-rate\n  summary to the run.\n- **Releases:** merging the release-plz version PR tags `vX.Y.Z`, which builds + signs + notarizes\n  the macOS app and publishes it as a GitHub release.\n\n### Where to start\n\nLooking for something to work on? The pinned [**WPT conformance tracker** (#40)][wpt-tracker] lists\nopen [web-platform-tests](https://github.com/web-platform-tests/wpt) failures sorted by difficulty —\nfrom 🟢 *good first issue* (small, self-contained, with a dedicated test to verify) through\n🔴 *high-impact* fixes that unblock thousands of subtests. Each issue has a verified root cause, the\nfailing test, exact subtest counts, the relevant spec section, and a one-line repro. Running the\nsuite locally — the real `wpt run` harness driving the engine over WebDriver — is documented in\n[`docs/running-wpt.md`](docs/running-wpt.md).\n\n**Claiming an issue:** comment `/claim` (or `.take`) on any open issue to have it assigned to you —\na bot assigns you and labels it `claimed`, no maintainer needed. Comment `/unclaim` to release it.\nThen open a PR that says `Closes #\u003cn\u003e` so it auto-closes on merge.\n\n[wpt-tracker]: https://github.com/lucid-softworks/browser/issues/40\n\n## Status\n\nThe app fetches a URL (`http(s)://` or `file://`) through the Rust engine, parses the HTML\ninto a DOM with our hand-written tokenizer/tree-builder, runs the page's inline `\u003cscript\u003e`\ntags through the embedded JS runtime (capturing `console` output), and paints the page's\nvisible text plus a console panel into the framebuffer the AppKit shell blits.\n\nThe shell is a **tabbed** browser: a translucent toolbar with SF Symbol back/forward/reload,\na pill address bar, per-tab engine instances + history, a tab bar with new/close, and\nshortcuts (⌘T/⌘W/⌘1–9, ⌘L, ⌘R, ⌘[ / ⌘]).\n\nPage scripts run with real **DOM bindings** (`document.getElementById`, `textContent`,\n`createElement`/`appendChild`, `document.title`) and browser globals (`window`/`self`/\n`globalThis`), so JS mutations show up in what's rendered. **CSS** is parsed and cascaded\n(UA + `\u003cstyle\u003e` + inline `style=\"\"`), and text is painted with the computed color, font\nsize, bold (faux), alignment, and `display:none`.\n\nJS also has timers/event-loop (`setTimeout`/`setInterval`/`queueMicrotask`/`rAF`, bounded\ndrain). Layout is a real **box model**: block/inline boxes with width/height, margins,\npadding, and borders; the engine paints backgrounds, borders, and content-box-wrapped text.\n\nJS runs in a fuller **browser environment** (`navigator`, `location`, `localStorage`,\n`history`, `matchMedia`, `getComputedStyle`, event listeners + `DOMContentLoaded`/`load`).\nThe engine fetches **external sub-resources** — `\u003clink rel=stylesheet\u003e` and `\u003cscript src\u003e`,\nresolved against the page URL and interleaved in document order — so real sites (e.g.\nWikipedia) render with their actual styling.\n\nLayout now does **flexbox** (direction/wrap/justify/align/grow/shrink/gap), **CSS\npositioning** (relative/absolute/fixed with shrink-to-fit + edge anchoring), **inline-block**,\nand a **basic grid** (explicit px/fr/% tracks), with correct container-height accumulation\n(siblings stack without overlap). JS DOM bindings write `style`/`classList`/attributes\nthrough to the DOM so script-driven styling re-renders.\n\nReal sites render: **imlunahey.com** (a Tailwind/TanStack site) renders cleanly with its\ntwo-column layout, cards, and styling, with zero console errors. JS-app sites that build\ntheir UI entirely at runtime (e.g. google.com — 95% `display:none` until its obfuscated JS\nruns) remain out of reach without a near-complete JS/web-platform implementation.\n\nLong pages **scroll** (mouse-wheel, per-tab, clamped to document height), and `\u003cimg\u003e`\n**images** are fetched, decoded, and blitted (sized by CSS dims or decoded intrinsic size).\n\nToward replacing `v8`, [**`lumen`**](https://github.com/lucid-softworks/lumen) is a from-scratch\nJS engine (std-only) behind the `backend-lumen` feature, grown against **tc39/test262** — it\n**passes the full suite: 53,376/53,376 (100%)**, including annexB, intl402, and staging. That\ncovers the language core plus the built-ins — closures, classes, generators \u0026 `async`/`await`\n(real suspension via stackful coroutines), ES modules (top-level await, `import defer`, source\nphase), `Proxy`/`Reflect`, `RegExp` (incl. `\\p{…}` and inline modifiers), typed arrays,\n`Promise`, `Intl`, and `Temporal`. It now lives in its own repo (extracted with full history,\nalong with its test262 runner and benchmark tooling) and is consumed here as a git dependency.\n\nDone: networking + external CSS/JS · HTML→DOM · tabs · JS (DOM bindings + timers + browser\nenv) · from-scratch JS engine (`lumen`, 100% test262) · CSS cascade · box-model +\nflexbox/grid/positioning layout + paint · scrolling · images.\nRoadmap: z-index paint order · floats · margin collapsing · fuller grid · `data:`/SVG images ·\nDOM events on input · `fetch`/XHR · concurrent fetch · GPU rendering.\n\n## Star History\n\n\u003ca href=\"https://www.star-history.com/?repos=lucid-softworks%2Fbrowser\u0026type=timeline\u0026legend=top-left\"\u003e\n \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://api.star-history.com/chart?repos=lucid-softworks/browser\u0026type=timeline\u0026theme=dark\u0026legend=top-left\" /\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://api.star-history.com/chart?repos=lucid-softworks/browser\u0026type=timeline\u0026legend=top-left\" /\u003e\n   \u003cimg alt=\"Star History Chart\" src=\"https://api.star-history.com/chart?repos=lucid-softworks/browser\u0026type=timeline\u0026legend=top-left\" /\u003e\n \u003c/picture\u003e\n\u003c/a\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucid-softworks%2Fbrowser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flucid-softworks%2Fbrowser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flucid-softworks%2Fbrowser/lists"}