Zero-Friction Branching
Nanokit simplifies database management by introducing Zero-Friction Branching. This feature ensures that your data layer always follows your application’s state, specifically your Git branches.
How it Works
When you create a new feature branch in your repository, Nanokit’s Data Layer detects the change and can automatically provision an isolated database fork for that branch.
Key Benefits
- Isolation: Work on experimental features without risking production data.
- Speed: Instantly create fresh environments with pre-populated data.
- Consistency: Ensure all team members work with the same data schema.
Configuration
To enable branching for a database, add the branching property in your nanokit.yml:
databases:
main-db:
engine: postgres
branching:
enabled: true
strategy: snapshot # or 'empty'Strategies
snapshot: Nanokit takes a snapshot of the base branch database and creates a fork.empty: Nanokit creates a fresh, empty database schema.
Data Layer Integration
The Data Layer automatically injects the correct DATABASE_URL into your service’s environment variables based on the active branch. You don’t need to manually update connection strings.