Clojure SDK
A thin idiomatic wrapper around
next.jdbc — the modern
JDBC library for Clojure — pointed at ParticleDB’s PostgreSQL v3 wire
on port 5432. Any code that already uses next.jdbc works against
ParticleDB unchanged.
The SDK ships as four files (deps.edn, one source namespace, one
sample, README) and clocks in at ~80 LOC. No new abstractions; the value
it adds is documented defaults + a with-tx macro that bakes in
ParticleDB’s wire-level transaction semantics.
Install
Section titled “Install”{:deps {ai.particledb/clojure {:git/url "https://github.com/nohup23/particledb.git" :git/sha "..." :deps/root "sdk/clojure"} org.postgresql/postgresql {:mvn/version "42.7.4"} com.github.seancorfield/next.jdbc {:mvn/version "1.3.939"}}};; project.clj:dependencies [[com.github.seancorfield/next.jdbc "1.3.939"] [org.postgresql/postgresql "42.7.4"]];; Copy sdk/clojure/src/particledb/core.clj into your src/ tree.Hello World
Section titled “Hello World”(require '[particledb.core :as pdb])
(def db (pdb/datasource {:host "127.0.0.1" :port 5432}))
(pdb/execute! db ["CREATE TABLE users (id INT PRIMARY KEY, name TEXT)"])(pdb/execute! db ["INSERT INTO users VALUES (?, ?)" 1 "alice"])
(pdb/query db ["SELECT * FROM users WHERE id = ?" 1]);; => [{:users/id 1, :users/name "alice"}]Transactions
Section titled “Transactions”(pdb/with-tx [tx db] (pdb/execute! tx ["UPDATE accounts SET balance = balance - ? WHERE id = ?" 100 1]) (pdb/execute! tx ["UPDATE accounts SET balance = balance + ? WHERE id = ?" 100 2]))Any thrown exception inside the block rolls back. ParticleDB’s PG wire on :5432 supports full interactive transaction semantics, including rollback-after-write. The native PDB wire (port 5440) treats BEGIN/COMMIT/ROLLBACK as batch markers — for code that depends on rollback after flushed writes, stay on the PG-wire path that this SDK uses by default.
(def db (pdb/datasource {:host "db.internal.example.com" :port 5432 :user "app" :password (System/getenv "PDB_PASSWORD") :ssl-mode "verify-full" :ssl-root-cert "/etc/ssl/internal-ca.crt"}))Modes match pgjdbc’s canonical set: disable, require, verify-ca,
verify-full.
Run the sample
Section titled “Run the sample”particledb start --no-auth --pg-addr 127.0.0.1:5432 &cd sdk/clojureclojure -M:samplesExpected output ends with [done] hello world cycle complete. Verified end-to-end on 2026-05-19 against ParticleDB 1.1.15 —
6/6 steps green.
Native PDB-wire alternative
Section titled “Native PDB-wire alternative”For higher-throughput workloads where Arrow IPC + HTTP/2-style multiplex matter more than rollback-after-write semantics, swap in the native JDBC driver from Maven Central — the Clojure usage stays identical:
{:dbtype "particledb" ; instead of "postgresql" :host "127.0.0.1" :port 5440 ; PDB native wire ;; ...}Maven Central coordinates: ai.particledb:particledb-jdbc:1.0.0.
Source
Section titled “Source”sdk/clojure/— full SDKdocs/architecture/SDK_CONNECTION_OPTIONS.md— canonical option names across all SDKs
Next steps
Section titled “Next steps”- JDBC Driver reference — native PDB-wire driver in depth
- Java SDK — JDBC + transactional API for JVM languages
- SQL Reference — full SQL surface