Start with an embedded database. Open a shell, serve SQL, or bring a cluster online.
{ }IN PROCESS
Embedded
Use Go’s database/sql or the native API. Pooled connections share one engine with independent SQL sessions.
GO · IN THE SLOPDB MODULE
package main
import (
"database/sql""log"
_ "slopdb/driver"
)
func main() {
pool, err := sql.Open(
"slopdb", "./ideas")
if err != nil { log.Fatal(err) }
var hello int
err = pool.QueryRow(
"SELECT 1").Scan(&hello)
closeErr := pool.Close()
if err != nil { log.Fatal(err) }
if closeErr != nil {
log.Fatal(closeErr)
}
}
>_AT THE PROMPT
CLI
Explore your data interactively, inspect a schema, or run a SQL file from your terminal.
TERMINAL
# Build from the repository root
go build -o slopdb .
# Open an interactive SQL prompt
./slopdb ./ideas
# Or run a SQL file
./slopdb ./ideas < queries.sql
↔OVER THE WIRE
Server
Serve MySQL and PostgreSQL clients from one process, with independent session dialects over the same data.
MYSQL + POSTGRESQL
# One engine, both SQL listeners
./slopdb \
--mysql-tcp 127.0.0.1:3306 \
--postgres-tcp 127.0.0.1:5432 \
./ideas
⋈ACROSS NODES
Raft cluster
Replicate the database with leader-based writes, durable quorum commits, and automatic elections.
BOOTSTRAP THE FIRST NODE
# Set a shared cluster secret
export SLOPDB_RAFT_TOKEN=\
'replace-with-a-long-random-secret'
# Start the first member
./slopdb --raft-id n1 \
--raft-bootstrap \
--raft-listen \
tcp://127.0.0.1:9400 \
--raft-control \
tcp://127.0.0.1:9401 \
--raft-token-env \
SLOPDB_RAFT_TOKEN \
--mysql-tcp 127.0.0.1:3306 \
./node-1
Examples assume a build from the repository root. Both SQL listeners share one owning process per database directory. See the protocol guides for SQL compatibility and authentication.
02 / BUILT TO REPLICATE
A little slop. A proper quorum.
Take the same SQL engine across nodes with HashiCorp Raft. New members clone a snapshot, catch up as learners, and become voters after validated catch-up.
Sync mode waits for durable storage on a voting majority and durable application on the leader. A three-voter cluster can continue with one voter unavailable.
02
Replicas with a role.
Full voters can lead. Permanent non-voting replicas keep data without changing the quorum. Logs-only voters participate in consensus without materializing SQL tables.
03
Choose how reads catch up.
SQL goes to the ready leader by default. Opt replicas into bounded-staleness or durable-barrier reads, with commit-position tokens to coordinate visibility.
# 01 — get the source
git clone https://github.com/midom/slopdb.git
cd slopdb
# 02 — build it
go build -o slopdb .
# 03 — make a little space for your data
./slopdb ./example-db