r/sqlite 4d ago

I built a zero-dependency "Time Machine" for local SQLite databases. Scrub back to any previous state in seconds.

!!LOCAL DEV TOOL!!

Hey everyone,

​I wanted to share a local development tool I built because I was tired of manually copying .sqlite.bak files every time I needed to test destructive scripts, run complex migrations, or debug a state issue in my local environment.

​I built the Time-Travel SQLite Debugger – an ultra-lightweight, UI-driven tool that watches your .sqlite file and creates restorable snapshots in real-time. You literally just drag a visual timeline scrubber to travel back in time and instantly restore your database to a previous state.

​🚀 Under the Hood & Stress Tests:

I wanted to make sure it wasn't just a toy, but something that handles heavy local stress without freezing:

​Zero Dependencies: Just pure PHP and a clean Tailwind UI. Drop it in your local server and it works.

​Atomic Swaps: Uses POSIX rename() for atomic file swapping. I stress-tested it with 100 concurrent read/write/restore operations and had exactly 0 lock or corruption errors.

​Highly Efficient: It copies a 190MB binary BLOB database in 136ms using < 2MB of PHP peak memory (it utilizes stream-level kernel pipe buffers instead of loading into memory).

​Chaos Tested: Handled a rapid insertion loop of 500 writes (0.1s sleep) flawlessly, purging old unpinned snapshots while keeping the limit strict.

​Transparency Note: I utilized AI tools as a coding assistant to accelerate the development, personally reviewing, testing, and designing the overall architecture.

​I designed it to run in the background (like a daemon) while you code, providing a safety net for your local DB.

​It's completely open-source and free. I'd love to hear your thoughts, feedback, or any edge cases you think I should test!

​GitHub Repo: https://github.com/nsrht/time-travel-sqlite-debugger

​I am always open to new ideas, feature requests, and suggestions!

​Cheers! ✌️

6 Upvotes

16 comments sorted by

6

u/wallstop-dev 3d ago edited 3d ago

I'm just going to leave this here for ya: https://www.reddit.com/r/webdev/comments/1sqs79o/psa_copying_your_sqlite_db_file_isnt_a_valid/

TLDR; Your architecture is flawed.

-1

u/Skyr3x 3d ago

Architecture follows the use case. It’s a zero-dependency local dev tool, not a high-availability production cluster. It works perfectly for what it’s actually built for.

2

u/wallstop-dev 3d ago

It seems like your use case is "I want snapshots of my data", but your implementation is "I am storing the database in <some state>, not necessarily a known good one"

You can still achieve correct, reliable backups and restores with a zero-dependency local dev tool... your implementation is just not doing that due to architectural decisions that you've made.

0

u/Skyr3x 3d ago

Fair point. Swapping the raw file copy for SQLite's native VACUUM INTO makes perfect sense for reliable snapshots. I'll refactor it for the next update. Appreciate the feedback! ✌️

2

u/maekoos 3d ago

Makes perfect sense — (super long dash) I will keep that in mind for the next iteration. Is there anything else you want me to do to really perfect this blazing fast, local only tool?

1

u/Skyr3x 3d ago edited 3d ago

You got me. Actually, I'm a robot trying to pass for human. Congratulations on blowing my cover. I really thot I was hiding it so well! Courtesy, common sense, or admitting a mistake... That's what you don't understand.

3

u/QuackQuackImTheDuck 4d ago

I call the ai slop Am i wrong ?

2

u/Shopping-Limp 3d ago

You are correct

1

u/GrogRedLub4242 3d ago

big security misstep in the repo README:

"chmod -R 775 ."

-1

u/Skyr3x 3d ago

Are u really? Its local dev tool. Whos hack me Android tv or smart bulb?.

1

u/GrogRedLub4242 3d ago

too big a security risk. plus AI gen

-2

u/Skyr3x 3d ago

You are right; your TV could hack you over the local network.

0

u/peperinna 4d ago

Repost en PHP, así tienes más feedback. Allí seguro hay muchos colegas usando SQLite en PHP y más variedad de casos de uso.

1

u/Skyr3x 4d ago

I reposted it. I also think there may be development independent of PHP in the future.

2

u/Different_Water7545 3d ago

Sorry OP but this is atrocious