Skip to content

Backups

Replit database rollback: does a checkpoint bring your data back?

A Replit database rollback restores the development database only when you ask. Your live data has a restore of its own. Which one you need, and how.

Vlad Tkachenko12 min read
Save-point flags with an arrow curving back to one under a workspace, and past a dashed line a big database with its own dial.

In short

  • A Replit database rollback happens only if you ask for it. Rolling back to a checkpoint leaves your database as it is unless you select Database under Additional rollback options.
  • Even then it restores the development database you build with. Replit says checkpoint rollback never touches the production database your published app uses.
  • The production database has its own restore, point-in-time recovery. It is on by default for the last 7 days and puts your live data back to any second inside that window.
  • Restoring the data leaves the code where it is, and rolling back the code leaves the live data where it is. The one copy you hold yourself is an export you download.

You asked Replit Agent to tidy up some test records, or to change how your orders are stored, and something real went missing with them. Every checkpoint in the Agent tab has a rollback button, and the question in front of you is whether pressing it brings the rows back. A Replit database rollback is possible. That button does it only if you ask, and it never reaches the database your published app uses.

Replit's page on checkpoints opens with "With Replit, you never have to worry about losing your work", and says a checkpoint captures your code along with "connected databases". Both lines describe your workspace. A note further down the same page carries the two facts that decide what happens to your data: by default a rollback leaves your database alone, and it never restores your production database.

Replit compares a checkpoint to a save point in a video game, and the comparison holds if you picture an online game. Loading a save puts your own game back the way it was: the level, your notes, and your practice inventory if you tick the box for it. The server, where every other player's progress is kept, carries on exactly as it was. In your app that server is the production database, and it has a rewind of its own on a different screen.

Does a Replit rollback restore your database?

Only the development database, and only when you select it. "By default, rollbacks do not change your database," says Replit's note. To take the development database back with your code, select Database under Additional rollback options before you confirm. Replit's data recovery page puts the rest in one line: "Checkpoint rollback never touches your production database."

So picture the rollback you just did, or are about to do. With the box left alone, your files, packages and settings go back to the checkpoint, Agent's conversation goes back with them, and every row in your development database stays as it is now. With the box ticked, the development database's tables and data also go back to the moment the checkpoint was made. Your live users' data is in neither case.

Replit's two pages describe the confirmation step a little differently, so read the dialog itself. It lists what the rollback is about to change, and the development database belongs on that list only if you meant it to.

Your Replit app has two databases

Every Replit app works with two, kept apart on purpose. The development database is where you and Agent build, and Replit creates it with the app. The production database holds what your published app's users type in, and Replit creates it when you first publish. Until then there is only the first one, and a checkpoint rollback is how you restore it.

Development databaseProduction database
Who uses itYou and Agent, in the Project EditorYour published app and the people using it
When it appearsAutomatically, with every Replit appWhen you publish
What Agent can doCreate and change tablesRead it through a read-only copy, and change nothing
How it comes backA checkpoint rollback with Database selectedPoint-in-time recovery, or a scheduled backup
How far backAny Agent checkpoint, up to 7 days7 days by default, up to 28 on Pro, Teams and Enterprise
A checkpoint rollback reaches as far as your workspace, and the development database comes back only when you switch it on. The production database is outside its reach and has a restore of its own.

To see which one you are looking at, open the Database tool, use the menu next to All Databases and choose Production. Then open My Data and look for something you created in your live app, a recent sign-up or order. If it is there, this is the database your users write to. Production opens read-only, so looking is safe.

If your Secrets hold a database connection you added yourself, such as SUPABASE_DATABASE_URL, your app may be using that database instead. Replit's Database tool shows only the databases Replit manages for you, and the restores in it are for those.

Agent cannot write to production. Its changes still reach it at one moment: when you publish, Replit applies the structural changes made in development, "adding and deleting columns or tables", to the production database. The Publish pane flags a change that could remove data and waits for your approval. Approve a column Agent deleted in development, and that column leaves the live database too, with everything stored in it.

A publish can also change what a stranger can reach, such as an API route that hands out data without a login. The free scan reads your published Replit app from outside, the way a stranger's browser would, and reports the keys in its code and the routes that answer anybody.

What a checkpoint rollback brings back

Everything in your workspace, and the development database when you select it. Here is the whole of it, from Replit's checkpoint and data recovery pages:

Part of your appRollback, Database left aloneRollback with Database selected
Your code, files and packagesRestoredRestored
Agent's conversation and memoryRestoredRestored
Development database, tables and dataStays as it is nowRestored
Production databaseUntouchedUntouched
Your published appUnchanged until you publish againUnchanged until you publish again

Replit warns that a rollback "removes all changes made after that point, including code edits". With Database selected, that includes every row written to the development database since the checkpoint, so a sample order you added this morning to test a fix goes as well.

Two limits apply. The data recovery page puts the reach at any checkpoint Agent made, up to 7 days back. And you can roll forward to a later checkpoint again only until you change something. After that, the checkpoints you skipped become what Replit calls "an alternate branch of history".

How do I roll back a Replit production database?

With point-in-time recovery, from the Database tool. Point-in-time recovery keeps a continuous record of the changes to your production database, so it can put the data back to any second inside its window. In the game, this is the server's own recording. Replit switches it on when the production database is created, with a 7-day window.

  1. Open the Database tool and select Production.
  2. Open Settings, then expand Point-in-time recovery under Advanced.
  3. Select Restore database…, enter the date and time under Timestamp, and select Restore.

The time is in your own time zone and has to fall inside the window. Replit describes the result in one sentence: "The restore replaces the live data with the data as it was at that moment." Every sign-up, order and edit made after that second is gone from the live database. Your app reconnects by itself and may pause briefly while it does.

After a restore you can go further back, and you cannot come forward again. Replit says so, and asks you to "double-check the timestamp before you confirm". If the rows written since the mistake matter, export the database first, so they survive in a file you hold.

Point-in-time recovery puts the live database back to one second inside its window. Whatever was written after that second is gone, and from there you can only go further back.

The window is a setting in the same place, under Recovery window. Every plan can choose 6 hours, 12 hours, 1, 2, 5 or 7 days, or turn it off, and Pro, Teams and Enterprise can also choose 28 days. A longer window keeps more history, and that history counts toward your storage.

Anyone who can already edit the database can restore it. On a personal app that is the owner and collaborators with edit access. In a workspace it is members with the Editor, Publisher or Owner access level.

Replit has a second kind of copy for production, and it is off until you turn it on. Scheduled backups take one full copy of the production database each day, near midnight in your browser's time zone, and keep it for 7 days on Core, or 7, 14 or 28 days on Pro, Teams and Enterprise. Each one is a complete copy, independent of the point-in-time window. They are under Settings → Advanced → Scheduled backups, and two details from Replit's page are worth knowing before you rely on them:

  • A production database nobody has used for 24 hours is archived, and no backup is taken while it is. A quiet week can leave gaps in the list.
  • Restoring one switches the live database to that day's data. Your current data is kept, but Replit says getting it back "requires help from Replit support".

Restoring the data leaves the code where it is

Each restore puts back one half of your app. Replit's warning covers both directions: "Restoring the database doesn't change your app's code, and rolling back code doesn't change production data."

To bring both back to the same moment, Replit gives an order: restore the database, roll back to the checkpoint that matches it, then publish again. The two halves have to agree. If the code you are running reads a column that the restored data predates, the app can fail at the place that reads it. In the game, that is restoring the server and loading the matching save before you let the players back in.

Where Replit keeps these copies

Inside Replit, with the database they protect. Point-in-time history and scheduled backups are settings of the production database, and Replit meters both as part of its storage. That covers the mistakes this article opened with: a prompt that went further than you meant, or an approval on the Publish pane you should have read twice.

Every one of them is reached through your Replit account and that database's settings. Removing a production database "starts a seven-day soft-delete period", in Replit's words, during which Replit Support can recover it, and after which it is "permanently deleted". Replit's own advice before removing one is to "back up important data".

How to keep your own copy of a Replit database

Export the production database and keep the file off Replit. Replit offers three ways:

  • Download tables from the Database tool. In My Data, select a table, open the menu at its top right, and choose Export all to .csv, .json or .xlsx. It saves one table at a time, straight to your computer.
  • Ask Agent. Agent can save every table as its own CSV file, reading production without changing it. Replit's suggested prompt adds the exports folder to .gitignore first.
  • Export from the Shell with pg_dump. Replit calls this "the only option that saves a full backup of every table in one file", and you can restore that file into another PostgreSQL database later.

