This is super interesting:
With postgres.new, you can instantly spin up an unlimited number of Postgres databases that run directly in your browser (and soon, deploy them to S3).Each database is paired with a large language model (LLM) which opens the door to some interesting use cases:• Drag-and-drop CSV import (generate table on the fly)
• Generate and export reports
• Generate charts
• Build database diagrams
@chrismessina absolutely mind blowing stuff, can totally understand that you couldn’t wait to share it haha 😝 Congrats on a fantastic launch @supabase 🎉
hey PH, supabase ceo here
This is a new service that we're experimenting with that uses PGLite[0], a WASM build of Postgres that runs in the browser. You might remember an earlier WASM build[1] that was around ~30MB. The Electric team [2] have gone one step further and created a complete build of Postgres that’s under 3MB.
Their implementation is technically interesting. Postgres is normally multi-process - each client connection is handed to a child process by the postmaster process. In WASM there’s limited/no support for process forking and threads. Fortunately, Postgres has a relatively unknown built-in “single user mode” [3] primarily designed for bootstrapping a new database and disaster recovery. Single-user mode only supports a minimal cancel REPL, so PGlite adds wire-protocol support which enables parametrised queries etc.
We have created https://postgres.new as an experiment. You can think of it like a love-child between Postgres and ChatGPT: in-browser Postgres sandbox with AI assistance. You can spin up as many new Postgres databases as you want because they all live inside your browser. We pair PGlite with an LLM (currently GPT-4o) and give it full reign over the database with unrestricted permissions. This is an important detail - giving an LLM full autonomy means that it can run multiple operations back-to-back: any SQL errors from Postgres are fed back to the language model so that it can have a few more attempts to solve the problem. Since it’s in-browser it’s low risk.
Some other features include:
* CSV upload: you can upload a CSV and it will automatically create a Postgres table which you can query with natural language.
* Charts: you can ask the LLM to create a chart with the data and change the colors of the charts.
* RAG / pgvector: PGLite supports pgvector, so you can ask the LLM to create embeddings for RAG. The site uses transformers.js [4] to create embeddings inside the browser.
We’re working on an update to deploy your databases and serve them from S3 using pg-gateway [5]. We expect to have a read-only deployments ready by the end of the week. You can access them using any postgres-compatible tool (eg: psql).
Everything is open source. A huge shout-out to the Electric team who have been a pleasure to build with.
[0] PGLite: https://github.com/electric-sql/...
[1] Postgres-wasm: https://supabase.com/blog/postgr...
[2] Electric: https://electric-sql.com/
[3] Single user mode: https://www.postgresql.org/docs/......
[4] transformers.js: https://github.com/xenova/transf...
[5] pg-gateway: https://github.com/supabase-comm...
Report
@copple kudos @ggrn fantastic work. The experience of this is second to none!
Congrats on the launch 🎉
Finally, I can test and play with my SQL queries without blowing up the production database.
and thanks to my little contribution. I've been added as a maker here. 🙏
@ggrn thanks for making it open source as well, I was able to learn so much from your code 🙌
Report
This is really intriguing! How does the integration with the LLM actually work in practice? Are there any performance concerns when handling large datasets within the browser? Looking forward to learning more about the potential use cases. Could be a game-changer for developers!
@williamjosephparker we heavily use tool calls which many LLM providers support now. The main tool is “executeSql” which the LLM can decide to call at any time to run queries against your local DB 😄
For large datasets, the constraint at the moment is memory available in your browser, but we are working with ElectricSQL to support storing data in OPFS which should increase this a lot!
Report
This is a game-changer for the dev community! Love the idea of spinning up Postgres databases directly in-browser with AI assistance. The drag-and-drop CSV import feature is pure genius. 🚀 Can't wait to see how this evolves, especially the S3 deployment! Postgres.new has definitely raised the bar for DB accessibility. Upvote from me!
Replies
Raycast
Supabase
Supabase
Supabase
Supabase
supa.guide
Supabase
Supabase
SVB News Hub
Supabase