Skip to content

Self-hosted database snapshot management platform — capture, query, and compare PostgreSQL/MySQL snapshots as Parquet files

License

Notifications You must be signed in to change notification settings

clroot/snaplake

Repository files navigation

한국어

Snaplake

Docker Image Version License: MIT

Self-hosted database snapshot management platform. Captures point-in-time snapshots from PostgreSQL and MySQL databases as Parquet files, stores them locally or on S3, and lets you query and compare snapshots with SQL powered by DuckDB.

Dashboard

Features

Database Snapshots

Capture full table snapshots as Apache Parquet files. Browse snapshot contents with filtering, sorting, and CSV/JSON export.

Snapshot Browser

SQL Query Engine

Write SQL queries across any snapshot using DuckDB. Join tables, aggregate data, and export results.

SQL Query

Snapshot Comparison

Compare two snapshots side-by-side with row-level diff. Instantly see added, removed, and modified rows with color-coded highlighting.

Compare Diff

And More

  • Scheduled Snapshots — Cron-based automatic snapshots per datasource
  • Retention Policies — Daily/monthly retention limits to manage storage automatically
  • Flexible Storage — Local filesystem or S3-compatible object storage (AWS S3, MinIO, etc.)
  • Setup Wizard — Guided initial setup for admin account, storage, and first datasource
  • Dark Mode — Full dark/light theme support

Quick Start

Docker (Recommended)

docker run -d \
  --name snaplake \
  -p 8080:8080 \
  -v snaplake-data:/app/data \
  -e SNAPLAKE_JWT_SECRET=your-secret-key \
  -e SNAPLAKE_ENCRYPTION_KEY=your-encryption-key \
  abcdkh1209/snaplake:latest

Note: Replace your-secret-key and your-encryption-key with your own secure values. These are used for JWT signing and datasource password encryption respectively. If omitted, random keys are auto-generated on each restart, which will invalidate existing sessions and encrypted data.

Open http://localhost:8080 and follow the setup wizard.

Try with Sample Database

A demo compose file is included with a pre-configured PostgreSQL database:

docker compose -f docker-compose.demo.yml up

This starts Snaplake alongside a PostgreSQL instance loaded with sample data (customers, products, orders). Connect to it during setup:

Field Value
Host sample-db
Port 5432
Database sampledb
Username demo
Password demo1234

Local Development

Prerequisites: Java 21, Bun

# Start backend (port 8080)
./gradlew bootRun

# Start frontend dev server (port 5173, proxied to backend)
cd frontend && bun install && bun run dev

Setup Guide

On first launch, the setup wizard walks you through initial configuration. See the Setup Guide for details.

Configuration

All configuration is done via environment variables:

Variable Default Description
SNAPLAKE_DATA_DIR ./data Directory for SQLite metadata DB and local snapshots
SNAPLAKE_PORT 8080 Server port
SNAPLAKE_JWT_SECRET (auto-generated) JWT signing secret
SNAPLAKE_ENCRYPTION_KEY (auto-generated) AES key for encrypting datasource passwords

Storage (Local or S3) is configured through the web UI during setup.

Architecture

Hexagonal Architecture with clear separation of concerns:

adapter/inbound     (Web, CLI, Scheduler)
        |
application/port    (UseCase interfaces, Port interfaces)
application/service (UseCase implementations)
        |
domain/model        (Pure Kotlin domain models)
        |
adapter/outbound    (JPA, DuckDB, S3, Local Storage)

Dependency direction: adapter -> application -> domain

Extension Points

  • DatabaseDialect — Add support for new database types (currently PostgreSQL, MySQL)
  • StorageProvider — Add new storage backends (currently Local, S3)

Tech Stack

Layer Technology
Backend Kotlin, Spring Boot 3.4, Java 21
Metadata DB SQLite
Query Engine DuckDB
Snapshot Format Apache Parquet
Frontend React 19, TypeScript, Vite
UI Components Carbon Design System
Routing / State TanStack Router, TanStack Query
Auth JWT + Argon2
Storage Local filesystem / S3-compatible

Build

# Full build (backend + frontend)
./gradlew build

# Run tests
./gradlew test

# Frontend only
cd frontend && bun run build

# Frontend lint
cd frontend && bun run lint

License

This project is licensed under the MIT License.

About

Self-hosted database snapshot management platform — capture, query, and compare PostgreSQL/MySQL snapshots as Parquet files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published