Post image

Database branching makes it easy to create database copies for your non-prod environments, but some companies face the obstacle of how to anonymize PII to ensure privacy. This can be solved with Neosync, an open-source tool that allows developers to anonymize data across branches. Try it with Neon

Developers worldwide are adopting Postgres to run their production workloads. But when it comes to setting up and maintaining lower-level environments, teams face some challenges. First, creating database copies for these environments gets expensive and time-consuming. Second, anonymizing sensitive production data to make it safe for previews or even dev environments can get complex.

The first problem (how to create database copies efficiently) is being solved by Neon and the database branching model. The second problem (the data anonymization problem) is the one Neosync is focusing on.

Creating database branches with anonymized data: a workflow by Neon and Neosync

One of the standout features of Neon is its ability to perform database branching including data and schema via copy-on-write. This feature is inspired by code branching in Git, enabling developers to create lightweight, isolated database branches in seconds.

These branches effectively act like database copies but without duplicating storage, saving you the time and money required to duplicate your entire dataset. Database branches can be added to your existing workflows via GitHub Actions. Preview deployments with prod-like data are a perfect application for database branches.

But, how to anonymize PII in non-prod branches if your application demands it? Here’s where Neosync comes into play. Neosync is an open-source platform that helps developers anonymize production data and sync it across their environments for a better developer experience.

By combining both tools, developers can anonymize data in their database branches, for example for their preview environments. Here’s the workflow:

You can check out our docs for a complete walkthrough of the Neon and Neosync integration. For setting up your Preview workflows, follow the Actions on this page.

PS: If you would like to see a tighter integration between Neon and Neosync, where database branches are anonymized without configuring them in Neosync, let us know on Twitter.

Try it out 

Both Neosync and Neon offer generous free tiers. If you’re interested in trying this workflow for free, follow the steps in the guide and get started in just a few minutes.