TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: Bi-directional sync between Postgres and SQLite

356 pointsby matharminover 1 year ago
Hi HN,<p>Today we’re launching PowerSync, a Postgres&lt;&gt;SQLite bi-directional sync engine that enables an offline-first app architecture. It currently supports Flutter, React Native and web (JavaScript) using Wasm SQLite in the browser, with more client SDKs on the way.<p>Conrad and I (Ralf) have been working on our sync engine since 2009, originally as part of a full-stack app platform. That version of the system is still used in production worldwide and we’ve learnt a lot from its use cases and scaling. About a year ago we started on spinning off PowerSync as a standalone product that is designed to be stack-agnostic.<p>If you’d like to see a simple demo, check out the pebbles widget on the landing page here: <a href="https:&#x2F;&#x2F;www.powersync.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.powersync.com&#x2F;</a><p>We wrote about our architecture and design philosophy here: <a href="https:&#x2F;&#x2F;www.powersync.com&#x2F;blog&#x2F;introducing-powersync-v1-0-postgres-sqlite-sync-layer" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.powersync.com&#x2F;blog&#x2F;introducing-powersync-v1-0-po...</a><p>This covers amongst other things how we designed the system for scalable dynamic partial replication, why we use a server authority architecture based on an event log instead of CRDTs for merging changes, and the approach to consistency.<p>Our docs can be found here: <a href="https:&#x2F;&#x2F;docs.powersync.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;docs.powersync.com&#x2F;</a><p>We would love to hear your feedback! - Ralf, Conrad, Kobie, Phillip and team

23 comments

