Travels 3.0 is hereSee what’s new

PATCH-BASED STATE HISTORY

Every change.A way back.

Durable undo/redo for modern applications. Keep compact history, write natural mutation-style updates, and integrate with the state tools you already use.

$pnpm add travels mutative

Works with React · Vue · Zustand · MobX · Pinia · Vanilla JS

Rename canvasreplace /title "Launch board"

RFC 6902 JSON Patches
Framework-agnostic core
TypeScript-first API
Storage-agnostic persistence

WHY TRAVELS

A smaller history. A bigger editing experience.

Built for large state, small updates, long timelines, and histories that need to survive a reload—not just the current render.

TRY IT LIVE

Build it up. Take it back.

Every block below is a real Travels update, and a whole drag stroke is archived as one undoable step. Inspect the patches, scrub the timeline, then reload the page: the history is restored from this browser’s storage.

Click or drag across the board. One drag is archived as one undo step. Keyboard: arrows move, Enter applies, Delete erases, B/P/E switch tools, 1–6 pick a color, R rotates.

00

patches[0] forward · redo replays these

The starting scene has no incoming patch. Place a block to record one.

inversePatches[0] inverse · undo applies these

Nothing to undo from here.

History size, measured livesnapshots lead for now
Travels · state + patches550 B
Snapshot stack · every state458 B

Each step adds the whole scene to a snapshot stack, but only the change to Travels.

JSON.stringify(travels.serialize()) versus every state in getHistory(). Snapshots can win while a scene is tiny; small edits to larger state widen the gap.

Waiting to save

NATURAL UPDATES, PRECISE HISTORY

Write like it’s mutable.
Travel like it’s immutable.

Travels uses Mutative to turn familiar draft mutations into immutable state and reversible patches. No reducer boilerplate, no manual inverse operations.

  • No-op updates stay out of history
  • Metadata labels every meaningful edit
  • Read-only controls fit any UI
Explore state updates
quick-start.ts
import { createTravels } from 'travels';const travels = createTravels({  document: { title: 'Untitled' }});travels.setState((draft) => {  draft.document.title = 'Hello, Travels';});travels.back();    // undotravels.forward(); // redo
getState()
{ document: { title: 'Hello, Travels' } }
getPosition()
1
canBack() / canForward()
true / false
applied patch
replace /document/title "Hello, Travels"

ONE CORE, TWO OWNERSHIP MODELS

History that fits your architecture.

Let Travels own updates, or keep your existing store authoritative. The history contract stays explicit in both directions.

STATE-OWNING

createTravels()

Send updates through Travels and receive immutable states, patches, navigation, and controls.

Updates flow from your code through Travels to your UI. back() and forward() go from your UI to Travels.

Own state with Travels
EXTERNALLY OWNED

createTravelJournal()

Record patches from an existing store or state machine, then delegate undo/redo through its commit path.

Your store commits and records patches in the journal, which drives your UI. back() and forward() are delegated back through your store’s commit path.

Connect an external owner

MADE FOR MEANINGFUL EDITS

Give every interaction a way back.

From a single field to a complex canvas, make exploration feel safe.

01

Visual editors

Group complex canvas operations into atomic steps and keep long editing sessions compact.

Canvas · Design tools · Whiteboards
02

Forms & builders

Choose when edits become undoable steps with manual archives and external form ownership.

Forms · Page builders · Workflows
03

Local-first apps

Persist complete timelines, validate restored history, and recover intentionally from bad data.

Offline drafts · IndexedDB · Sync

DOCUMENTATION FOR THE WHOLE JOURNEY

Start small. Understand every edge.

Practical guides, integration recipes, operational guardrails, and source-generated API reference.

Need the exact signature?

Browse every exported function, interface, type alias, class, and variable.

API Reference

MAKE YOUR NEXT EDIT REVERSIBLE

Your users make mistakes.
Your state doesn’t have to.

One small package. A complete history engine.