A modular, GPU-accelerated, security-first web browser engine built completely from scratch in pure Rust.
The engine does not rely on Chromium, WebKit, or Gecko internals. It implements its own HTML tokenizer, arena-based DOM tree, CSSOM cascade resolver, box-model layout calculator, hardware-accelerated paint pipeline via wgpu, custom stack-based JavaScript bytecode VM, native TLS 1.3 networking, and multi-process security architecture.
Live standalone Kestrel browser shell: wgpu GPU compositor, custom HTML layout, Omnibox, and multi-tab manager running on Windows.
[ Raw Network Stream / File Input ]
|
v
+-----------------------------+ +-----------------------------+
| HTML5 Tokenizer & Builder | | CSS Tokenizer & Parser |
+--------------+--------------+ +--------------+--------------+
| |
v v
[ Arena DOM Tree ] [ CSSOM Stylesheet ]
\ /
\ /
v v
+-------------------------------------------------------+
| Style Resolution & Specificity Matching |
| - Element Selector Matching (ID/Class/Type) |
| - Cascade Resolution & Computed Property Map |
+---------------------------+---------------------------+
|
v
+-------------------------------------------------------+
| Box Model Layout Calculation |
| - Content, Padding, Border, Margin Rects |
| - Block Formatting Context & Inline Runs |
+---------------------------+---------------------------+
|
v
+-------------------------------------------------------+
| Display List Paint Engine |
| - Draw Rectangles, Border Lines, Text Glyphs |
| - Decoded Texture Images (PNG / JPEG) |
+---------------------------+---------------------------+
|
v
+-------------------------------------------------------+
| GPU Hardware Compositor (wgpu) |
| - Low-level Vulkan / Metal / DirectX 12 |
| - Vertex Buffers, Layer Blending & Viewport |
+---------------------------+---------------------------+
|
v
[ Native Window Frame ]
- Resilient Parsing: Resilient tokenizer handling malformed HTML tags, unclosed attributes, comments, and doctypes without panicking.
- Arena Tree Structure: The DOM is represented as an index-linked memory arena (
Vec<DomNode>), eliminating raw cyclic reference-counting overhead and guaranteeing cache-locality.
- Selector Matching: Right-to-left evaluation supporting type, class, ID selectors, attribute selectors (
[attr],[attr="value"],[attr*="value"],[attr^="value"],[attr$="value"],[attr~="value"],[attr|="value"]), and combinators (>,+,~, descendant). - Cascade Specificity: Strict specificity tuple tracking
(id_count, class_count, type_count)honoring!importantdeclarations, stylesheet origin, and source order. - CSS Custom Properties & Variables: Full support for
--*custom properties with DOM tree inheritance and recursivevar(--name, fallback)resolution. - HTML5 User-Agent Default Stylesheet: Built-in standard styling for semantic elements, tables, lists, buttons, headings, and modern form controls.
- CSS Box Model: Computes exact coordinates for content, padding, border, and margin geometry.
- Formatting Contexts: Supports vertical block stacking, explicit and auto dimensions, overflow wrapping, and
display: nonepruning.
- Direct GPU Rendering: Powered by
wgputargeting cross-platform native graphics APIs (DirectX 12, Vulkan, Metal). - Text & Texture Pipeline: Hardware-accelerated glyph caching via
wgpu_glyphand native image texture decoders (PNG and JPEG).
- Compiler & Bytecode: Custom lexer, Pratt parser, and compiler translating ECMAScript subsets into compact bytecode instructions.
- Stack-Based Execution: Fast evaluation loop with local variables, arithmetic, closures, and branching.
- Mark-Sweep Garbage Collection: Fully functional cycle-detecting mark-sweep GC managing object allocations.
- DOM Bindings: Direct bidirectional bindings allowing JavaScript to manipulate the DOM tree dynamically.
- Pure Rust Cryptography: HTTP/1.1 client with modern TLS 1.3 encryption using
rustlsandwebpki-roots. - Resource Discovery: Discovers and fetches external stylesheets (
<link rel="stylesheet">) and remote assets automatically.
- Multi-Process Model: Clean separation between the privileged UI browser process and sandboxed renderer instances communicating over IPC channels.
- Policy Enforcement: Strict Same-Origin Policy (SOP) and Content-Security-Policy (CSP) headers verification.
- Transactional Storage: Origin-isolated IndexedDB transaction manager and session cookie jar.
- Multi-Tab Architecture: Dynamic tab creation, switching, and closing.
- Omnibox Navigation: URL normalization and search engine routing with interactive suggestion dropdowns.
- Right-Click Context Menu: Native contextual operations: Back, Forward, Reload, Copy Page URL, and Inspect Element.
- Dock Panel [F12]: Hardware-rendered diagnostic overlay supporting live tabbed panels:
Elements,Console,Network, andPerformance. - Live DOM Inspector: Recursive tree inspection with tag/attribute syntax highlighting, node IDs, and computed CSS box model dimensions.
- Diagnostic Logging: Direct integration with JavaScript runtime execution logs and network waterfall requests.
| Shortcut / Action | Description |
|---|---|
F12 |
Toggle built-in DevTools Dock Panel (DOM Inspector, Console, Network) |
Ctrl + T |
Open a new browser tab |
Ctrl + W |
Close the active browser tab |
Ctrl + R / F5 |
Reload the current page |
Ctrl + L |
Focus the Omnibox address bar |
Ctrl + + |
Zoom in page content |
Ctrl + - |
Zoom out page content |
Right-Click |
Open Context Menu (Back, Forward, Reload, Copy URL, Inspect Element) |
Scroll Wheel |
Smooth vertical page scrolling |
Install the standard Rust toolchain:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shOn Linux systems, install graphics and windowing libraries:
# Ubuntu / Debian
sudo apt-get install -y libx11-dev libxi-dev libxrandr-dev libxcursor-dev libxkbcommon-dev libwayland-dev# Clone the repository
git clone https://github.com/rahadbhuiya/browser_engine.git
cd browser_engine
# Run the test suite (124 unit tests covering DOM, CSSOM, Layout, JS VM, and Security)
cargo test
# Build and run the browser in release mode
cargo run --release- Rahad Bhuiya (@rahadbhuiya)
- Core Systems & Linux Kernel Engineer
- Author of
xdp-guardandExploidus OS
browser_engine is dual-licensed under open-source and commercial terms:
For open-source projects, academic research, and non-commercial exploration, this project is licensed under the GNU Affero General Public License v3.0 or later (AGPL-3.0-or-later).
Under this license, any web browser, embedded WebKit/Blink alternative, kiosk runtime, or server-side headless renderer incorporating, modifying, or linking browser_engine must make its complete source code available under compatible copyleft terms when distributed or deployed over a network. See LICENSE for the full text.
For enterprises, embedded device OEMs, financial/defense organizations, and proprietary software vendors who wish to embed browser_engine into closed-source commercial applications, security-isolated web views, or proprietary hardware without AGPLv3 copyleft obligations:
- Commercial licenses are available without copyleft requirements.
- Includes custom rendering pipeline integration, GPU backend porting, and dedicated support.
- For commercial licensing terms, proprietary SLA, and custom integration inquiries, contact:
[email protected].
