Overview
Snaplet gives developers production-accurate PostgreSQL data and preview databases that they can code against. It does this by capturing a 'snapshot' of a database, copying the schema, and providing a JavaScript runtime for transforming, reducing (subsetting) and generating synthetic data. Developers can then share these snapshots with their team for collaborative development.
The problem
As a developer, it's difficult to get accurate data to code against. Coding against accurate data reduces errors as a result of fewer assumptions, and generally removes ambiguity when adding features or fixing bugs.
The two most common approaches to getting production-accurate data is to generate it via a seed script, or to directly copy a database, either production itself, or a production-like database such as staging or QA.
Both of these approaches have drawbacks. Seed scripts are tedious to write and maintain, are often inaccurate, and generally offer a tiny, non-representative sampling of data. Copying from production happens outside of established development workflows, is slow and cumbersome because you have to copy all the data, and almost certainly contains personal information about your users.
The solution
Snaplet is a command line tool that gives developers a "code as configuration" environment for transforming, reducing (subsetting), and generating data. The data is stored as snapshots that can be restored into any development environment, and shared with teammates for collaborative development against a shared database.
Examples
- Join a new team, run
snaplet snapshot restore
and get a snapshot of the production database from the evening before - See a bug in production? Run
snaplet snapshot restore --new
and restore an "on demand" snapshot in an instant - Write E2E tests against actual data
- Spin up pull requests or deploy preview databases with accurate data
- Write data-migrations against accurate data
The workflow
- Capture a snapshot
- Generate, transform, reduce or exclude data
- Share the snapshot
- Restore to dev environment