🤖 Deep Dive into Bettertori.fi

🤖 Deep Dive into Bettertori.fi

Feb 23 ·
5 Min Read

The architecture behind Bettertori

There is the joke story of Javascript a famous programming language that basically runs the internet today, was written in 10 days.

Well, while Bettertori was not written in 10 days, I originally started working on it during the Christmas holidays in 2024. We are closing to the end of February 2025, which means it took me around 2 months to get it to the point where I felt comfortable launching it. As a software engineer, I believe in the ship fast, and iterate fast philosophy. I wanted to get the product out there as soon as possible to start getting feedback from real users.

Javascript & The 10 days mystery
Javascript & The 10 days mystery

In this post, I will give you a deep dive into the architecture behind Bettertori and how it works under the hood.

Cash is king

While the phrase Cash is king might not the most relevant in this context, running a software on the internet requires resources. Today most application in the world are running on AWS or Google Cloud.

Cloud Providers Market Share Source: statista.com
Cloud Providers Market Share Source: statista.com

While essentially using either of the Cloud Providers should not be utterly expensive, the prices can add up quickly. I am proficient in using AWS, however I wanted to be full control of the costs (as I am doing this for fun), therefore I decided to go with an alternative route, and self host everything myself. It’s important to note, that using cloud providers, such as AWS, you are using the services the provide, you don’t have to bother with things like maintainance, updates, etc. Self hosting comes with a lot of extra work, not just maintaining the application and the services themselves, but the underlying servers as well. Luckily, there’s a pretty awesome open-source project called Coolify that helps in managing servers, and enables to run applications in docker containers. You can read more about Coolify in this pretty well written article.

The tech stack behind Bettertori

The soul of Bettertori is Supabase. Supabase is an open-source alternative to Firebase. It provides a lot of the same features as Firebase, such as authentication, database, storage, etc. The main difference is that Supabase is open-source, so I can self-host it. I am using Supabase for the database, and authentication. The database is a PostgreSQL database, and the authentication is done using JWT.

The frontend is built using React, with Typescript. I’ve used the latest version of react-router, which now comes with its own framework. It’s very similar to NextJS, but it’s a lot less bloated, while offers similar functionality like server-side rendering, which I have utilized in this application. Ever since Tailwind exists, there’s no need to look for alternative solutions, because it’s really a game changer. The entire UI is built using Tailwind.

Where it was applicable, I’ve used the server-loaders offered by react-router, and passing it down to the client to hydrate the application. This way, the application is rendered on the server, and then hydrated on the client, which is just great 😄.

When data needs to be fetched on some user interaction, I’ve used the other game changer piece of the React ecosystem, react-query. It’s a library that makes fetching, caching, and updating asynchronous data in React applications a breeze. It does a great job when it comes to caching, invalidating, and more.

Tech Stack
Tech Stack

The emails

Bettertori works on the email notifications sent to the users by Tori.fi. These emails then needs to be forwarded to a special email address offered by Bettertori. This process should be automated, so it’s a one time setup for the user. Bettertori’s onboarding page offers a step-by-step guide on how to set up the email forwarding. Bettertori utilizes AWS SES, to handle the incoming email forwarded by the user. The email is then parsed, and the data is stored in the database. The user is then notified about the new listing, and the listing is displayed on the dashboard.

Bettertori email parsing
Emaill parsing

Since Tori.fi sends the email notifications once a day, there’s a slight delay in the listing appearing on the dashboard. This is a compromise that was neccessary to make.

Bettertori email parsing
Emaill parsing

Supabase as Backend

At the moment, Bettertori does not run on its own dedicated backend service. Instead, it leverages Supabase, which provides a scalable and managed PostgreSQL database along with a suite of powerful tools for authentication, real-time subscriptions, and RESTful API access.

For data interactions, I have been utilizing PostgREST, which acts as a dynamic REST API layer directly on top of the PostgreSQL database. This allows for automatic API generation based on the database schema, eliminating the need for writing custom backend logic for most operations. It ensures that all queries are executed efficiently and securely while maintaining row-level security policies.

Additionally, Supabase provides built-in user authentication and authorization services, making it easy to manage user sessions and permissions. Bettertori takes advantage of these capabilities to store and retrieve user-specific data without requiring a separate authentication server.

Supabase architecture – Source: supabase.com
Supabase Architecture – Source supabase.com

Summary

From a technical standpoint, Bettertori runs on a lean but powerful stack. By leveraging Supabase as the backend, I was able to skip the complexity of maintaining a dedicated API while still benefiting from a scalable PostgreSQL database, authentication, and real-time capabilities. The frontend, built with React and TypeScript, takes advantage of React Router’s new framework features and React Query for efficient data fetching and caching.

On the infrastructure side, self-hosting everything using Coolify allows me to keep costs under control while maintaining full flexibility over deployments. And thanks to AWS SES, the email parsing pipeline ensures that users get relevant listings without manual effort.

Ultimately, Bettertori is all about improving the buying experience—giving users better tools to filter through the noise, track price trends, and stay ahead of the competition. While this is just the beginning, I’m excited to continue iterating and improving it based on real-world feedback. 🚀

Bettertori
Bettertori
Last edited Mar 03