Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle initial database within the app #488

Open
cletter7 opened this issue Feb 2, 2025 · 2 comments
Open

Bundle initial database within the app #488

cletter7 opened this issue Feb 2, 2025 · 2 comments

Comments

@cletter7
Copy link

cletter7 commented Feb 2, 2025

I want to eliminate initial sync as much as possible and provide initial DB with all the data already in there. I guess since powersync is local first it should support that? Is it possible?

@rkistner
Copy link
Contributor

rkistner commented Feb 3, 2025

Are you referring to a React Native app here?

In theory it is possible - you can export a database, bundle it with your application, then copy it to writable storage when the app opens the first time. However, there are some trade-offs with this approach, so it would help to know more about your use case and what you want to achieve with bundling the database. For example, do you want your app to be able to load offline on the first launch, do you want it to load faster, or reduce data transfer for the initial sync? And is the set of data that you want to pre-load fairly static, or do you expect it to change often?

One specific caveat is that if you make any sync rule changes after the initial export was created, users will need to re-sync all data, so then the bundled database won't help other than having some data available immediately on the first load.

Our Discord server may be a better place to discuss the options and trade-offs for this.

@cletter7
Copy link
Author

cletter7 commented Feb 3, 2025

Hi @rkistner, yes this is about React Native app, sorry for not mentioning earlier.
Basically I am building a bible app and there are different translations of it. I want to include a couple of translations in the app itself, so that users don't need to wait for it in order to start reading. And then some additional translations could be added on demand.
So yes, I want the app to load faster on the first launch and the pre-load data is completely static. There will be some dynamic data based on user activity, but that dynamic data is not in the translation itself. I find it acceptable if the user creation is still needed, but that should be fairly quickly, compared to downloading the entire translation.

I'd like to have some guidance / docs on how to achieve that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants