S
Supabase8mo ago
Arbee

postgres vs supabase-js

Hey, I just noticed that the dashboard recommends using postgres from npm when using node.js and only recommends supabase-js when using an app framework like SvelteKit... any particular reason for that or is that just a coincidence and what features does supabase-js get me compared to poostgres?
1 Reply
jumski
jumski8mo ago
Browsers cannot natively use the PostgreSQL wire protocol because they lack a TCP API. They are designed for HTTP-based communication, so direct connections require some additional layer (in case of Supabase it is PostgREST on backend). Also, exposing database credentials to the browser is a no-no. Direct queries are faster and give more flexibility than supabase-js so it is always preferred if available IMO.

Did you find this page helpful?