The Shell route needs your production connection string, and the string contains your database password. Replit asks you to keep it out of chats, support tickets and screenshots, and out of Secrets, "where collaborators and Agent can read it". What Replit Secrets keep private covers the rest of that tool. If the string has been exposed, Replit lets you regenerate the production database's credentials.

The finished file needs the same care, because it holds every user's data and it lands in your project's files. Each checkpoint creates a Git commit of those files, and Replit describes its GitHub integration as keeping checkpoints in sync there. So Replit's instruction is to download the file and delete it from the project right away, "before Agent or a checkpoint saves it to your project history". The same goes for a folder of CSV files Agent wrote for you.

Keeping an eye on a Replit app after each publish

Reeve watches your published app from outside between your own checks. When the app's database is a Supabase project of your own, it keeps the copies for you too.

The free scan reads your Replit app as a stranger would.

  • It looks at your published site from outside, with nothing to install.
  • It reports the keys in your code and the routes that hand data to a visitor who never signed in.
  • No account needed. Scan your app free in 20 seconds.

Monitor keeps checking after you publish.

  • It checks your site every 60 seconds and tells you by email, Telegram or Slack when it stops answering.
  • It reads the pages you name for the words that must be there and for error messages that must not.
  • It runs the security checks again every hour, so a route a publish opened shows up the same day. See how Monitor works.

Care keeps the copies, for a Replit app on your own Supabase project.

  • It copies your Supabase database on a schedule, encrypted, on Reeve's own storage in the EU, outside your Supabase account.
  • Each copy is verified before it counts.
  • Connect a Storage credential and your uploaded files come too. See what a Care backup holds.

What to do this week

What to do

  • Open the Database tool, switch to Production, and find a record from your live app, so you know which database your users write to.
  • Open Settings → Advanced → Point-in-time recovery and note the Recovery window. That is how far back your live data can go.
  • On Core or above, turn on Scheduled backups. They stay off until you do.
  • Before you roll back after an Agent mistake, decide whether the development database should go back too, and select Database only if it should.
  • Read what the Publish pane flags before you approve a change that removes a column or a table.
  • Export the production database, keep the file off Replit, and delete it from the project once it has downloaded.

The first of those is in the Database tool, and it tells you which half of this article is about your data. For what a published Replit app shows strangers, is Replit safe has what we found in 3,042 live Replit apps, and version history is not a backup asks the same question of the other builders.

FAQ

Does a Replit checkpoint roll back my database?

Only if you select it, and only the development database. Replit says that by default a rollback does not change your database; to include the development database you select Database under Additional rollback options. The production database your published app uses is never part of a checkpoint rollback. It has its own restore in the Database tool.

Can Replit Agent delete my production database?

Replit says Agent cannot modify the production database. It can read it through a read-only copy. What Agent changes is the development database, and when you publish, the structural changes made there, such as adding or deleting columns or tables, are applied to production. The Publish pane flags a change that could remove data and waits for your approval, so read it before you approve.

How far back can I restore a Replit database?

The development database goes back to any checkpoint Agent made, up to 7 days. The production database can be restored to any second inside its point-in-time recovery window, which is 7 days by default and up to 28 days on Pro, Teams and Enterprise. Scheduled backups, if you turn them on, are kept for 7 days, or up to 28 on those plans.

Can I undo a point-in-time restore in Replit?

Only backwards. Replit says you can always restore to an earlier point afterwards, but not forward, so whatever was written after the moment you picked is gone from the live database. If those rows matter, export the database before you restore.

Does restoring my Replit database roll back my code too?

No. Replit treats them as two separate steps: restoring the database does not change your code, and rolling back code does not change production data. To bring both back to the same moment, restore the database, roll back to the checkpoint that matches it, then publish again.

Written by

Vlad Tkachenko

Founder, Reeve

I spend my time looking at apps built with Lovable, Bolt, v0, Cursor and Replit, and at the short list of mistakes that keep turning up in them.

More about the author

Read next

All articles

Back up your Supabase database before your next change

Reeve keeps an encrypted copy on a schedule and restores it for you if something breaks.

See Supabase backups

Automated external check, not a full audit. Absence of findings is not a guarantee of safety.