Need data to code against? You're in the right place!
In this tutorial we'll create a snapshot of your database, transform the data, and then share that snapshot with your team, so that they can restore it into their own development environments. In doing so, you'll get a basic understanding of how Snaplet works.
Capture a snapshot of your database
- Start by installing the Snaplet CLI. Run:
curl -sL https://app.snaplet.dev/get-cli/ | bash
snaplet config setupin the directory with your source code. This creates a configuration file that adjusts variables in the Snaplet CLI
.snaplet/transform.tsand debug it via
- Once happy, run
snaplet snapshot captureto get your first snapshot of your database
The snapshot is stored in the
.snaplet/snapshots directory. You now have "a nugget of data 🍗" that you can code against.
You can also share this snapshot with your team so that everyone can code against the same database!
Creating a Cloud Project to share snapshots
snaplet auth setup
- Create a Snaplet Cloud Project with
snaplet project setup. This is where snapshots are shared with your team
snaplet snapshot share --message "My first snapshot"
snaplet snapshot list
There you go! The snapshot is uploaded to your project and ready to be restored by your team. You can also manage team access and sharing directly from within the Snaplet cloud application.
Inviting team members and restoring a snapshot
- Add the
.snapletfolder to your repository. The Snaplet CLI uses the configuration to link your source code to a Snaplet Cloud Project.
- To invite members to your Snaplet Cloud Project, run
snaplet project invite.
- Get them to install the CLI, accept the project invite, and have them run
snaplet snapshot restoreto restore your snapshot.
The example above is slightly contrived since you've captured a snapshot of your local development database and your team may not want to code against that. You may prefer to capture from production or staging, so that the snapshots are a more accurate reflection of the data your code runs against.