10 ms·
Show HN: Vaev – A browser engine built from scratch (It renders google.com)
We’ve been working on Vaev, a minimal web browser engine built from scratch. It supports HTML/XHTML, the CSS cascade, @page rules for pagination, and print-to-PDF rendering. It even handles calc(), var(), and percentage units—and yes, it renders Google.com (mostly).
This is an experimental project focused on learning and exploration. Networking is basic (http:// http:// and file:// only), and grid layouts aren’t supported yet, but we’re making progress fast.
We’d love your thoughts and feedback.
- abhisek 1y agoWhat’s the long term goal of this project beyond learning? Building a browser to support the modern web is a humongous work IMHO.
- monax 1y agoThe main goal is great support for static documents rendering as it's being used at the core of the paper-muncher [1] PDF rendering engine, meant to replace wkhtmltopdf at odoo. But we don't exclude general web browsing and JavaScript support at some point. [1] https://github.com/odoo/paper-muncher https://github.com/odoo/paper-muncher
- dmkolobov 1y agoOoh blast from the past! At a previous company we moved off of wkhtmltopdf to a nodejs service which received static html and rendered it to pdf using phantomjs. These days you probably use puppeteer. The trick was keeping the page context open to avoid chrome startup costs and recreating `page`. The node service would initialize a page object once with a script inside which would communicate with the server via a named Linux pipe. Then, for each request: 1. node service sends the static html to the page over the pipe 2. the page script receives the html from the pipe, inserts it into the DOM, and sends an “ack” back over the pipe 3. the node service receives the “ack” and calls the pdf rendering method on the page. I don’t remember why we chose the pipe method: I’m sure there’s a better way to pass data to headless contexts these days. The whole thing was super fast(~20ms) compared to WK, which took at least 30 seconds for us, and would more often than not just time out.
- sshine 1y agoSounds like fun considering how real the problem is.
- dmkolobov 1y agoIt was! I remember the afternoon I had the idea: it was beer Friday -and it took a few hours to write up a basic prototype that rendered a PDF in a few hundred milliseconds. That was the first time I’d written a 100x speed improvement. Felt like a real rush.
- mherrmann 1y agoCongratulations. Doesn't make this approach make so much more sense than writing a browser engine from scratch?
- dmkolobov 1y agoMaybe? I'd say it depends on what you're rendering. We rendered HTML that we created ourselves, filled in with data that we parsed and validated. Styles across the documents generated were also largely the same. If your job is to render arbitrary user HTML, this could get much more hairy. First of all, print rendering at the time(and probably now) was notoriously finicky. Things like adjusting colors, improper rendering of SVGs, pagination were difficult. It took a lot of effort to get right. Furthermore, if you're sending arbitrary HTML, you now have a much larger security exploit surface. If someone figures out how to call `addEventListener` within the page context, they can snoop on every PDF generated by that page.
- Teever 1y agoSo cool to see Odoo mentioned on HN. I've worked with it before and like it a lot. I've made posts about it on HN before but they've never gained traction. I hope that this takes off. You guys make neat software.
- giovannibonetti 1y agoAt work we recently switched from Wkhtmltopdf to Typst, which is a breath of fresh air. It is very fast and generates PDFs from scratch without needing to involve HTML or a browser engine. It is implemented in Rust and distributed as a self-contained binary. This blog post convinced us that the switch was worth it: https://zerodha.tech/blog/1-5-million-pdfs-in-25-minutes/ https://zerodha.tech/blog/1-5-million-pdfs-in-25-minutes/
- stevage 1y agoOh interesting. I use their "old stack" for a couple of much smaller projects and it works fine, but it does seem a bit ridiculous to be starting up a whole chrome instance just to convert one file format to another.
- karteum 1y agoI also love Typst and use it regularly. But just to note it : there is also https://weasyprint.org https://weasyprint.org that takes HTML as input
- kabes 1y agoDoes it support page margin boxes?
- monax 1y agoYes !
- pierrelf 1y agoLooks like skift is a hobby os like Serenity OS which Ladybird is spun out from. Maybe they intend to follow the same path?
- monax 1y agoI intend to keep Skift and Vaev together for as long as possible since everything is meant to be cross-platform. I don’t see any architectural conflict that would motivate such a change.
- busymom0 1y agoI wish one of these projects would make a browser which only renders text (so texts and links) and no additional support for media (images, videos, audio etc). I know there is Lynx but having a non-terminal based browser which could do it would be cool.
- mdaniel 1y ago[flagged]
- n2d4 1y agoThe fact that other browsers are huge engineering efforts only makes it more interesting to many. It's arguably one of the hardest things a programmer could build, how could you not wanna build one!
- hawk_ 1y agoYes but why do it in C++? There is no compiler enforced safe mode and you're by definition implementing an engine to run hostile code in it.
- monax 1y ago> There is no compiler enforced safe mode It's still early days, but Clang can check some lifetimes, using the [[clang::lifetimebound]] attribute [1]. You can also restrict unsafe pointer usage [2] outside designated blocks of code—somewhat like Rust’s unsafe keyword. [1] https://clang.llvm.org/docs/AttributeReference.html#id8 https://clang.llvm.org/docs/AttributeReference.html#id8 [2] https://clang.llvm.org/docs/SafeBuffers.html#buffer-operations-should-never-be-performed-over-raw-pointers https://clang.llvm.org/docs/SafeBuffers.html#buffer-operatio...
- userbinator 1y agoI personally have had enough of the "security" bullshit after seeing what it's done to "secure" control over the population and put that in the hands of the enemy.
- saagarjha 1y agoI thought you were happy that your man was finally fixing things this year.
- 1y ago
- khimaros 1y agoi find myself requesting this whenever i see a new minimalist browser pop up: it would be great to standardize alternative browsers on a consistent subset of web standards and document them so that "smolweb" enthusiasts can target that when building their websites and alternative browsers makers can target something useful without boiling the ocean i personally prefer this approach to brand new protocols like Gemini, because it retains backward compatibility with popular browsers while offering an off ramp.
- pkphilip 1y agoI am all for this. A completely simplified version of HTML without all the quirks and edge cases which have been added in over years + Javascript.
- graypegg 1y agoI think that would be really neat for small scale web publishing, but making it a subset of browser standards could be a really difficult sell to the people making browsers. While it's easier to build a browser to a subset of such a massive set of specs, the subset will drift towards a "similar but slightly incompatible standard" pretty soon after it's decided on. Following the development of Ladybird has given me an appreciation for just how often the "spec" for the web changes. (in small ways, daily.) That locks new browser implementations into a diverging standards track that would be very difficult to get off of. I think something like a reference implementation (Ladybird, Servo or even Vaev maybe?) getting picked up as the small-web living standard feels like the best bet for me since that still lets browser projects get the big-time funding for making the big-web work in their browser too. "It's got to look good in Ladybird/Vaev/etc". An idea: a web authoring tool built around libweb from Ladybird! (Or any other new web implementation that's easily embeddable) The implied standard-ness of whatever goes in that slot would just come for free. (Given enough people are using it!)
- userbinator 1y agosmall-web living standard The phrase "living standard" is an oxymoron, invented by the incumbents who want to pretend they're supporting standards while weaponising constant change to keep themselves incumbent.
- quibono 1y agoAre you open to contributions? I would love if there was a non-chromium alternative to wkhtmltopdf!
- 5- 1y agolike https://www.princexml.com/ https://www.princexml.com/ ?
- edoceo 1y agoYea, Prince is awesome. Not FOSS tho. I make some GPL or MIT licensed software and wish there was something as good a Prince with more open license.
- flexagoon 1y agowkhtmltopdf is not chromium though? "Wk" literally stands for WebKit. There's also https://weasyprint.org/ https://weasyprint.org/ which doesn't use any browser engine, but rather a custom renderer. And both of those (and Prince) can be used as a backend by Pandoc (https://pandoc.org/ https://pandoc.org/)
- quibono 1y agoYou're right, I think merged a few things together when writing the comment. What I meant is that (if you ignore PrinceXML and focus on FOSS) you're down to 3 options: - wkhtmltopdf - weasyprint - (headless) chromium with puppeteer et al. The first one I found to be unreliable, the second one is super slow and the third can be annoying to work with.
- DarkmSparks 1y agoI know its a tangent, but the idea that maybe ripping out android webview into a standalone cross platform project in its own right pops into my head everytime this problem arises. Keep meaning to check if anyones actually done it already.
- flexagoon 1y agoWhat do you mean by that? WebView is just Chrome embedded inside of an Android app. Same thing already exists on Windows (Edge WebView2), macOS (WKWebView) and Linux (WebKitGTK). There's also a library that wraps all of them into a single interface: https://github.com/webview/webview https://github.com/webview/webview The entire point of WebView is that it's a browser embedded inside of a different application, how do you expect it to be a "standalone project"?
- throwaway2037 1y agoAdd one more: QtWebEngine -> https://wiki.qt.io/QtWebEngine https://wiki.qt.io/QtWebEngine
- DarkmSparks 1y agoThe idea is it would be lightweight (so just a few megabytes of libraries) and give the same functionality you get with an android webview (so send it html to load and javascript to run and get json results back). I know there are quite a few options that try and do something similar. But they are all so incredibly bloated when all you want to do is use html5 for a native application UI.
- flexagoon 1y agoAll the options I mentioned are fully native and require no extra libraries.
- exikyut 1y agoGoogle themselves actually have gone vaguely in the direction you're thinking, kind of, in the form of Cobalt: a stripped-down copy of Chromium that has specific, deliberate "quirks" that minimize memory allocation/ballooning in long-running applications. Google uses it to power YouTube TV. Unfortunately, while I'm sure I downloaded a Linux X11 binary a while back to play with, I can't find anything of the like available anymore. The release packages just contain a shared library, and the containers in the registry are just full of compiler toolchains (I installed ncdu in them and checked). The whole system is mired/buried in layers of hardware integration fluff (because Cobalt is meant to be embedded in set-top boxes) and there is very little in the way of batteries-included demos, potentially to keep the product from gaining cottage-industry traction on older systems. Which does make sense, given that there are specific CSS rules that Cobalt doesn't follow the spec on, and I'm not sure where where its JS support is at. https://developers.google.com/youtube/cobalt https://developers.google.com/youtube/cobalt The compilation docs are about as dense as Chromium's are -.- https://developers.google.com/youtube/cobalt/docs/development/setup-linux https://developers.google.com/youtube/cobalt/docs/developmen...
- danpalmer 1y agoI'm interested in why C++ was chosen for this? Browsers are notoriously hard to secure, they're effectively mean to be RCE vulnerabilities! Securing C++ binaries is hard and has in recent years been called out by numerous organisations and companies as being the root cause of many classes of security vulnerability. With languages like (but not limited to) Rust, we now have better options.
- landr0id 1y agoI had the same thought. The project's description: >secure HTML/CSS engine No offense to these folks, but I see no evidence of any fuzzing which makes it hard to believe there aren't some exploitable bugs in the codebase. Google has world-class browser devs and tooling, yet they still write exploitable bugs :p (and sorry Apple / Mozilla, you guys have world-class browser devs but I don't know enough about your tooling. Microsoft was purposefully omitted) Yeah, very few of those bugs are in the renderer, but they still happen!
- userbinator 1y ago[flagged]
- 01HNNWZ0MV43FF 1y agoRude
- danpalmer 1y agoFWIW, I don't write Rust, and this is why I said "not limited to". Honestly, Swift might be an interesting one. I gather Zig can provide a more safety than C++. There are a bunch of other options too. Performance is often a concern, but a slow secure browser is better than a fast insecure one. Perhaps I'm a security troll, but writing this stuff in C++ has been shown over the last 30+ years to be functionally impossible, and yet security is one of the most important things for a browser. If the answer is that there are more possible contributors, or even that this is a hobby project and it's what the author knows, those are reasonable answers, but I'm interested anyway because perhaps the author has a different way of thinking about these tradeoffs to me, and maybe that's something I can learn from.
- est 1y agooh the irony. I remember decades ago when google.com was branded as example of minimal html design, to save bandwidth as much as possible, they don't even enclose html tags. Now google.com is loads of js crap. The SERP refuse to render without full blown js, css and cookie.
- throwaway2037 1y agoThis C++ code is wildly modern. Very impressive. Using only the GitHub web interface, I could not find the definition for Gc::Ref. Where can I find it?
- Lockal 1y agoProbably this - https://github.com/skift-org/karm/blob/main/src/libs/karm-gc/ptr.h https://github.com/skift-org/karm/blob/main/src/libs/karm-gc... And this is not a garbage collector in the traditional sense, more like arena with smart pointers.
- monax 1y agoIt's just a placeholder implementation, we will have a proper GC when we get to it
- lodovic 1y agoI had the same reading the source code - it's an interesting mix of traditional c++, while some of the projects use the latest c++20 features with modules. The GC::Ref seems to come form the karm-gc library. (according to copilot)
- guywithahat 1y agoI don't mean this as a slight against you but it's incredible how much code it takes to write a browser that barely works. I've always thought it would be fun to write a browser in erlang/elixir due to its fault tolerance (a memory from the early days when browsers would constantly crash), but browsers are so outrageously complex with such intense performance requirements the thought of even creating a repo sickens me. I mean it looks like you guys have 100+ files, with half of the files being ~500+ lines of code. Incredible work and dedication
- norman784 1y agoBrowsers might be the second most complex project you could build, the first one is an OS, also browsers can be categorized as an OS actually.
- firefoxd 1y agoHa! Only a few days ago, I was making the argument that the browser is the new mouse. As in no one person can build a computer mouse. You need experts in metal, plastic, transistors, lasers, etc. (Seth Godin?) The same way a web browser, which is the gateway to any connected device, requires experts in countless fields to build. So kudos for building it this far. Now let me see if it runs webgl before I eat my hat.
- munchler 1y agoThere are four people working on this project, not one.
- madmod 1y agoDoes anyone know what the japanese in the logo means? As I read it ジブト (jibuto) means nothing to me.
- mingodad 1y agoThere is also https://sciter.com/ https://sciter.com/ that the author tried to find finance to make it opensource but couldn't find enough supporters.
- mathverse 1y agoIt's not a browser.
- mherrmann 1y ago[flagged]
- SCLeo 1y agoThis comment might be one of the meanest comment I have ever seen.
- mherrmann 1y agoHm, I'm sorry you feel that way. It's not meant to be mean. On the contrary; Instead of encouraging someone who I feel is going down a wrong path, to me it's kinder to express my view that they aren't. I have personally wasted years of my life on technical projects, and would have been better off if someone had told me that it was a bad idea.
- sjogress 1y agoI'm of the opinion that these passion projects are incredibly important. Your passions projects were problably also far more important to your growth than you give them credit for. Scratching an itch is how we, as programmers/engineers/whatever, grow. It is also how we stumble into solving real problems and make our mark on the world. Who knows, this could become the next big player in the browsersphere, or maybe it'll pivot into something else, or perhaps it will spark someones imagination. At the very least it has (probably) already been a source of creative bliss and pride for the ones involved, which in my opinion makes it worthwhile.
- devgoncalo 1y agoI agree
- aguacaterojo 1y agoI understand what you are saying and don't fully disagree. You can allocate time & energy into immediate real world solutions while reaping the personal growth. There is certainly a balance. The counter-point is that in the case of a web browser you are studying deeply one of the most impactful technologies to exist, and you will learn 80% of the most important lessons with a minimal working build, maybe 0.1% of the real thing. You may learn and execute much faster too because there is a clear blueprint, and you are likely riding a wave of passion that will carry your mind to places you won't have expected. The perspective gained puts you in a much better place to identify & execute successfully more impactful work. The work may be the seed of something more important, but unseen or unknown yet.
- mirsadm 1y agoWell done, this is really cool. It is nice to see more modern C++ in use. The codebase is really easy to read and understand. People here need to get over the fact that it's not Rust. I use C++ for my own projects because I enjoy writing in C++. I just wouldn't write them if I forced myself to use Rust or whatever else.
- ivanjermakov 1y ago> A lightning-fast, lightweight, and secure Let me guess, it's lightning-fast because it lacks many features and secure because it's a thousand times less code than the alternatives? I don't want to discourage, but such description is misleading.
- sylware 1y agodudes... c++... definitive nono. Please, move to plain and simple C99+.
- Koshima 1y agoThis is really cool! Building a browser engine from scratch is no small feat, especially when handling complex CSS features like calc(), var(), and percentage units. It’s a great way to learn the inner workings of the web. Curious about your approach to the networking stack. Are you planning to support more protocols like HTTPS or WebSockets in the future, or is the focus more on keeping this lightweight and minimal for now?
- deleted 1y ago[deleted]
- Aeyxen 1y agoBravo to the Vaev team for championing unrestrained technological exploration! The choice of C++ is bold. Despite the security concerns often highlighted, modern C++ with smart pointers, and RAII patterns can be just as safe as Rust when done right. Vaev’s security model should focus on process isolation, sandboxing techniques, and leveraging modern C++ features to minimize vulnerabilities. Super excited to see such raw innovation and courage in tackling a colossal task often monopolized by juggernauts like Chromium.
- TApplencourt 1y ago... Thanks, LLM, for your input!
- potato-peeler 1y agoHoping you will expand the documentation. That tldraw file is almost unusable, no online service exists to view the file. Only thing I got was a vscode extension. Unless I have reason to ditch sublime, there is not much choices left to view your architecture documented in an obscure format.
- sudhar172 1y agonice
- lorikmor 1y agointeresting, seeing such things be built from scratch