How to Integrate Hex and Neon Safely
Integrating hex and neon lets data teams run interactive notebooks on serverless Postgres branches. Analysts build charts and models in Hex while Neon scales compute resources on demand. This pairing speeds up reporting and data exploration for modern teams. Still, connecting a shared workspace to a cloud database brings security risks. Teams must manage database keys, user roles, and network paths with care. Good rules protect sensitive tables and keep query logs clear. How hex and neon move
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.
Integrating hex and neon lets data teams run interactive notebooks on serverless Postgres branches. Analysts build charts and models in Hex while Neon scales compute resources on demand.
This pairing speeds up reporting and data exploration for modern teams. Still, connecting a shared workspace to a cloud database brings security risks. Teams must manage database keys, user roles, and network paths with care. Good rules protect sensitive tables and keep query logs clear.
How hex and neon move data and check permissions
Hex connects to Neon using standard Postgres wire protocol settings. An admin enters the Neon host name, database name, user role, and password in Hex. Once set up, Hex sends SQL queries to Neon over an encrypted link. Neon runs the query on an active compute node and returns the result set.
Data flows from Neon tables into Hex memory for charting or Python work. If a notebook uses a shared data source, every viewer uses that same database role. Neon checks permissions at the Postgres role level before it reads or writes rows. When nobody runs a query, Neon can pause the compute node to save money.
Teams can also link Hex projects to isolated Neon branches. A branch gives analysts a fast copy of production data for testing. Queries on a branch do not slow down the main production database. This setup keeps heavy analytical work away from live customer traffic.
Common failure modes and how to scope roles
Many teams make the mistake of using the default database owner role in Hex. That role can drop tables, change schemas, and read every row in the database by default. If an analyst runs a bad query, they might delete live data by mistake. Shared service accounts also hide who ran a specific query in the database logs.
End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
To fix this, create a dedicated read-only Postgres role in Neon just for Hex. Grant this role permission to read only the specific schemas and tables needed for reports. Keep sensitive columns like emails, phone numbers, card numbers, and national IDs in restricted tables. You can also use database views to hide raw columns from standard notebook users.
Network exposure is another common risk between cloud tools. By default, a cloud database might accept traffic from any address on the internet. Lock down Neon by allowing traffic only from the outbound IP addresses used by Hex. Set a query timeout on the Postgres role so heavy notebooks cannot lock up compute.
Best practices for ongoing database security
Rotate the database password stored in your Hex workspace on a regular schedule. Check your Postgres logs each week to spot slow queries or strange table scans. Remove old database roles and stale Neon branches as soon as projects end. Clear role boundaries let analysts work fast while keeping core production data safe.
Run guardrails and masking on the Postgres connection
Role grants and firewall rules are needed setup. Setup alone cannot check single SQL statements or mask sensitive rows in a response. By design, hoop.dev is an open-source proxy that sits beside Postgres, RDS, or Aurora as a sidecar for your Postgres. Clients and agent tools keep their credentials and point their connection string at the listener.
On each query, hoop.dev guardrails refuse disallowed drops, deletes, or table reads before they run. Next, hoop.dev data masking rewrites sensitive fields in returned rows that match your rules. Furthermore, hoop.dev holds SOC 2 Type II and logs every statement and verdict per resource. Check out the project on GitHub.
Frequently asked questions
Should Hex connect to the main Neon branch or a read replica?
Point Hex to a read replica or an isolated branch instead of your main branch. This keeps big analytical queries from slowing down your live app traffic.
How do we stop Hex notebooks from running up Neon compute costs?
Set a strict statement timeout on the Postgres role used by Hex. You can also limit the maximum compute size for that specific Neon endpoint.
Can we restrict which tables a Hex project can query in Neon?
Yes, create a custom Postgres role in Neon with select rights on chosen tables only. Use that limited role when you set up the data connection inside Hex.
Related guides
In this post