ENGINEERING ★ 103 upvotes 2017

MicroPython running “bare metal” in the browser via unicorn.js

Retrospective Overview & Key Insights

Distilled analysis of the business dynamics, operational challenges, and strategic takeaways:

In this technical retrospective (2017), @m_eiman shares practical architectural lessons learned from running, scaling, or migrating production software under lean constraints.

Core Principles for Independent Builders:
1
Defaulting to simpler architectures (such as monolithic frameworks, SQLite, or managed VPS) prevents early engineering bankruptcy.
2
Evaluating true compute and egress costs reveals that high cloud bills can often be slashed by 80%+ through judicious re-platforming.
3
Code you write at 2 AM as a solo engineer must be easy to debug six months later without complex microservice dependencies.
Community Debate Themes:

HN engineers debated the tradeoffs between cloud convenience and raw server economics, database indexing strategies, and resisting premature architectural complexity.

Community Discussions & Critical Reviews

High-signal perspectives, counter-arguments, and peer founder insights debated on Hacker News (32 total discussions):

ST @statico Peer Contributor

This is a neat demo, but its real value for me was learning about MicroPython. Whenever I've asked friends about a small, fast, embeddable scripting language the answer has been Lua. I favor Python much more than Lua so this project is attractive.

Some bits on how eLua compares with MicroPython from their comparison page[1]:

eLua, with LTR patch, boasts only 5.42K RAM usage after book, down from ~25K with unpatched Lua. (ref: http://www.eluaproject.net/doc/v0.9/en_arch_ltr.html). uPy offers ~540 bytes usage after boot (10 times less than patched eLua), and truly can boot and accept commands with 2K heap.

[1]: https://github.com/micropython/micropython/wiki/MicroPythonVsELua

AN @andrewstuart2 Peer Contributor

"Bare metal" meaning that instructions run "natively" on a simulated Cortex-M3 microprocessor via an emscripten-compiled stripped-down version of QEMU.

It's a cool way to quickly test out performance and iterate on micropython scripts built for microcontrollers; not a python engine in the browser, sandboxed and running instructions directly.

TI @timdawborn Peer Contributor

For a completely different approach, Grok Learning exposes MicroPython to the browser via a WebSocket: https://groklearning.com/microbit/

We find this approach works fine, assuming you have a stable internet connection.

FU @fuzzythinker Peer Contributor

Related:

http://pypyjs.org/ , https://github.com/pypyjs/pypyjs

Sadly, current implementation is buggy and has not been updated for 2 years.

TL @tlrobinson Peer Contributor
We have recently developed the ability to run MicroPython "bare metal" in a web browser. This is acomplished using unicorn.js, which is an Emscripted version of unicorn, which is a stripped-down version of QEMU.

I don't think "bare metal" means what you think it means.

HISTORICAL ERA Cloud & Mobile Era (2014–2019)
COMMUNITY SCORE ★ 103 points
TOTAL DISCUSSIONS 32 comments
TOPICS & TECH STACK: