logoalt Hacker News

Show HN: I built a small browser engine from scratch in C++

116 pointsby crediblejhjtoday at 2:03 PM38 commentsview on HN

Hi HN! Korean high school senior here, about to start CS in college.

I built a browser engine from scratch in C++ to understand how browsers work. First time using C++, 8 weeks of development, lots of debugging—but it works!

Features:

- HTML parsing with error correction

- CSS cascade and inheritance

- Block/inline layout engine

- Async image loading + caching

- Link navigation + history

Hardest parts:

- String parsing(html, css)

- Rendering

- Image Caching & Layout Reflowing

What I learned (beyond code):

- Systematic debugging is crucial

- Ship with known bugs rather than chase perfection

- The Power of "Why?"

~3,000 lines of C++17/Qt6. Would love feedback on code architecture and C++ best practices!

GitHub: https://github.com/beginner-jhj/mini_browser


Comments

_ache_today at 10:09 PM

Impressive. Kudos.

You realise that it's only a toy implementation aimed at learning and not a full implementation. The parsing of HTML alone is way more complex than your actual implementation not mentioning at lot of things like the rendering or network (outsourced to Qt).

Still a nice achievement that get you to understand why making a browser is a very complex task.

vintagedavetoday at 7:18 PM

> I had to implement recursion, which I wasn't familiar with.

The amount of learning this person has done is incredible. Kudos.

I also appreciated seeing they used AI and tutorials yet fixed bugs themselves, as a way to demonstrate they understood I the code.

show 1 reply
noo_utoday at 5:49 PM

This is a really awesome project! If you have time/interest, you could try to build a simple http server now, that your browser could communicate with. Then you could try to implement a simple version of TCP/IP, and look into how lower level networking works. Great job!

show 2 replies
grougnaxtoday at 6:49 PM

This might be the hardest thing ever in computer science, kudos!

show 1 reply
butztoday at 7:22 PM

Good job! You should consider contributing to a similar small browser - Dillo @ https://dillo-browser.org/ , and help to build a complete tiny browser.

robshipprtoday at 7:31 PM

Incredible job here. Really took a lot of work to get this done. Keep it up.

xackytoday at 5:49 PM

I follow a lot of the alternate browser engines and am always looking for new ones outside of the big three. You should use your experience to get a career in the browser tech world as we are dangerously close to the Chromium only web.

show 1 reply
lasgawetoday at 5:59 PM

This is one of the hardest projects of its kind. Congrats! looks cool.

userbinatortoday at 8:18 PM

Interesting to see everyone seemingly writing their own browser lately. Ironic to think that AI assistance, from Google itself, might be what ends up breaking their browser monopoly.

(Speaking as someone who also started writing my own long ago, and it's far from complete.)

show 1 reply
Imustaskforhelptoday at 8:31 PM

Indian high school senior here about to start CS in college here.

Your project feels phenomenal. Definitely starred.

I was actually trying to create a browser (in golang) myself as well (using LLM assistance) & I really couldn't do it after countless efforts.

https://github.com/SerJaimeLannister/golang-browser Much of it was just curiosity towards if LLM's could port the rust project by emsh https://emsh.cat/one-human-one-agent-one-browser/ into golang & this has led to some really insightful discussions between me and emsh on bluesky

This is actually really pretty cool as I was targeting a ~10k loc for golang from the ~20k loc of rust (given how golang has networking binaries and other stuff)

I guess this is really cool. I was always really averse to C++ preferring golang. I think I am ken-thompson pilled for the most part lol.

Anyways its really great to see people my age working in similar ideas. Somehow it gives us I guess a more sense of connection like I am not alone doing these things and I guess its pretty cool feeling seeing others do similar stuff and learning from them!

I have starred your repo and good luck for college too man! Hope to communicate with ya.

Edit: Another comment here as someone here mentioned that you used LLM, which LLM did you end up using and how'd you use it. For me personally, the most (success?) that I found which could generate a hackernews without any styles and anything was via their computer-use agent model (which I am thinking of downloading & working with kimi-cli to add more styling and other stuff as well in golang just out of curiosity)

I don't really mind if you used LLM, but I am curious as to how in this instance.

pipeline_peaktoday at 6:58 PM

We need more projects like this.

People making all sorts of libraries for HTML/CSS parsers, render trees, layout models etc.

I don’t want to see a world where everything runs on top of Chromium and we all just unwittingly submit to it.

luskiratoday at 5:52 PM

this is so cool man congrats!

lifetimerubyisttoday at 5:52 PM

Cursor is a 30 billion dollar corporation that couldn’t do this with practically unlimited compute for their AI.

Well done.

quentindanjoutoday at 7:18 PM

How much was coded with an LLM and how much do you understand?

show 1 reply
olliem36today at 7:18 PM

Did you use GPT 5.2 Codex? lol

samivtoday at 6:05 PM

Since when does homework feature on the front page of HN? I find this very odd...

show 4 replies