Console #114 -- Interview with Martin about MoonZoon - a Rust Full Stack Framework
Featuring Preline UI, Pixie, and MoonZoon
🤝 Sponsor - Refind
Every day Refind picks 7 links from around the web for you, tailored to your interests. Loved by 50k+ curious minds.
🏗️ Projects
Preline UI
Preline UI is an open-source set of pre-built UI components based on the utility-first Tailwind CSS framework.
language: JavaScript, stars: 773, issues: 13, last commit: June 23, 2022
repo: github.com/htmlstreamofficial/preline
site: preline.co
pixie
Pixie is an open-source observability tool for Kubernetes applications. Use Pixie to view the high-level state of your cluster
language: C++, stars: 3542, issues: 139, last commit: July 16, 2022
repo: github.com/pixie-io/pixie
site: px.dev
MoonZoon
A simple, fast, and scalable Rust full stack framework without JS, HTML, or CSS.
language: Rust, stars: 1093, issues: 15, last commit: June 10, 2022
repo: github.com/MoonZoon/MoonZoon
🎤 Interview With Martin of Moonzoon
Hey Martin! Thanks for joining us! Let us start with your background. Where have you worked in the past, where are you from, how did you learn to program, and what languages or frameworks do you like?
I grew up in a small town in Czechia. I currently live in the capital - Prague.
I started to learn programming when I was 13 because I had to wait until we had the internet at home to get access to programming tutorials and tools. Then I just wrote “how to learn programming” to Google and some C# tutorials appeared.
I was changing jobs quite often because I wanted to learn new things or increase my salary but mainly because I’m not very productive in an office environment and during the typical working hours so I was burning out a lot and had to get a break and at least switch environments after a while.
In the meantime, I was writing side projects and trying to contribute to open-source ones at night.
Then I found Seed. I liked the idea of writing a website in a usable language and the architecture inspired by Elm but I didn’t like the code. It was a good opportunity to really learn Rust so I started to improve it.
Once Seed was good enough, I started building a community around it and wrote cold emails to companies that starred it on GitHub to find first freelance clients.
Then I started to develop MoonZoon to create my own project and primarily to fix problems I saw when I was writing Seed apps or other full-stack apps.
Now, I’m building one production app based on MoonZoon for a Norwegian company and a crowdfunding app CryptoKick for a company Probably Nothing I’ve co-founded.
Who or what are your biggest influences as a developer?
I’ve written smaller side-projects, libraries or production apps in relatively many languages. It forced me to learn their specific concepts and interesting features.
Also I’ve done many code reviews and contributed to many OS projects where I saw many different thinking patterns and ideas.
If you had to list a few of the different concepts and features that stood out in a few languages what would those be?
CoffeeScript/Rust - everything is an expression
Elixir - actors, immutability, pattern matching
Elm - pure functions, The Elm Architecture, no nulls
Elixir/Rust - macros
Rust - ownership, borrow checker
Go/Rust - channels
Elixir - hot code reloading
Unison - typed durable storage
Koka - effect handlers
Lean - dependent types, theorem prover
etc., just a rough list with a few langs to have an idea
What's an opinion you have that most people don't agree with?
- Windows has a more intuitive UI than other operating systems. However, I hope something like Redox would be a solid alternative in the future.
- Open-source projects shouldn't be completely free for everyone or we should tolerate other sources of income for maintainers (see e.g. “funding” experiment or this list or articles).
What’s your most controversial programming opinion?
- Not everybody can become a productive programmer. Pointers and recursion are two concepts that some people really struggle to understand.
- I don’t like irrational/political decisions in the tech world in general - “Let’s hate crypto-related libraries in lib.rs” or “Let’s change the default GitHub branch from master to main”.
What is your favorite software tool?
GitKraken. I like to see what’s happening and all reasonable options for the given context so I prefer GUI over CLI tools when it makes sense.
If you could dictate that everyone in the world should read one book, what would it be?
For really everyone - Thinking, Fast and Slow.
For all developers - Domain Modeling Made Functional
What do you like the most about Domain Modeling Made Functional? What are some key takeaways?
The book basically teaches how to get business requirements and encode them with F# (or other statically-typed language). The main idea is "Making illegal states unrepresentable". It's useful especially for developers who don't have too much experience with expressive languages and use too many Strings, bools and other primitives (typically Javascript or C developers). The book also teaches to divide the application to layers so you, for instance, do not use the same model/object for business logic, transport and storage.
If you had to suggest 1 person developers should follow, who would it be?
Nadia Asparouhova. She researches open-source communities, funding, and other stuff.
If you could teach every 12-year-old in the world one thing, what would it be and why?
English (or any other language like Esperanto if it would be easier to learn). Ideally as soon as possible. It doesn't matter what you do and how good you are at it if you can’t write or speak about it or use it to earn money.
If I gave you $10 million to invest in one thing right now, where would you put it?
To our company. It would allow us to fully focus on open-source projects, research and developing apps useful for many people.
If I gave you $100 million to invest in one thing right now, where would you put it?
It would be interesting to create a fund to reduce research debt and to support alternative education like Montessori and other academic improvements.
Or if you want to have some fun we can pay for fusion or UBI research.
What are you currently learning?
How “exotic” languages and compilers work - e.g. Pony, Koka, Lean, Unison, Magmide, Roc, Idris, etc. The goal is to develop a new language in the far future.
What have you been listening to lately?
I often just type something like “lofi” to Spotify or a similar service and hit play to get into the zone/flow as fast as possible. When I want to hear some real instruments and vocals then I listen to music from Claudie Mackula.
How do you separate good project ideas from bad ones?
I think the projects that are a pleasure to work on or are exciting for a wider or accurately defined audience have a bigger chance of success because it’s easier to finish them and do marketing for them. Also, people have to be used to paying for similar projects/services.
What’s the funniest GitHub issue you’ve received?
I don’t remember any funny issues. Also, it’s a bit risky to include jokes in public discussions because they may be lost in translation and many people are easily offended.
However, I like issues that are resolved by one-character pull requests.
Why was MoonZoon started?
After years of working on Seed and full-stack projects, I realized most web frameworks are just a group of libraries gluing JS, CSS and HTML snippets or SQL and REST API definitions.
It looks like hundreds of frameworks, libraries or state managers appear every day because web developers feel something is broken but don’t know how to fix it. These libraries are just another broken/leaking abstraction over out-of-date technologies. It means most of the effort is used to cure the symptoms but not the actual problems.
I think the better approach is to choose one good language and leverage all of its features to unify and polish all APIs. You don’t really need CSS, HTML, JS, SQL, REST, GraphQL, null, undefined, VirtualDOM, element keys, React Hooks and other technologies and language items.
Also I often work in a small team and on similar projects so one language and common general components like authentication or file storage saves a lot of time.
So I decided to choose Rust once again and write a new framework that should make the development faster and enjoyable.
Where did the name for MoonZoon come from?
I started with the name Monsoon to symbolize a fresh rain/wind of needed improvements. I wanted something easy to pronounce and remember.
But I also wanted to reduce the number of special names used in the framework. So I’ve split the word Monsoon and modified its parts a bit - Moon is the name of the backend framework and Zoon is the frontend framework.
Moon belongs to a group of common names of backend services like cloud, galaxy, space. Zoon means animal or organism - it’s the interactive/living part of the application. Their combination gives the final name - MoonZoon.
Who, or what was the biggest inspiration for MoonZoon?
Are there any overarching goals of MoonZoon that drive design or implementation?
The highest priority is developer experience - intuitive CLI commands and APIs without footguns. A proper documentation is still missing but I know it’s another key part of good DX.
There is a list of all main goals and non-goals: philosophy_and_non_goals.md.
What trade-offs have been made in MoonZoon as a consequence of these goals?
Developers coming to MoonZoon from the Javascript world have to fight with both Rust and MoonZoon-specific APIs.
Another trade-off is missing static site generation because Zoon needs a bit of Rust for styling so it’s not possible to just render only HTML+CSS pages and then lazy-load business logic encoded in a Wasm module.
What is the most challenging problem that’s been solved in MoonZoon, so far?
- It’s almost impossible to create a “half-pill” button (two corners are fully rounded and two corners rounded a bit) with pure CSS. See explanation on css-tricks. Zoon implements a custom algorithm with the help of ResizeObserver.
- Design & implementation of type-safe routing was challenging. See example & code of the Rust macro generating routes and their handlers.
Are there any competitors or projects similar to MoonZoon? If so, what were they lacking that made you consider building something new?
I think there are no competitors, the combination Rust + Wasm + no HTML/CSS + realtime backend API + virtual actors is pretty unique.
What was the most surprising thing you learned while working on MoonZoon?
- We are still living in the jQuery world. Browsers often don’t respect specifications or there are bugs or different behaviors or missing features. See for example hacks for individual browsers in resize_observer.rs. Safari and iOS browsers are basically new Internet Explorer. Safari for example blocks `Border::inner` in MoonZoon because CSS `outline` ignores border-radius. Or `movementX/Y` fails in runtime on Safari/iOS. And (if I'm not wrong) all iOS browsers have to use Safari core so one Safari bug makes your website on iOS unusable. And I don't have Mac so I basically can't debug desktop Safari - that's the biggest pain - really new IE.
- Some APIs of Rust backend frameworks are super-painful to use or in some cases impossible to work with.
What is your typical approach to debugging issues filed in the MoonZoon repo?
Most bugs can be reproduced only on a specific browser or operating system or with specific dependency versions. Also, most people can’t really describe problems or provide minimal examples so the first step is almost always research / getting more info from the issue creator. There are cases where the author has made just a logic mistake in his code - then I’m trying to improve the API design to prevent such mistakes. Otherwise, I mostly use the classic old console.log or println! while I’m debugging.
What is the release process like for MoonZoon?
There is none yet. I’ll release MZ when I feel there is a need for it. Taking care of CI, releases, documentation and similar things are super time-consuming activities and I have neither so much free time nor business reasons for them now.
The main branch in the MoonZoon repo always contains the most stable version.
Is MoonZoon intended to eventually be monetized if it isn’t monetized already?
I have some GitHub Sponsors and Patreons. ~$300 per month is very good motivation but it won’t pay my rent. I plan to create MoonZoon Cloud to directly monetize MZ in the future.
I monetize it indirectly through freelancing and I hope also through our own business projects like that CryptoKick app in the near future. (The app should also replace GitHub Sponsors and Patreon because I don’t want to pay banks, PayPal and Patreon a relatively large part of the revenue).
How do you balance your work on open-source with your day job and other responsibilities?
I am lucky (?) I'm introverted, I still live in a flat and I have a very tolerant girlfriend and work from home part-time so I don’t need too much social contact and to kill time in public transport and meetings.
I have a pretty ergonomic working environment but I am starting to feel my body hasn’t been in a gym for a few years. I have to change it soon - it’ll be another challenge.
So I have to focus only on really necessary things and ignore everything else when possible. Also people around me just can’t expect my immediate reactions or agreement when they need something.
Do you think any of your projects do more harm than good?
During one of my first professional projects many years ago I had to make UX as bad as possible so it’s almost impossible to find doctors “sponsored” by pharmaceutical companies. It wasn’t an open-source project and I was just a junior developer but it was a terrible experience for me. Since then I only write apps I believe are somehow really useful and resonate with my moral values.
What is the best way for a new developer to contribute to MoonZoon?
They can report bugs or potential missing features or write documentation or blogs/tweets about MZ or do experiments like trying to run a Zoon app in Tauri as a desktop/mobile app or trying to integrate Passkeys etc…
I don’t want code contributions until I explicitly say it in an issue or Discord chat because it often slows down the development.
If you plan to continue developing MoonZoon, where do you see the project heading next?
I think the only reasonable development of a service/library/framework/language is based on real-world usage. It means I’ll continue writing production apps based on MoonZoon and improve it when I or another MZ user finds something to improve.
What motivates you to continue contributing to MoonZoon?
It’s fun, my income depends on it and I hope it helps other devs to build nice apps.
Are there any other projects besides MoonZoon that you’re working on?
I contribute to other open-source libraries when I find bugs or missing features and I was hired to write some tools for one blockchain several months ago.
Do you have any other project ideas that you haven’t started?
OpenHope.net (an idea on how to support OS developers). And that new language mentioned before.
What is the language intended to solve?
I imagine it would be a bit similar to Rust, but:
1) async/await, const, Result/Option, and maybe "function dependencies" would be unified with effect handlers.
2) The lang would be more expressive / typed => dependent types would be nice.
3) Ideally it could be formally verifiable - useful for smart contracts and similar things.
4) Rust ownership model doesn't play well with the concept of Signals (https://docs.rs/futures-signals/latest/futures_signals/tutorial/index.html) used in Zoon to replace VirtualDOM and things like React Hooks and components. Either we would implement more advanced ownership model (maybe Reachability types) or we would probably have to use immutable data structures (https://github.com/KeatonTech/futures-signals-im).
5) It would be nice to not use locks at all. For example Pony lang uses only actors instead of locks. Locks are painful to work with in both the frontend world (in combination with Signals in Zoon) and in the backend/database world in general (well explained in Designing Data-Intensive Applications). So one idea is to have first-class virtual actors.
6) Durable typed storage (basically objects/structs stored in a persistent storage instead of the heap or stack) would be nice.
7) I'm not too fond of recursions but perhaps tail call elimination/optimization would be useful.
etc.
- The idea is to design a bit higher-level language than Rust, ideally suitable for web development and smart contracts but general enough.
- The list of features could change, it's honestly the first time I'm trying to write the ideas down so sorry for a wall of text.
- The working name is Boon.
- See also https://github.com/magmide/magmide
Where do you see software development heading next?
- Passwords will be history thanks to things like Passkeys and crypto wallets.
- New languages or verification tools will appear to mitigate security bugs in smart contracts.
- Microservices will become real microservices and partly merge with serverless functions or smart contracts thanks to Wasm modules running on the backend.
- It will be easier to write multi-platform apps thanks to projects like Tauri.
- I think there’ll be even more no/low-code tools and AI driven projects and blockchain-related apps but only a small percent of them will be really useful and still alive in the future.
- More and more IDEs, games and other typically resource-heavy and native apps will be written as a browser app. Especially once there is better support for Wasm multi-threading in browsers.
Where do you see open-source heading next?
I think OS developers will become tired of working for free and more projects like OpenHope, CryptoKick, Tea, Gitcoin or Aviyel will appear to leverage web3 or similar technologies to reward developers for their effort.
Do you have any suggestions for someone trying to make their first contribution to an open-source project?
Start with your own public project to learn how GitHub and Git works.
Then find an interesting project and try to write on their chat whether there is a need for help or pick an issue marked with a label like “help wanted”.
Before you start actively working on the issue, try to orient yourself in the code a bit and run/compile the project.
Then ask whether you can start to work on the given issue and add some additional questions when something isn’t clear enough.
Don’t expect immediate responses from maintainers.
Want to join the conversation about one of the projects featured this week? Drop a comment, or see what others are saying!
Interested in sponsoring the newsletter or know of any cool projects or interesting developers you want us to interview? Reach out at console.substack@gmail.com or mention us @ConsoleWeekly!
Very solid and useful post. Thank you for sharing it. We also write about tech and metrics, you can check out one of our articles here https://www.metridev.com/metrics/ktlo-in-project-management-for-successful-project-execution/