Showcase
September 30, 2024
October 1, 2024
(updated)

Developer Case Study: Kei Otani / Blueprint "Friend"

Background

We were joined by Kei Otani from Blueprint to talk about the chat app he is building which is currently focused on users in Japan, with plans to expand to an international user base. We spoke to Kei about why he decided to follow a local-first approach, the stack he is using to build the solution, and what his experience has been like using PowerSync.

App details

App name "Friend"*
Platform(s) Mobile
App framework Expo (React Native)
Backend API Supabase (PostgREST)
Backend database Supabase (Postgres)

* This app name is provisional and hasn’t been finalized yet.

Interview

PowerSync

Kei, thank you for joining us today. Could you start by telling us a little bit about what you're building and the technology stack you're using?

Kei

Sure! Right now, I’m working on a chat application using Expo, with Supabase as the backend and edge function provider. I’m also incorporating offline-first capabilities using PowerSync, which is why we’re here today. The app is designed for people in Japan, enabling them to chat with AI or real people to practice English. It’s a text-based app, but I’m also trying to integrate real-time chat functionalities, ensuring the messages are transcribed and stored in the database.

PowerSync

Great, so with that context, our first question is what is the reason why you wanted to implement a local-first or offline-first architecture?

Kei

In today's world, users expect apps to work seamlessly, even with poor or no network connectivity. For instance, if a user is on a flight and wants to check their chat history or type a message, they expect the app to function. It’s become almost a standard for consumer apps to have offline capabilities. Without this feature, users experience frustration. So, ensuring the app works offline provides a much smoother user experience, and it is now less of a new feature and more the standard.

PowerSync

Absolutely, especially for chat apps. People are used to apps like WhatsApp that let them view messages offline. We've also seen that there is more interest from a broader set of developers in local-first architecture as a way of making the UI much faster because when you're querying from a local database — you basically have near-zero latency for queries. Was this also a factor for you in deciding to implement offline-first capabilities?

Kei

Yes, definitely. Users today expect instant responses. If an app lags, especially compared to mainstream apps, users will notice. While offline functionality is crucial, speed is equally important. PowerSync has simplified the implementation of both, allowing for fast response times without sacrificing reliability.

PowerSync

In addition to speed and offline capabilities, real-time collaboration is also a major advantage of using sync engines. How important are these features for your app, and how would you rank their importance?

Kei

Real-time syncing is essential for a chat app. Users want their messages to appear instantly, even with network interruptions. If I had to rank these features, I’d say offline functionality is the top priority, followed by speed and real-time updates.

PowerSync

Before choosing PowerSync, did you evaluate other options for implementing offline-first capabilities?

Kei

Yes, I looked into WatermelonDB, which also works with Supabase. However, one of the deciding factors for me was that PowerSync had a working example with React Native, which saved me a lot of time. Watermelon's documentation wasn’t as comprehensive, and the demos provided by PowerSync helped me accelerate the implementation.

PowerSync

Why did you start using PowerSync? And, once you started using PowerSync, what stood out to you as the most valuable aspect?

Kei

The system’s reliability and scalability were key for me. It worked consistently, which gave me confidence that it would perform well in a production environment. I was initially concerned about how PowerSync would handle scaling with a large number of users and messages, but the team assured me that it’s possible to scale up by using multiple database instances. So, it has a clear path for growth, which is reassuring.

PowerSync

Okay. So reliability, scalability, and stability were the main aspects of the value you see in PowerSync?

Kei

Yes, exactly. What I also found particularly valuable about PowerSync was its Sync Rules system. It goes beyond just syncing tables and records from Supabase; it allows for user permissions and data modifications in real-time. Although it took some time to understand, the system offered customization options that wouldn’t be possible with a direct connection, making it a powerful feature for my app.

PowerSync

That’s good to know. Have you had a chance to compare PowerSync’s Sync Rules with other products or frameworks, like WatermelonDB?

Kei 

I didn’t get too far with WatermelonDB, so I can’t compare them. The only other thing I’ve looked at is Supabase's native real-time engine, which they’re developing now. However, it doesn’t offer local database synchronization with React Native, so it’s not quite the same. I do appreciate that it looks like you have a good relationship with Supabase, and I hope that stays that way!

PowerSync

Could we dive a bit deeper into your experience with the learning curve of Sync Rules? What was that process like for you, and what resources did you find most helpful as you were learning?

Kei

That’s a great question. Initially, it was a bit tricky to understand why different buckets were needed, but once I realized it was due to the need for additional parameters beyond just user IDs, it started to make sense. One challenge I faced was dealing with arrays — the rules for parameters and data differed slightly, and I had to figure out how to compare values within arrays.

Another learning curve was figuring out how to work with JSONB data types. At first, I wasn’t sure if I could use arrays with JSONB in Supabase, but thankfully, it worked. These were small details, but they took some time to sort out.

One major point I missed in the documentation was that all the IDs had to follow a specific format. Once I understood that, things started falling into place.

PowerSync

Is there anything we can do to support you? Is your app in production yet, or where are you in the development lifecycle?

Kei

Right now, we’re still in the development phase, working on the audio functionality, which is taking a bit longer than expected. We’re aiming to release it by the end of the year. I’m also really grateful for your pricing model, as it gives us flexibility with the number of synchronizations per month that I’ll be able to use, which is super helpful as we continue building and testing.

PowerSync

Our goal with PowerSync is to make local-first or offline-first architecture so easy to implement that developers choose it as the default approach, rather than the typical cloud-first model. This shift has huge benefits, like simplifying state management, reducing backend complexity, and improving app speed and network resilience. With that in mind, are there any improvements or features you’d like to see in PowerSync to help us reach that vision?

Kei

One thing that could improve the product is better support for real-time updates with JSON fields. Right now, since JSON is treated as a text string, it doesn’t automatically update. We solved it by using a naming convention, but it would be nice if that functionality was included out of the box. I’m sure you could come up with an even more elegant solution.

Another area that could use improvement is the clarity around the differences between HTTP streaming and WebSockets, especially in terms of benchmarking. Some projects on GitHub use WebSockets while others don’t, and it’s not always clear which is better or faster.

Additionally, more detailed scalability information would be helpful. I reached out to support and learned about using multiple database instances for larger apps, but it would be great to know when to switch to a multi-instance setup and what the cost implications might be.

Lastly, I think there’s some hesitation around self-hosting versus using your cloud solution. Providing clearer communication and support around the benefits of your cloud-hosted option could encourage more developers to stay on the cloud platform instead of self-hosting.

PowerSync

Those are all great points, and they make a lot of sense. We’re already working on publishing scalability benchmarks, which should give more clarity on PowerSync’s performance and how it scales. Comparisons with other products are also on our radar, so we hope to have more information on that in the future. Thank you for the feedback!

Kei

Of course, happy to help and looking forward to continuing working with you guys.

Pictured: Kei receiving friendly investment advice.

Subscribe to receive updates

Thank you! Your submission has been received.
Oops! Something went wrong while submitting the form. Please try again.