Hacker News new | ask | show | jobs
by mandeepj 1401 days ago
Please forgive my ignorance. Is it right if I say the password seems to be available on the client side?

import { connect } from '@planetscale/database'

const config = { host: '<host>', username: '<user>', password: '<password>' }

https://github.com/planetscale/database-js

3 comments

They say in the post to use environment variables when deploying. I think they’re talking about server-side JS, not JS running in an end-user’s browser.
The intended runtime platform is serverless/edge compute, not client side. Think Cloudflare Workers, Vercel Edge Functions, AWS Lambda, etc.

The idea is these runtimes typically only allow HTTP outbound requests, not whatever protocol is typically used to connect to a planetscale db.

Correct. I would not recommend doing that. This is analogous to a database driver. It's raw access to the database.