Reorder code

In the world of software development, maintaining a clean and organized codebase is crucial for long-term success. As projects evolve, I often find it necessary to reevaluate my code structure and make the necessary adjustments. In this article, I’ll share my step-by-step approach to refactoring a codebase for improved readability and maintainability. Sometimes, I’ve realized that over-decoupling my code doesn’t make sense. In such cases, taking a step back can be the right move....

September 15, 2023 · 3 min · Tobiasz Waszak

Get activities from Strava

I made integration with Strava, now it’s time to get activities from them. I want to get all of them because I need history for my bikes. Otherwise, I would probably be interested in only new ones. For this case I’m going to create new endpoint - get_activities. This endpoint is going to do three things. def get_activities(request) update_tokens activities = fetch_all_activities [200, {"content-type" => "application/json"}, [activities.to_json]] end First thing - update tokens....

September 1, 2023 · 2 min · Tobiasz Waszak

Authorize in Strava

The most important feature of this app is integration with Strava. To get activities and calculate bikes and parts distance. After 20 posts, I still don’t have it. Of course, I could put all the data manually, but this is the reason to build the app. To make it automatic. I split this to multiple parts. Small pull request are better. It would be easier to follow what happened. And easier to change your mind about how something should work....

August 31, 2023 · 3 min · Tobiasz Waszak

Multitenancy

This is the third post about accounts in the app. I should make something simple, change every query in the app, and add “account_id” everywhere. Probably yes. But not this time. If you follow my posts maybe you realized all data in this app are user(account) oriented. There is no reason to allow one account to have access to another account’s data. So I decide to use multitenancy pattern. Multitenancy is a software architecture pattern where a single instance of an application serves multiple tenants or customers....

July 30, 2023 · 4 min · Tobiasz Waszak

Authentication

Did I mentioned You should always use already-built solutions, especially for production apps. Building something from scratch is super insecure, and in my opinion, is an antipattern. If you want to keep credentials on your side there are devise or rodauth But you should consider keeping it outside the app with auth0 firebase auth or supabase Don’t do this yourself. But this is the second part of building accounts-related stuff from scratch....

July 30, 2023 · 4 min · Tobiasz Waszak