Rewrite it in Rust: Fun Weekend & Happy Wife
How I rewrote a pet project in Rust, shipped it within 2 days start-to-finish, and gained social credit along the way.
One of my first web projects I've ever done has been a simple database for my wife to save family recipes to. Usually these kinds of information is scribbled on paper somewhere, or sits as an unordered image gallery on phones, or is buried in long chant histories or email chains - ready to be forgotten. At least, sometimes hard to find, or tedious to "browse".
Since I never trusted any web platform to responsibly keep my data properly, and I want to customize different aspects entirely, I made this by myself. First in Rails (v2!), then with Node.js, and ultimately in Elixir/Phoenix (as an excuse to play with LiveView when it was v0.1). But every time, it was a rather brittle result ultimately, since I used tech I was learning at the time and never revisited that project ever again once I got proficient later.
Now that I am reconciling all my projects to Rust one-at-a-time, which I happen to actually know quite well already, I tried speedrun the whole process. People say that Rust is slow to develop in, right? So lets verify if this holds true!
What's the requirements?
Well first of all, its a handful of CRUD entities. Recipes, Ingredients, ... stuff like that. And some admin UI for my wife to manage stuff - for that HTTP Basic Auth is sufficient, since there is only a single admin user at all. Then there is some image processing involved, mostly to transcode phone uploads to resized webp formats. And ultimately I need some SEO-optimized frontend pages, including fancy stuff like JSON-LD for schema.org. And when everything works, I need to deploy/host that thing somewhere, as cheap as possible.
How did it go?
Suprisingly well actually.
First I started with the database stuff, using SQLite statically linked, together with diesel.rs as the ORM. After writing the initial SQL migrations for the table structures, ChatGPT did a great job of adding the CRUD functions mostly without any help from my side. After a few examples, Copilot even auto-completed the remaining entities in a mostly working state (its usefulness really lives from boilerplate/repetition!). Took roughly an hour to have this sorted.
Next step: add some webserver and build the CRUD UI ontop of the data. This is where any framework like Phoenix/Rails has the upper leg with their code generators.. fair enough. I did it completely by hand using only simple HTTP Forms and bootstrap UI, and got it working nicely in ... approximately 4 hours. But this also included customizing the admin workflows a bit to match my wife's preferences as well as implementing image processing/storage. And most of all, I had to fight a bit with basic auth to get it cryptographically "secure enough" - sometimes in Rust its the "small things" that suddenly eat a lot of time.
Next day (today, actually), I started with the shipping part: CI pipeline via Github Actions, deployment to a cheap DO droplet ($4/mo) by copying the self-contained binary. Took like 15 minutes in total until it was running. The rest of the day was importing the data from the previous projects database, building up the frontend pages, playing with technical SEO (I just like to do this for some reason), and watching my wife using the new thing.
End Result
I could sunset the old attempt first and foremost. I guesstimated that updating all dependencies from that LiveView 0.1 version to recent state-of-the-art code would have needed even more time, and wouldn't have been fun at all for me! So I am happy that I can click "delete" soon (I always wait some grace period before pulling the trigger) - instead of procrastinating needed maintenance work on the old thing.
Also I validated for myself that building things in Rust is much quicker than anticipated. Especially now that I made a boilerplate including all my learnings/hacks so that I can ship the next thing in probably not even a day! Not to mention the thing is so fast and efficient that even the $4 DO droplet is actually oversized.
And finally, its a nice marriage day present as well as a cool together-activity on the weekend or evenings to actually ship something, for personal use only, that doesn't suck! Not to mention next time I hear the question "what do you want to eat?" I feel much better just responding with a link to one of our recipes!
Have you also tried RiiR: Rewrite it in Rust?
- Number of words: 748
- Reading time: 4 minutes
- Posted: 6 months ago
Linked Categories
Click around and find out ↓
Technology
Stay ahead of the tech curve! Discover cutting-edge tools, trends, and insights tailored for solopreneurs and indie hackers driving innovation.
Indie Hacking
Dive into the world of solo entrepreneurship. Get insights and strategies for building successful, self-reliant tech businesses.
SEO
Make your digital content discoverable and digestable by web crawlers. Ensure that visitors have a straightforward experience.
Rust
A language empowering everyone to build reliable and efficient software. Futuristic swiss army knife and probably the most powerful mainstream technology today
Portfolio Links
See the stuff I made ↓
fresh bites
Personal cooking recipe collection for my wife (in german). Enhanced with customized relations between recipes, ingredients and units.
Website
A basic web 1.0 website that is solely server-rendered HTML and optionally a small database, without any multi-user capabilities except for a single admin area.
Empathy
Discovering and understanding deeply the pain points of your niche market.
Related Posts →
AI Alignment Problem: a fresh perspective
1 months agoExploring a fresh approach to solving the AI alignment problem by focusing on intrinsic motivation and long-term thinking to ensure harmonious development between AI systems and humanity.
AI Alignment Proposal: v0.1
1 months agoMy personal shot at approaching the AI alignment problem. Allows for iterative refinement as well as immediate experimentation with current LLMs today.
Custom GPTs vs OpenAPI path parameters
6 months agoSeems that the AI can't do idiomatic API calls for a RESTful interface after all - or their HTTP client has some bug.
GPT4o Just Landed And Will Be Free For All!
6 months agoThe latest OpenAI ChatGPT model just got reveiled and it will be free for everyone - but more importantly: the GPT Store will be, too!
The joy of traditional SSR website development
6 months agoHow I got my sanity back after years of JavaScript madness. Building websites finally is fun again - plus hosting and maintenance is much better!
Latest Posts →
Owning a business is exhilarating, but it’s not for the faint of heart. Many aspiring entrepreneurs fail to move forward due to fear of the unknown; however, the right tactics and mindset can help you overcome your anxieties and put you on the path to flourishing. This guide shares practical tips for growing and managing common concerns on your entrepreneurial journey.
AI Alignment Problem: a fresh perspective
1 months agoExploring a fresh approach to solving the AI alignment problem by focusing on intrinsic motivation and long-term thinking to ensure harmonious development between AI systems and humanity.
AI Alignment Proposal: v0.1
1 months agoMy personal shot at approaching the AI alignment problem. Allows for iterative refinement as well as immediate experimentation with current LLMs today.
Custom GPTs vs OpenAPI path parameters
6 months agoSeems that the AI can't do idiomatic API calls for a RESTful interface after all - or their HTTP client has some bug.
GPT4o Just Landed And Will Be Free For All!
6 months agoThe latest OpenAI ChatGPT model just got reveiled and it will be free for everyone - but more importantly: the GPT Store will be, too!