Jian Reis
May 17, 2022

JavaScript Transformations and Proxy - better together!

Some things in life are just better together. Toast and butter. Macaroni and cheese. Burgers and fries. Gin and tonic. Add one more to that list today, as we reveal JavaScript Transformations and Proxy. Awesome individually, even better when they work together.

Let’s talk JavaScript Transformations first: We know that coding against no data (or unrealistic data) sucks. We built Snaplet so you could spend more time coding against production-accurate data, and less time doing everything else, like wrangling that data out of your database to code against. Until now, our domain specific language has allowed you to transform your data easily enough, albeit with a language that we invented, so you had to look up a reference for how to transform values. We want to keep you in flow; keep you focused on coding, which is why we now integrate into your development workflow by providing you with the ability to safely transform your data using a language you already know: JavaScript! 🧑‍💻

We didn’t stop there though. While JavaScript functions are immensely powerful and capable of transforming personal information in useful ways, in practice using them could become quite tedious: imagine writing a JS function that uses conditional logic, and having to capturing an entire snapshot to test it, then finding a bug, fixing it, and repeating that process? We wanted to unlock the ability for developers to “live reload” the data in their database, so we’re introducing snaplet proxy, a genius little proxy that lives between your code environment and your database.
Proxy intercepts and transforms traffic between your database client and the database, allowing you to test and change your JavaScript transformations in real-time without any changes to the original database! No snapshot captures, no reloading, just real-time transformations in your editor. Even better - once you’ve transformed your data, you can easily share your configuration with your teammates with the new snaplet config push command, making it easy for everyone on your team to work against the same data.

Watch Snaplet co-founder Peter Pistorius explain more about how JavaScript Transformations and Proxy work:

JavaScript Transformations and Proxy play nicely with Copycat, our library for generating deterministic fake values. You can also continue to use Faker to create fake data if you’re more used to that.

We hope you find JavaScript Transformations and Proxy useful. It’s our mission to give you safe, production-accurate data effortlessly in your dev environment, so you can focus on shipping. If you’ve got a request for a Snaplet feature that’d help you ship, come tell us about it in our Discord, and we’d love to hook you up with some swag!

Check out the documentation >

Jian Reis