echo $(

A common mistake

First request test after setting up the project

Table of contents

About my last project

It turned out really well-polished and professional. Also, I learned a thing or two about marketing, which is always valuable and something we as devs generally don't like.

I worked on the whole stack, from the server (Rust), to the mobile (React Native) and web (Vite/React) clients.

It was my first time using Rust, which made things a little bit slower. I think it turned out to be a decent choice in the end since it boots up very quickly and keeps the cloud bill small (runs on Google Cloud Run).

My motivation was building something using AI (yet another OpenAI's GPT-* wrapper), but do it fast and well, not just a rough prototype/demo.

I've always struggled (when working on personal projects) to limit development time (it was never enough!) and actually ship something. Fortunately, I believe I did well this time.

A common mistake

Since I wanted it to be cheap (I was living off savings), I thought the best idea was to not use any external services and keep everything running on a small VM (GCE). I'd store sessions and data to an SQLite DB, set up nginx, set up f2b for security, set up the SSL certs myself, create a few custom bash scripts to automate deployment, set up some cron jobs, create groups and users for access control and finally: GRADUATE from DevOps school!

Super bad idea. This ended up taking up most of my time (Pets vs Cattle anyone?), and I wasn't building anything. Plus, having an instance running 24/7 is generally more expensive than using on-demand servers (at least for small, low-traffic, projects; of course).

Now the service is server-less; it uses Redis for sessions, PlanetScale for the DB and Cloudflare for storage. Deployments are automatic with Cloud Run Triggers and Github Actions. And the best part: the cost is almost zero, since most of the above services have free monthly usage quotas.

Takeaway:

Leverage existing infrastructure and use SaaS and PaaS as much as possible when time is of the essence.

Stick to your stack

...when execution speed matters.

Why Rust? I worked a lot on game development, generally using Java (yep, it is used for gaming as well), but sometimes using C++ (specially for bindings with native libraries). When Rust came out, I had this feeling of actual excitement about it. It was, from my POV, perfect: memory safety, performance and a great build system (cargo). But I never had time to use it.

These were my first vacations in a long time so I said "Why not? This is web server stuff, there are probably lots of libraries to work with. Let's do it!".

Wrong again.

Although there are great libraries out there (tokio, warp, hyper), it doesn't even compare to the amount of out-of-the-box solutions we have in other programming languages (Javascript, PHP, Java, etc.); and I'm not talking about is-even/is-odd kind of stuff, I'm talking about things like verifying OAuth providers token signatures for example, you have to do everything by yourself!

As I mentioned before, it kind of worked out at the end, but next time I'll use Javascript/Typescript (or maybe Java?) instead. It also takes a lot of time to compile!

Note that these are mistakes because the goal was to complete the project fast. I'm not ranting about Rust or self-managed servers, both are great and should be used when appropriate.

Wrapping up, it was a great learning experience and super fun.

This is the project by the way: https://storyscapeai.app