How to Configure PlanetScale Proxy
You set up a planetscale proxy by starting a local client session. That session opens a secure tunnel to your remote database branch. Most engineering teams create branch passwords or service tokens for daily work. When teams share broad database roles, one bad query can break production data. Overly broad roles also expose sensitive user columns during routine debugging tasks. How a planetscale proxy works with database branches PlanetScale runs on a clustered MySQL engine designed for high
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You set up a planetscale proxy by starting a local client session. That session opens a secure tunnel to your remote database branch. Most engineering teams create branch passwords or service tokens for daily work. When teams share broad database roles, one bad query can break production data. Overly broad roles also expose sensitive user columns during routine debugging tasks.
How a planetscale proxy works with database branches
PlanetScale runs on a clustered MySQL engine designed for high scale. Instead of direct network ports, teams often use the native local client. This local process acts as a planetscale proxy on the developer machine. The developer logs in with a personal account or a service token. Once logged in, the local client listens on a standard local port. Database tools and local apps send SQL queries to this local port. The client wraps the traffic in TLS and sends it to the branch. PlanetScale checks the user role before opening the branch session. You can set up roles for readers, writers, or branch admins. Production branches often turn on safe migrations to block direct schema changes. This setup keeps schema changes inside review workflows before they hit main data.
What native branch roles solve and what keeps the session active
Native branch roles do a great job of managing initial login rights. You can separate read roles from write roles across different database branches. Safe migration settings stop developers from dropping tables by mistake in production. Still, branch roles only check who logs in when the session starts. Once a writer session opens, the database trusts every SQL statement inside it. A developer with write rights can still run a broad delete statement. A reader role can still pull whole tables filled with private customer rows. Native branch controls do not inspect individual queries while they run in flight. They also do not rewrite sensitive fields like emails, phone numbers, or card numbers. When teams pass static branch passwords around, tracking who ran which query gets hard. Shared tokens make audit logs show a single app name instead of a person. Security teams need a way to check each statement and protect private data.
Managing live SQL queries and sensitive data
To close this gap, teams add query checks and data masking rules. Instead of sharing long-lived branch passwords, engineers log in with their corporate identity. Every SQL statement gets checked against safety rules before reaching the database branch. You can block dangerous write commands while allowing safe reads in the same session. When a query returns rows, masking rules rewrite matched fields in the results. Sensitive columns like national IDs or card numbers get masked before reaching the screen. Every query links back to a specific user identity in the audit log. This approach keeps daily database work fast while protecting production rows from mistakes.
Database Proxy (ProxySQL, PgBouncer) + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Govern statements and responses across databases and APIs
Good config and scoped roles are needed setup. They do not check single queries in flight or mask sensitive fields in returned rows. Across Postgres, MySQL, SQL Server, MongoDB, ClickHouse, Kubernetes APIs, SSH, and internal HTTP endpoints, hoop.dev sits inline in the protocol beside each supported service as an open-source proxy, a sidecar for your database or API. For every query or command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human approval.
First, hoop.dev guardrails block banned queries before they run or hold risky ones for review, and hoop.dev data masking rewrites matched sensitive values in responses in memory. Furthermore, hoop.dev holds SOC 2 Type II and is open source on GitHub.
Frequently asked questions
Why do developers use a local tunnel for PlanetScale branches?
The local tunnel handles TLS certificates and user login behind the scenes. It lets local apps talk to a local port without complex network setups.
Do branch roles stop a user from reading sensitive columns?
No, a branch reader role grants read rights to the entire branch schema. To hide emails or card numbers in results, you need column masking rules.
What happens when multiple engineers share one database password?
Shared passwords make it impossible to tell which person ran a specific query. Using individual identity logins gives you a clear audit log for every SQL command.
Related guides
In this post