DEV Community

Cover image for Building a business from scratch - day 11
Twan kruiswijk
Twan kruiswijk

Posted on • Edited on • Originally published at twankrui.com

Building a business from scratch - day 11

Welcome to day eleven of the useaffiliates.com build log! This series covers my journey of building a business from scratch in public. If you missed day ten, you could check it out here. I also uploaded today's Twitch stream to YouTube if you want to watch the replay.

Bug crushed! 🐛

Yesterday we got stuck on an issue with navigating from the category and home page. When routing from the category page to the home page, you would see the home page for a couple of seconds before getting routed back to the category page you came from.

After scratching my head for an hour yesterday, I decided to sleep on it. And that was precisely what I needed to do.

When I sat down behind my computer today, I quickly decided that instead of handling the routing from the page templates, I would move the logic to the filterContext file. In hindsight, this is a better place to handle any logic that comes from updating the filter. This way, the only thing the pages have to address is updating the values for the filter on page load.

If you are curious about the changes, you can look at my commit for the bug fix.

This reinforces that sometimes all you need is to just sleep on something. Especially when working on code, you can get stuck in a loop while fixing a bug or implementing a feature. When you step away for a little while, you come back with a different frame of mind and ideas.

Filters and data fetching. 😬

The only thing that remains for having the program table ready for launch; is hooking up the paymentType and cookiePeriod filters.

First things first, I needed to turn the database column of cookiePeriod into a number property instead of a select. Did you know that when you change a select property in Notion to a number, it automatically turns the select values into numbers? Holy shit! This alone saved me 1 or 2 hours today. All I needed to do was click a button. Isn’t that awesome?

Edge cases, edge cases everywhere. 😵‍💫

To implement the filters, I use query parameters. When users route between pages or come to the site from a link, we show them the right page with the correct filters.

However, I didn’t anticipate that statically generated pages can’t access the query parameters, thus turning this into a giant edge case battle.

I went from implementing two “simple” filters to playing the “but, what if the user...” game. While this is a little frustrating (it introduces a lot of work), it is for the better. It will save a lot of frustrated and confused users when the filters work as expected, even when links are being shared.

I have to separate ways with static page generation because working with query parameters only works for server-side rendered pages. But I am sure that we can still make the site fast when I deepen my knowledge of caching a little bit.

Clearing the filters 🗑

While working on the filters, I forgot about one tiny but essential feature. The ability to clear/reset your filters!

I have added an icon beside the dropdown filters to make this work. You will get redirected to the homepage when clicking on this icon, with all the filters unselected. The home page serves, in a way, like an "all programs" page.

Typeform, stripe, Chargebee, or Memberstack? 🤔

Off stream, I am slowly but surely looking at ways to handle subscriptions. I am not looking forward to having to manage every recurring payment. Ideally, I have the entire subscription management (payment, invoicing, taxes, emails) automated and “out of my hands.”

I have talked about the combination of Typeform with Stripe, but I am not confident that this combination will make my life easier. I can’t find anything about invoices and emails, while services like Chargebee and Stripe Billing offer these services.

While scrolling through some other SaaS apps, I got reintroduced to Memberstack. I have to say, when I found out about their React implementation, I got excited. Simple authentication in combination with easy subscription management (excited developer noises).

Getting closer and closer to launch. 🚀

Tomorrow and over the weekend, I put some hours into deepening my knowledge of the subscription/membership services and deciding what to use for launch.

I will also have to put some hours into updating the database. I am still 30 affiliate programs short of having 100 programs inside of the database, which is just a random number I came up with. However, I think that 100 affiliate programs will be sufficient at launch for users to browse the platform for a couple of minutes.

Last but certainly not least, I will put some thought into the filters. I might do some coding over the weekend, but I will certainly include it in next week's update and cover it on stream and Youtube when I do.

For now, enjoy your Friday, and have a great weekend!

Thanks again for reading this build log, and I hope to see you next week!

If you want to stay updated in the meantime, give me a follow on Twitter.

With love,

Twankrui

Top comments (0)