A simple API for computing diffs of your documents over the time built on a scalable technology stack.

Diffme API

WIP - this is an API to compute diffs between documents.

It serves as a way to easily create audit logs for documents in your system, think version control for your documents.

For example, if you had a document like the below you could easily answer questions like...

const Item = {
    name: "Chaga",
    price: 10.50,
    description: "Superfood for your soul",
}
  1. What changes were made to this document?
  2. Who made these changes?
  3. Who changed the "name" field on the document?

Even after you perform updates to it. So if the name changed from "Chaga" to "Chagachino", there would be a diff for that giving you a complete audit history of everything that happens.

How does it work?

Diffme tracks document diffs over time by taking snapshots and then using jsondiff to compute patches between documents using the RFC6902 standard. It will compare documents fields, nested objects, arrays, etc... and track differences between json objects, and then automatically store and index those diffs for fast retrieval later.

TODO: implement a similar concept to git packfiles where snapshots are packaged with diffs to reduce size on disk.

How can I use this?

In typescript you could use the below code to easily generate a difference with this api.

import axios from "axios"

const client = axios.create({
    baseURL: "your diffme api url"
})

const document = { name: "Chaga", price: 10.50, id: "1"}

// creates the first snapshot
client.post("/v1/snapshots", {
    reference_id: document.id,
    data: document,
    editor: "andrew",
})

// edit the documents name
document.name = "Chagachino"

// this would create a diff saying the name was changed from "Chaga" to "Chagachino"
// by olivia
client.post("/v1/snapshots", {
    reference_id: document.id,
    data: document,
    editor: "olivia",
}) 

// you can then easily search your documents by doing something like this...
client.get(`/v1/changes/{document.id}/search`, {
    editor: "olivia", // optional
    field: "name", // optional
    value: "Cha", // optional
})

And that is it! It is a simple rest API to easily get diffs of documents over time.

Why would I want this?

Storing diffs of your documents has a lot of benefits including:

  1. Easily searchable changes with elasticsearch.
  2. Saves dev time debugging bc you can examine the diffs of documents over time.
  3. Know who edited stuff when and where.

You could build this yourself, but it isn't differentiating your business AND this is free and open source so why not?

API Documentation

TODO:

Technology

  • Go
  • Redis (for pubsub)
  • Protobufs (for pubsub data encoding)
  • Elasticsearch (for searching diffs)
  • Mongo (for storing diffs and snapshots of documents)

It exposes an easy to use REST api that you can post a document to, and it will track the diffs over time.

Similar Resources

Hotswap provides a solution for reloading your go code without restarting your server, interrupting or blocking any ongoing procedure.

Hotswap provides a solution for reloading your go code without restarting your server, interrupting or blocking any ongoing procedure.

Hotswap provides a solution for reloading your go code without restarting your server, interrupting or blocking any ongoing procedure. Hotswap is built upon the plugin mechanism.

Jan 5, 2023

Use Golang to implement PHP's common built-in functions.

PHP2Go Use Golang to implement PHP's common built-in functions. About 140+ functions have been implemented. Install go get github.com/syyongx/php2go R

Dec 28, 2022

go-sundheit:A library built to provide support for defining service health for golang services

go-sundheit:A library built to provide support for defining service health for golang services

A library built to provide support for defining service health for golang services. It allows you to register async health checks for your dependencies and the service itself, and provides a health endpoint that exposes their status.

Dec 27, 2022

Drone eReg: Demo client application for the PKI server's built-in UAV registry

UAV e-Registration: Demo UAV Registry Client A client to register UAVs in the built-in demo UAV registry of the UAVreg-PKI-server. Installation and Us

Jan 5, 2022

Meteoric golang nitro sniper, 0.1/0.5s claim time.

Meteoric golang nitro sniper, 0.1/0.5s claim time.

Meteoric golang nitro sniper, 0.1/0.5s claim time.

Apr 3, 2021

Constant time big numbers for Go

The purpose of this package is to provide a version of arbitrary sized arithmetic, in a safe (i.e. constant-time) way, for cryptography.

Jan 2, 2023

Clean-Swift source and test code auto-generator. It can save you time typing 500-600 lines of code.

Clean-Swift source and test code auto-generator. It can save you time typing 500-600 lines of code.

Clean-Swift source & test code auto generator Overview Run Output Basic Usage make config.yaml target_project_name: Miro // target project name copyri

Apr 13, 2022

Cell is a Go package that creates new instances by string in running time.

Cell Cell is a Go package that creates new instances by string in running time. Getting Started Installing To start using CELL, install Go and run go

Dec 20, 2021

A Go library for calculating the sunset/sunrise time from a given location.

solar A library for calculating the sunset/sunrise time from a given location, as well as a function to calculate the whitepoint. It is a port of ~ken

Nov 28, 2021
Continuous profiling for analysis of CPU, memory usage over time, and down to the line number. Saving infrastructure cost, improving performance, and increasing reliability.
Continuous profiling for analysis of CPU, memory usage over time, and down to the line number. Saving infrastructure cost, improving performance, and increasing reliability.

Continuous profiling for analysis of CPU, memory usage over time, and down to the line number. Saving infrastructure cost, improving performance, and increasing reliability.

Jan 2, 2023
Go Parrot Twap will execute buy or sell orders over a specific time interval.

Go Parrot Twap Go Parrot Twap will execute buy or sell orders over a specific time interval. Getting started Firstly copy the .env.example to .env and

Dec 13, 2022
Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation

stack Lightweight, Simple, Quick, Thread-Safe Golang Stack Implementation Purpose Provide a fast, thread safe, and generic Golang Stack API with minim

May 3, 2022
Fast and scalable pseudorandom generator for Go

fastrand Fast pseudorandom number generator. Features Optimized for speed. Performance scales on multiple CPUs. How does it work? It abuses sync.Pool

Dec 22, 2022
Fast, scalable pseudo random number generator based on xxh3
Fast, scalable pseudo random number generator based on xxh3

XXH3-Based Pseudorandom Number Generator This package contains an experimental implementation of a noise based pseudorandom number generator that scal

Nov 24, 2022
Scalable golang ratelimiter using the sliding window algorithm. Currently supports only Redis.
Scalable golang ratelimiter using the sliding window algorithm. Currently supports only Redis.

go-ratelimiter Scalable golang ratelimiter using the sliding window algorithm. Currently supports only Redis. Example usage client := redis.NewClient

Oct 19, 2021
Daypaper sets your GNOME wallpaper based on the time of day from a random and relevant Unsplash image.

Daypaper Daypaper sets your GNOME wallpaper based on the time of day from a random and relevant Unsplash image. Installation You will need an Access T

May 23, 2022
Gopher-ml - Simple neural network built in go

Building a neural network from scratch with Golang Simply neural network built i

Jan 10, 2022
Perforator is a tool for recording performance metrics over subregions of a program using the Linux "perf" interface.

Perforator Perforator is a tool for recording performance metrics over subregions of a program (e.g., functions) using the Linux "perf" interface.

Dec 15, 2022
Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.
Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package.

Goridge is high performance PHP-to-Golang codec library which works over native PHP sockets and Golang net/rpc package. The library allows you to call Go service methods from PHP with a minimal footprint, structures and []byte support.

Dec 28, 2022