Tiago Freitas
Tiago Freitas4w ago

Convex migrations in self-hosted

Hi, I am evaluating convex for an app that currently uses yjs / livekit but got too complex. for the saas I can use convex hosted, but many business clients want full on premise solution so I need to self host. I see in the docs you don't support migrations, but is there any migration guide or info and are people doing it in practice? I also can't afford an enterprise plan with on premise support as I'm just getting started and they are SMBs, but I also can't adopt convex without self hosting for them on their servers, but they won't need a lot of scaling.. I will not be self-hosting the saas version. When a major version of convex is released, I assume there is usually an upgrade process and internal data structures migration (not the user db data). I guess sometimes there are manual steps and fixes to be made in this process? The docs say convex does not help with self-hosted migrations.
11 Replies
Convex Bot
Convex Bot4w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
lee
lee4w ago
A pattern that may work for you: 1. npx convex export from the existing deployment 2. Start running the new binary (with a new convex-local-backend.sqlite3 file), which creates an empty deployment 3. npx convex dev to push code & schema to the new deployment 4. npx convex import to copy data over into the new deployment
Tiago Freitas
Tiago FreitasOP4w ago
@lee thanks That sounds easy, so there are no issues with the import usually? Like deprecated things that need to be manually fixed? Another question, is it possible to host my backend on other servers other than convex decoupling it? Or I need to use convex as the backend host if I want to use for example the workflow component? But I guess using the convex backend is better as the db can stay in memory between webhook calls and functions can keep running even if client disconnects, which may be difficult in other backend hosts? I'm evaluating powersync vs convex. Powersync looks much simpler to host and huge advantage in having data in an SQL db. So it boils down to convex backend advantages but I'm worried about lock-in and not being able to host the backed anywhere. A cloudflare edge "backend" like livekit has its advantages.
deen
deen3w ago
I think you should reeeaaally have go at setting up a basic POC app that simulates some of your use cases, running convex yourself on a remote server. Convex is a very different and opinionated way of building a backend service. If you're used to working with a CRDT and local SQL db model, it's not like that (it's better). Looking at the PowerSync docs - on the surface level they can achieve a similar result. But they way you go about that is very different. Convex is very much not a reactive sync layer for Postgres.
Tiago Freitas
Tiago FreitasOP3w ago
I know it's different but I would like an unbiased explanatiom on why it's better, since convex is a lot less standard, it needs to be much better to be worth it
deen
deen3w ago
Reading "and huge advantage in having data in an SQL db" is what made me decide to comment. Convex is not SQL, nor is it "NoSQL" because you can have a schema and relations. Your backend and database are essentially the same thing - your Typescript query code both selects the data you need and prepares it for the consumer. For me, that's massive plus - but based on the requirements and legacy app you've mentioned, maybe it's not for you. The PowerSync docs seem like they're primarily about syncing a local SQL database with a remote one. Whereas the Convex docs are more about how to structure your data and backend to deliver the features you want. The concerns and approach are very different. The self-hosted Convex backend doesn't have the dashboard, plus a bunch of the other tooling that make managing your data easy. The readme here https://github.com/get-convex/convex-backend gives a good rundown on the challenges involved - with this be workable with your strict self-hosted requirements? This is a good rundown on the benefits of Convex, thought could perhaps be considered "biased": https://stack.convex.dev/convex-the-database-that-made-me-switch-careers I can't tell you if this is what's right for you, only you can. I don't think you can make an informed choice without experiencing it yourself - the choice should be obvious then.
GitHub
GitHub - get-convex/convex-backend: The Convex open-source backend
The Convex open-source backend. Contribute to get-convex/convex-backend development by creating an account on GitHub.
Convex: The Database that Made Me Switch Careers
Today is my first day working for Convex 🎉, so I thought I’d take the opportunity to share my thoughts on why I decided to join and what excites me a...
Tiago Freitas
Tiago FreitasOP3w ago
I was talking about powersync when I wrote having the data in a db is an advantage of them. I will refactor the app so I can go with either option. but the non-standard data storage and the self-serve complexity is a drawback that needs to be compensated by clear advantages, and "you have to experience it to understand" is very unclear and a red flag...you could say something specific, like "the reactivity (state manager), data access and conflict resolution code is much simpler to wite in convex, see this example" here is a code comparison: https://chatgpt.com/share/674f225d-e8c4-8000-b3bf-2a9b2cd90d82 from what I understand, the main advantage of convex is that the backend sync code is built-in, and in powersync only the client reads are built-in, the writes need an implementation of the update strategy and conflict resolution is manual. I assume in convex its also possible to write custom conflict resolution
deen
deen3w ago
I'm not trying to convince you of anything. I'm not a Convex staff member - they're probably not going to point out possible pain points for you like I have. I suggested giving it a basic demo because you'll answer your own questions way faster than waiting for someone to compare it PowerSync for you, and try to sell you on the idea. Especially on the self-hosting on your client's servers front. I'm not going to write up a big analysis for someone whose requirements and expectations aren't clear to me - whatever "red flags" you get from that are up to you. For instance, this is the first time you've mentioned conflict resolution being a concern. Conflicts are whatever you decide they are - Convex doesn't maintain local copies of the database on clients. It's more like using Tanstack Query from the front end, but queries are always live and update automatically based on any underlying data that has changed. Your clients should have the same view of the data, which can inform their mutations. If multiplayer mutations on the same data is a primary focus of your app, then you will need to enforce whatever rules that might apply yourself - otherwise, the last write wins. I'd never heard of PowerSync before you mentioned it, so I can't give you a direct comparison. But the db-backend-client chain works seamlessly together, it almost feels like you're working directly with the db on the client. I don't know how to express it any better than that.
deen
deen3w ago
Like this is funny to read, and doesn't seem very good. Don't know what kind of app you're making, so this may not apply to you.
No description
Tiago Freitas
Tiago FreitasOP3w ago
good catch, that is defitely a huge issue. collaboration features are important and I am currently using yjs that works but the sync with the react state manager got too complex and slow. multiple tabs may not happen much in production but are usually a way to demo that realtime data sync works correctly, so it doesn't bode well for powersync I guess its because they use a local sqlite db in the browser, which is good for offline mode, that convex does not support yet, but probably has issues with multiple tabs
deen
deen3w ago
https://stack.convex.dev/automerge-and-convex Ian's exploration with Automerge doesn't seem to have this issue, according to the Automerge docs, and I doubt convex's own implementation will because they're both using IndexedDB. The WASM stuff is cool but I would be embarrassed to explain to a non-technical client why this doesn't work. Seeing changes reflected almost instantly in side-by-side tabs is still new to most people in my experience - their "delight" moment is really powerful. I also have an end user of my hobby app that uses it on his original iPhone SE, which I doubt will ever support this. Him letting me know whenever something breaks has helped me stay humble - I don't want to exclude people on older devices (within reason). It's never been convex at fault when this has happened.
Going local-first with Automerge and Convex
Learn about Automerge CRDTs for collaborative editing, syncing changes using Convex.

Did you find this page helpful?