npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

temporal-db

v1.1.2

Published

Git-like versioning for application data

Readme

TemporalDB

A lightweight, versioned JSON database with branching, merging, and time-travel capabilities.

Installation

npm install temporal-db  

Basic Usage

// Initialize  
const db = new TemporalDB();  
await db.init();  

// Save data  
await db.commit('main', {  
  users: [{ id: 1, name: 'Alice' }],  
  settings: { theme: 'light' }  
}, 'Initial commit');  

// Get data  
const data = await db.getData();  
console.log(data);  

Real-world Example: Document Editor

// Initialize editor database  
const db = new TemporalDB();  
await db.init();  

// Save initial document  
await db.commit('main', {  
  title: 'My Document',  
  content: 'Hello world',  
  lastEdited: new Date().toISOString()  
}, 'First draft');  

// Make edits  
async function saveChanges(newContent) {  
  const doc = await db.getData();  
  doc.content = newContent;  
  doc.lastEdited = new Date().toISOString();  
  await db.commit('main', doc, 'Updated content');  
}  

// View revision history  
function getHistory() {  
  return db.getHistory('main');  
}  

// Restore old version  
async function restoreVersion(timestamp) {  
  const oldDoc = await db.getDataAt('main', timestamp);  
  await db.commit('main', oldDoc, 'Restored old version');  
  return oldDoc;  
}  

// Create experimental branch  
async function createExperiment() {  
  await db.branch('experiment', 'main');  
  await db.checkout('experiment');  
  
  // Try new formatting  
  const doc = await db.getData();  
  doc.content = doc.content.toUpperCase();  
  await db.commit('experiment', doc, 'ALL CAPS experiment');  
}  

// If experiment works, bring changes back to main  
async function applyExperiment() {  
  await db.checkout('main');  
  await db.merge('experiment', 'main');  
}  

Key Features

Branching

// Create a branch for experiments  
await db.branch('experimental', 'main');  
await db.checkout('experimental');  

// Make changes on this branch only  
const data = await db.getData();  
data.settings.theme = 'dark';  
await db.commit('experimental', data, 'Try dark theme');  

Merging

// Go back to main branch  
await db.checkout('main');  

// Bring in changes from experimental branch  
await db.merge('experimental', 'main');  

Time Travel

// Get data from a specific time  
const oldData = await db.getDataAt('main', '2023-04-01T12:00:00Z');  

// See all your changes  
const history = await db.getHistory('main');  

Core API

  • db.init() – Start the database
  • db.commit(branch, data, message) – Save data with a commit message
  • db.getData() – Get current data state
  • db.branch(newBranch, source) – Create a new branch from source
  • db.checkout(branch) – Switch to a different branch
  • db.merge(source, target) – Merge source branch into target
  • db.getDataAt(branch, time) – Retrieve data at a given timestamp
  • db.getHistory(branch) – List commit history for a branch

License

MIT