Before you start
You need:- Access to both the old project and the new workspace or account.
- About an hour of focused time for the final switch. The earlier steps can happen over several days.
- If your app has a custom web address, access to wherever you manage that domain.
Plan for downtime
Think of it as opening a second shop and then closing the first. There is a short time when the old shop is closed and the new one is not open yet. During that time, nobody can use your app. How long is the app offline? Usually 15 to 60 minutes. It depends on how much data your database holds and how quickly your web address updates. Will I lose data? Only if someone adds data to the old app after you copy the database. To prevent this, you take the old app offline before you make the final copy. This guide is ordered so that happens. Can I undo it? Yes. The old project is not deleted. If something goes wrong, publish the old app again and it works exactly as before. When should I do it? Pick a time when few people use your app. Tell your users in advance if you can.Step 1: Copy the code to a new project
Choose one method. The old app stays live during this step. Both methods carry your code. GitHub always carries your commit history, while a zip carries history only when it includes the.git folder:
Via GitHub
Push the old project to GitHub
Grant the new account access
Import in the new workspace
Verify the copy
Via zip file
Download the old project
- In the old project, open the Shell tool.
-
Paste this command and press Enter. It creates a file called
project.zipand leaves out folders that Replit can rebuild on its own: -
Check the size. Paste this command and press Enter. It prints the size in MB, such as
150Mfor 150 MB: -
If the size is over 200 MB, make the file smaller by leaving out your edit history. Paste both lines and press Enter:
Only exclude
.localand.gitwhen you need to reduce the zip below 200 MB. These exclusions do not delete either folder from the old project. However, a zip without.gitdoes not include the project’s commit history. Use the GitHub method if you need to preserve history. -
Find
project.zipin the file tree, select the three-dot menu next to it, and select Download.
.cache folder holds internal Replit state, including cached secret values. Always exclude it from zip files you create manually. If your project has other large generated folders, add them to the exclusion list.Import in the new workspace
Verify the copy
.git folder, your commit history came with it. If you used the smaller archive command, the new project starts without commit history. Replit reinstalls excluded dependencies during import.Step 2: Set up the new app
The old app is still live. In this step you get the new app fully working with a test copy of your data, so the final switch later is quick.Add your Secrets
Reconnect Connectors and other services
Publish the new app
replit.app web address and its own empty production database. Do not connect your custom domain yet.replit.app address and use it the way your users would. Fix anything that is broken before you move on. Your users have not been affected yet.Step 3: Switch your users to the new app
This is the part with downtime. Do it in one sitting.Take the old app offline
Copy the database one final time
Point your web address at the new app
replit.app address, share the new address with your users instead.Confirm the new app is live
Copy the database
The code copy doesn’t touch your database. Copy the data with PostgreSQL’spg_dump and pg_restore tools, available in the Shell of both projects. Both Step 2 and Step 3 point here. The commands are the same each time. Only the target changes.
Export the data from the old project
backup.dump in your file tree:- Open the Database tool, select the production database, and open Settings.
- Copy the connection string.
- In the command above, replace
"$DATABASE_URL"with the connection string, keeping the quotes.
Move the dump file to the new project
backup.dump and download it. Then upload it into the new project with the file tree’s Upload files option.If you copied the code through GitHub, don’t commit the dump. Move it separately so your data never lands in the repository.Import the data in the new project
"$DATABASE_URL".This drops any matching objects in the target database, then loads the data. When it finishes with no output, it worked.pg_restore fails with role or policy errors, your database uses custom PostgreSQL roles that don’t exist in the new project yet. Contact support for help.Re-create what doesn’t copy over
The rest of the project’s configuration lives outside the file system. Re-create each piece in the new project:If something goes wrong
The old project is still there. To go back:- In the old project, open the Publishing tool and select Publish.
- If you moved a custom domain, move it back the same way.
Clean up
Wait a week or so to be sure the new app is working. Then:- Remove
backup.dumpfrom both projects and from your device. Each copy contains a full export of your data. - Optionally, delete the old project.
Related resources
- Transfer App to Teams: The built-in transfer for moving a project into or between team workspaces
- Import from a provider: All supported import sources
- Fix a published app using a shared database: More
pg_dumpandpg_restoretroubleshooting