HUB
Sign inSign up

nayem7663/spyddb

By nayem7663

•Updated 1 day ago

SpydDB server with SpydWire SPD2, pgwire, HTTP APIs, and official Python, Rust, Node & Java SDKs.

ImageBuildkit cache
0

292

nayem7663/spyddb repository overview

⁠SpydDB Server

SpydDB is a high-performance, security-hardened server database speaking SpydWire v2 (SPD2 canonical binary fast path + SPD1 JSON compatibility) alongside PostgreSQL wire (pgwire) and an authenticated HTTP/1.1 API.

Source repository: GitLab (spydotech-group/spyddb)⁠

SpydDB documentation⁠

⁠Quick Start

Run this from any directory with a local Docker Engine or Docker Desktop. The setup creates a local TLS certificate and a random admin token. It publishes the three listeners on available loopback ports and prints their addresses.

(
  set -eu
  image=nayem7663/spyddb:latest
  docker pull "$image"

  docker run --rm --network none --cap-drop ALL \
    --mount type=volume,source=spyddb-local-config,target=/etc/spyd \
    --entrypoint sh "$image" -eu -c '
      cd /etc/spyd
      if [ -s local.json ]; then exit 0; fi
      if ! grep -q "replace-this-token-from-a-secret-manager" server.json; then
        printf "%s\n" "SpydDB configuration template is missing or has changed." >&2
        exit 1
      fi

      umask 077
      tmp=$(mktemp -d .setup.XXXXXX)
      trap "rm -rf -- \"$tmp\"" EXIT
      openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
        -keyout "$tmp/ca.key" -out "$tmp/ca.crt" -days 365 \
        -subj "/CN=SpydDB Local CA" -addext "basicConstraints=critical,CA:TRUE" \
        -addext "keyUsage=critical,keyCertSign,cRLSign"
      openssl req -new -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes \
        -keyout "$tmp/server.key" -out "$tmp/server.csr" -subj "/CN=localhost" \
        -addext "subjectAltName=DNS:localhost,IP:127.0.0.1" \
        -addext "basicConstraints=critical,CA:FALSE" -addext "extendedKeyUsage=serverAuth"
      openssl x509 -req -in "$tmp/server.csr" -CA "$tmp/ca.crt" -CAkey "$tmp/ca.key" \
        -days 365 -copy_extensions copy -out "$tmp/server.crt"

      token=$(openssl rand -hex 32)
      sed "s/replace-this-token-from-a-secret-manager/$token/" server.json > "$tmp/local.json"
      printf "%s\n" "$token" > "$tmp/admin-token"
      mv "$tmp/ca.crt" "$tmp/server.crt" "$tmp/server.key" tls/
      mv "$tmp/admin-token" admin-token
      mv "$tmp/local.json" local.json
    '

  docker run -d --name spyddb-local --cap-drop ALL \
    -p 127.0.0.1::5433 -p 127.0.0.1::5432 -p 127.0.0.1::8080 \
    --mount type=volume,source=spyddb-local-data,target=/var/lib/spyd \
    --mount type=volume,source=spyddb-local-config,target=/etc/spyd,readonly \
    "$image" --config /etc/spyd/local.json

  attempts=0
  until docker exec spyddb-local curl -fsS --cacert /etc/spyd/tls/ca.crt \
    https://127.0.0.1:8080/v1/health 2>/dev/null; do
    attempts=$((attempts + 1))
    if [ "$attempts" -ge 30 ]; then docker logs --tail 40 spyddb-local; exit 1; fi
    sleep 1
  done
  printf '\nPublished ports (container → host):\n'
  docker port spyddb-local
)

To open Web Studio, trust the local CA in your browser and open the URL printed below. Sign in with the admin token. The same CA lets command-line clients verify TLS.

docker cp spyddb-local:/etc/spyd/tls/ca.crt ./spyddb-local-ca.crt
printf 'Web Studio: https://%s/studio/\n' "$(docker port spyddb-local 8080/tcp)"
docker exec spyddb-local cat /etc/spyd/admin-token

Copy the token only into clients you trust. Use docker stop spyddb-local to stop the server and docker start spyddb-local to bring it back with the same data and credentials.

⁠Bring your own configuration

For a custom deployment, create a server.json file and place the certificate and private key at the paths it specifies. Use --mount for read-only bind mounts so Docker reports a missing source path directly. Run test -f ./server.json before mounting the file. A directory at that path may be left over from an earlier -v command. See the operations guide⁠ for production configuration.

⁠Official Client Drivers & ORMs

All four published SDKs connect directly over TLS SpydWire SPD2 (5433/tcp) and provide synchronous and asynchronous APIs plus type-safe ORMs:

LanguagePackageRegistryVersionHighlights
Pythonspyddb⁠PyPI1.0.0Sync driver, native asyncio AsyncClient / AsyncPool, and ORM
Rustspyd-rust-driver⁠crates.io1.0.0Sync driver, opt-in Tokio async feature, and ORM; core crates: spyd-wire⁠, spyd-core⁠
Node.js / TypeScriptspyddb⁠npm1.0.0Native async SPD2 driver, pooling, and TypeScript ORM
Java 21+io.github.muhibnayem:spyddb-client⁠Maven Central1.0.0Virtual-thread sync & CompletableFuture async (SpydAsyncClient), HTTP client, and Java ORM

Additional language clients (C, C++, Go, .NET, JDBC, ODBC, PHP, Ruby) live in the source repository⁠.

⁠Install SDKs
# Python (PyPI)
pip install spyddb==1.0.0

# Node.js / TypeScript (npm)
npm install spyddb

# Rust (crates.io)
cargo add spyd-rust-driver --features async
<!-- Java 21+ (Maven Central) -->
<dependency>
  <groupId>io.github.muhibnayem</groupId>
  <artifactId>spyddb-client</artifactId>
  <version>1.0.0</version>
</dependency>
// Java 21+ (Gradle Kotlin DSL — Maven Central)
implementation("io.github.muhibnayem:spyddb-client:1.0.0")

⁠Ports & Health Endpoints

  • 5433/tcp — SpydWire (SPD2 binary & SPD1 JSON framed protocol over TLS/TCP)
  • 5432/tcp — PostgreSQL wire protocol (pgwire v3 over TLS/TCP)
  • 8080/tcp — Authenticated HTTP/1.1 query & management API (/v1/query, /v1/catalog, /v1/health)
  • 9090/tcp — Loopback health/readiness and Prometheus metrics (/readyz, /healthz, /metrics)

⁠Security Defaults

  • Runs as non-root system user (UID 999 / GID 999).
  • Non-loopback listeners require TLS (certificate + private_key mounted in /etc/spyd/tls).
  • Supports token auth and RFC 5802 SCRAM-SHA-256 authentication, per-tenant/workload quotas, and fail-closed SPD2 frame/depth/bounds checks.
Tag summary
Recent tags
Content type
Image
Digest
sha256:15f59abd4…
Size
120.1 MB
Last updated
1 day ago
docker pull nayem7663/spyddb:latest