explaingit

replikativ/katzen

16ClojureAudience · developerComplexity · 3/5Setup · easy

TLDR

A Clojure library that lets you declare data schemas with built-in validation rules and write migrations as mappings between schema versions, so your data moves automatically without hand-written migration scripts.

Mindmap

mindmap
  root((repo))
    What It Does
      Schema declaration
      Automatic migration
      Data relation and join
    Features
      Inline constraints
      Mapping-based migration
      Simulation modeling
      Browser dataflow view
    Tech Stack
      Clojure
      JVM
    Optional Add-ons
      Persistent queryable store
      Numerical solvers
      Formal proof checker
    Use Cases
      Database migrations
      Constraint validation
      Dynamic simulations
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Declare a financial schema with a constraint that debits must equal credits and have Katzen enforce it automatically across all records.

USE CASE 2

Write a mapping between an old schema version and a new one to migrate database records without scripting the transformation by hand.

USE CASE 3

Model a simulation such as a disease spread model, wire subsystems together, and run a numerical solver against it in Clojure.

USE CASE 4

Paste a Clojure function into the browser playground and see it rendered as a dataflow diagram with branches shown as forks and unused bindings as dropped wires.

Tech stack

ClojureJVM

Getting it running

Difficulty · easy Time to first run · 30min

Add one line to deps.edn, optional numerical solver and formal proof checker require separate alias flags in deps.edn.

In plain English

Katzen is a Clojure library that helps you describe the structure of your data and processes once, then automatically check, migrate, and relate that data without writing repetitive boilerplate code. It is a port of a Julia software stack built around category theory, a branch of mathematics concerned with how different structures relate to each other. You do not need to understand the mathematics to use it, the library handles those details and exposes ordinary Clojure code on top. The main practical benefit is around data schemas and their rules. Instead of scattering validation checks across many places in your code, you declare constraints directly in the schema itself, such as requiring that debits equal credits or that no references point to missing records. When you need to change the shape of your data over time, you write a mapping between the old schema and the new one, and the library moves the data along that mapping without you writing a migration script by hand. Katzen also supports relating data of different shapes, such as pattern-matching across a graph to find where a given structure appears, or joining two stores that share a common identity. A separate capability covers modeling and simulating dynamic systems: you can describe things like disease spread models or chemical reaction networks, wire subsystems together, and run numerical solvers on them. An optional integration compiles these simulations to fast JVM code. For exploring how code works visually, the project includes a playground in the browser where you paste a Clojure function and see it rendered as a dataflow diagram. Branches in the code become forks in the diagram, and unused bindings appear as dropped wires. Installation is a single line added to your deps.edn file. The base library has no extra dependencies. Optional add-ons, each gated behind a separate alias, unlock a persistent queryable store, fast numerical solvers, and a formal proof checker that verifies a schema mapping actually preserves all the rules you declared.

Copy-paste prompts

Prompt 1
I want to use katzen to declare a schema for invoice records with a constraint that line item totals must sum to the invoice total. Show me the Clojure code.
Prompt 2
I have a katzen schema for user profiles and need to add a new required field with a default value. Show me how to write a migration mapping between old and new schema versions.
Prompt 3
How do I use katzen to join two data stores that share a common user ID field and query across both of them?
Prompt 4
I want to model a simple epidemic simulation using katzen's dynamic system support. Show me how to declare compartments and wire them together for numerical solving.
Open on GitHub → Explain another repo

← replikativ on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.