Skip to content

moclojer/chrondb

Repository files navigation

ChronDB: The Time-Traveling Database

Chronological key/value Database built on Git architecture with complete version history.

GitHub License Discord Documentation

✨ Features

ChronDB offers unique capabilities for your data:

  • Complete History - Every change is preserved, nothing is ever truly deleted
  • Time Travel - Query your data as it existed at any point in time
  • Multiple Interfaces:
    • 🧩 Native Clojure API - Direct integration for JVM applications
    • 📡 REST API - HTTP interface for any language
    • 🔄 Redis Protocol - Connect using Redis clients
    • 🗄️ PostgreSQL Protocol - Connect with SQL clients
  • ACID Transactions - Guaranteed consistency and durability
  • Schemaless Design - Store any JSON-compatible data
  • Git Foundation - Leverage Git's powerful features:
    • Branching and merging for isolated environments
    • Diffs between versions
    • Complete audit trails with commit messages

🚀 Quick Start

Using Docker (Simplest)

# Start ChronDB with all protocols enabled
docker run -d --name chrondb \
  -p 3000:3000 \  # REST API
  -p 6379:6379 \  # Redis protocol
  -p 5432:5432 \  # PostgreSQL protocol
  -v chrondb-data:/data \
  moclojer/chrondb:latest

Using Clojure

In your deps.edn:

{:deps {com.github.moclojer/chrondb {:git/tag "v0.1.0"
                                     :git/sha "..."}}}

Then in your code:

(require '[chrondb.core :as chrondb])

;; Create a database connection
(def db (chrondb/create-chrondb))

;; Create a document
(chrondb/save db "user:1" {:name "Alice" :email "[email protected]"})

;; Update the document
(chrondb/save db "user:1" {:name "Alice" :email "[email protected]" :role "admin"})

;; Time travel: see how the document looked at a specific point in time
(def yesterday (chrondb/get-at db "user:1" "2023-07-15T00:00:00Z"))

;; See all versions of the document
(def history (chrondb/history db "user:1"))

Running the Server

# Clone the repository
git clone https://github.com/moclojer/chrondb.git
cd chrondb

# Run with default settings (REST on 3000, Redis on 6379, PostgreSQL on 5432)
clojure -M:run

# Or with custom ports
clojure -M:run 8080 6380 5433

🧠 Concept

ChronDB maps database concepts to Git's structure:

  • Database → Git repository
  • Schema → Git branch
  • Table → Directory in repository
  • Document → JSON file in directory
  • History → Commit timeline

This approach gives you all the power of Git for your database operations.

📚 Documentation

Complete documentation is available at chrondb.moclojer.com

🛠️ Requirements

  • Java 11 or later
  • Git 2.25.0 or later

💬 Community

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

📄 License

ChronDB is licensed under the terms of the GNU General Public License v3.0 (GPLv3).

This means:

  • You are free to use, study, modify, and redistribute the software.
  • Any distributed modified version must also be licensed under GPLv3.
  • See the LICENSE file for full details or visit gnu.org/licenses/gpl-3.0.

About

Chronological key/value Database built on Git architecture with complete version history

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 6