vlovich123over 1 year ago
Since the company seems to be answering questions I’ll give a few that come up for me. Congrats on the launch btw.<p>In the given design, am I understanding correctly that this means that a local commit could be seen as “committed” by the user but then later the server rejects it because of conflicts right? I guess it’s all application defined in that you could build your application in such a way as to show enqueued but uncommitted changes differently from the checkpoint, but it does mean that you could lose data if the application author doesn’t handle that well in their local code or the application server yeah? Not a critique because I think that’s true even for anything handrolled, but just making sure I understand the model.<p>Also, I’m a little unclear how it’s tied to postgres and what the powersync service is doing. The docs say that you fetch a JWT from your application to talk to the service but then it says that all writes are mediated by your own application code. So presumably the powersync service channel is for synchronization of Postgres -&gt; local SQLite. Is that right? And the replication logic in powersync - is that essentially accomplishing horizontal sharding of the database for reads? Also, for the replication piece is the SQLite bit actually important or could you actually support arbitrary backends and SQLite is just convenient? Eg could you support browser LocalStorage instead of WASM SQLite or is there some piece of functionality of SQLite you’re relying on?<p>Finally, do you have any support for lazy local hydration &#x2F; eviction? Eg if I have a Google docs like application, is it synchronizing my entire account at all times or does it support pulling a document and evicting LRU documents when some local storage limit is exceeded?
评论 #38482922 未加载
评论 #38481961 未加载
smartmicover 1 year ago
Let me throw SymmetricDS into the ring: <a href="https:&#x2F;&#x2F;symmetricds.org&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;symmetricds.org&#x2F;</a><p>In my opinion it is quite underestimated giving its various cross platform and cross product sync capabilities. My first experiences with it are quite promising.
评论 #38488844 未加载
评论 #38488847 未加载
m9tover 1 year ago
This looks interesting! How does this compare to ElectricSQL[1]? Next to not using CRDTs.<p>[1] <a href="https:&#x2F;&#x2F;electric-sql.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;electric-sql.com&#x2F;</a>
评论 #38484180 未加载
评论 #38484142 未加载
alforover 1 year ago
I am looking for something like this. We develop IoT devices, thousand of linux computer running behind customer routers and have a central server with web admin, all in python.<p>I wish i could have &quot;syncronized objects&quot;, something were a change in a device would be reflected back to the server, web interface even better and in the other direction too, a way to see the whole system as one thing, not a hodge podge of api, calls, update and so on.<p>Is there an elegant way to do this?
评论 #38482310 未加载
评论 #38482097 未加载
评论 #38482380 未加载
评论 #38483082 未加载
sgtover 1 year ago
Well done on the launch! I have been using PowerSync for several months already ( although our own app hasn&#x27;t quite reached production yet, due to other reasons).<p>Very happy with PowerSync. The docs are detailed and well thought out, and the technology is solid. One can see it builds on a decade of sync experience from the Journey team.
评论 #38485392 未加载
chaostheoryover 1 year ago
Thank you - it’s great to have an alternative to electric-sql.<p>I actually need a local first, disconnected framework. What many people don’t realize is that even in the US, there are many parts without any network connectivity like our parks and preserves. Rangers still need to make queries in those areas.
评论 #38481624 未加载
评论 #38484574 未加载
metadatover 1 year ago
I dig it, super cool idea!<p>What about timestamps, though? SQLite doesn&#x27;t support them.. does it end up being restricted to the lowest common denominator between the two databases in terms of supported types&#x2F;functionality?
评论 #38480868 未加载
评论 #38480646 未加载
farmeroyover 1 year ago
This looks great! I&#x27;ve been planning a project and I wanted exactly this functionality and started looking into running SQlite in the browser. Very excited to try this out
davidlorean1985over 1 year ago
I&#x27;m excited for the Capacitor SDK that&#x27;s on the roadmap. Any rough ballpark estimate of when that might be available?<p>I haven&#x27;t used Capacitor but I will soon. Is it possible to use the web SDK in a mobile Capacitor app or is there something about the webview browser environment that breaks the normal functioning of Powersync on the web?
评论 #38514471 未加载
random_krisover 1 year ago
Possible integration with drizzle orm ?<p>Let me define schema with drizzle and use its generated objects to interact with db. Postgres driver for server SQLite driver for client
评论 #38480913 未加载
JCharanteover 1 year ago
Heads up:<p>The submission link <a href="https:&#x2F;&#x2F;powersync.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;powersync.com&#x2F;</a> results in ERR_ADDRESS_UNREACHABLE<p>You linked the proper landing page here: <a href="https:&#x2F;&#x2F;www.powersync.com&#x2F;" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.powersync.com&#x2F;</a><p>Your web infrastructure doesn&#x27;t redirect root visitors to www (or pass those requests on to your web server)
评论 #38481690 未加载
marioptover 1 year ago
This seems really interesting and I do have some questions:<p>How similar is this to MeteorJs minimongo collections?<p>Does this provide an architecture where a client subscribes to a collection and the server keeps track of which data the client has and only sends minimal update messages?<p>Is this ideal for intense real-time applications (ex:Chat)?<p>Is self-hosted a future option?
评论 #38486856 未加载
ricgover 1 year ago
How do you handle primary keys? Wouldn&#x27;t auto-incrementing integers lead to duplicate keys since clients are not aware of each other?<p>For the To Do app example, let&#x27;s say two clients start with an empty database and each creates a new todo:<p>Client A creates [id:1, todo:&quot;Buy milk&quot;]<p>Client B creates [id:1, todo:&quot;Buy cheese&quot;]
评论 #38485413 未加载
评论 #38485440 未加载
carstenhagover 1 year ago
Sorry, unfortunately I am a bit lost on what this does (on my phone, so couldn&#x27;t see the demos on the website). I&#x27;m an android developer, but I am not sure what this would do. Do you have an example of an app&#x2F;backend at which you can explain where Powersync helps?
评论 #38481155 未加载
langarusover 1 year ago
Great concept! What if the user is offline, makes updates to the local&#x2F;embedded DB, but when it gets online there&#x27;s an issue in syncing that prevents updating the postgress with the SQLite changes?<p>Is SQLite reverted to postgress and thus the changes lost?
评论 #38481669 未加载
bullebakover 1 year ago
It is amazing how often I sit with crappy or no connectivity, even in today&#x27;s day and age, and so if it were easier for more apps to be designed to work offline first that would truly be amazing.<p>Exciting development PowerSync team, good luck and Godspeed!
评论 #38483008 未加载
belalwover 1 year ago
Looks a lot like a light version of ElectricSQL (<a href="https:&#x2F;&#x2F;github.com&#x2F;electric-sql&#x2F;electric">https:&#x2F;&#x2F;github.com&#x2F;electric-sql&#x2F;electric</a>). Why should I use PowerSync instead?
评论 #38486668 未加载
andyferrisover 1 year ago
I couldn’t tell whether I could integrate my SQLite app with my own Postgres database? E.g. is it free to self host, and the paid services are a convenience? Or the cloud hostage is mandatory?
评论 #38481402 未加载
fractalnetworksover 1 year ago
Cool! Reminds me of Fractal Database, <a href="https:&#x2F;&#x2F;github.com&#x2F;fractalnetworksco&#x2F;fractal-database">https:&#x2F;&#x2F;github.com&#x2F;fractalnetworksco&#x2F;fractal-database</a><p>PoC Django ORM replication engine that supports master-master replication in a decentralized context. With a Django based solution you can sync between any DB Django supports so MySQL &lt;-&gt; Postrgres &lt;-&gt; SQLite is easy peasy.<p>Disclaimer: I am the author and haven&#x27;t written the README yet, but cool to see similar stuff nonetheless.
评论 #38482759 未加载
alforover 1 year ago
The typical use case would be with the sqlite in the browser?<p>I thought that it was deprecated for a lack of diversity of implementation.
评论 #38482027 未加载
mediumsmartover 1 year ago
Sorry for being a noob but is this &quot;tech&quot; similar to the rails offline video linked or am I misunderstanding? I don&#x27;t get why you would need a service instead of building it into the webapp&#x2F;site?<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Gj8ov0cOuA0" rel="nofollow noreferrer">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=Gj8ov0cOuA0</a>
评论 #38485861 未加载
johngover 1 year ago
Are you open to investors?
评论 #38481483 未加载
dkarrasover 1 year ago
what happens if you go out of business?
评论 #38485487 未加载