How to move a Replit project to your own server
To move a Replit project to your own server, download the code as a zip or push it to GitHub, collect your Secrets and database separately, connect the code to the Coolify panel on your server, and switch your domain once you've seen it working. The code is the easy part. Replit's own guide says the database and the web address take the most time.
The old project keeps running throughout. Don't shut anything down until you've tested everything on the new server.
What comes with the code, and what doesn't?
| Part | Status | What to do |
|---|---|---|
| Source code | Comes along | Zip or GitHub |
.replit, replit.nix | Come along, but only Replit reads them | Use them to learn the run command and system packages |
| Secrets | Stay behind | Enter the values on the server by hand |
| Database | Stays behind | Export with pg_dump and load it on the server |
| App Storage files | Stay behind | Download them and change the storage code |
| Replit Auth | Tied to Replit accounts | Switch to another sign-in method |
| Connectors | Stay behind | Set each service's API key as a variable |
How do you get the code?
Through GitHub: In the Project Editor, open Git from Tools. Select Initialize Git Repository if needed, connect a repository, then commit and push. Keep it private. We recommend this route because it carries later changes too.
As a zip: From the three-dot menu at the top of the file tree, choose Download as zip. If that fails, build the zip yourself in the Shell, leaving out the .cache folder where Replit keeps cached secret values: zip -r project.zip . -x ".cache/*" "node_modules/*"
Step by step
- Order a server from the Next.js VPS page. This option comes with Coolify, so Python and plain Node projects deploy from the same panel.
- Find the start command in
.replitand the port in your code. Replit's own publishing also requires listening on0.0.0.0, so that part is usually done. The Flask values we have tried are port5000andpython -m flask run --host=0.0.0.0 --port=5000. - A Python project needs its dependencies in
requirements.txtorpyproject.toml. For system packages listed inreplit.nix, use theRAILPACK_DEPLOY_APT_PACKAGESbuild variable, though Nix and APT names don't always match. - Clone the repository and open the folder in a coding tool such as Claude Code or Cursor. Copy the Paste into your AI tool row from the Overview tab of your Seturack panel and paste it in. The tool handles the deployment, or you can do it by hand.
- Enter the values from Replit's Secrets tool as environment variables on the server, including deployment secrets, which Replit keeps separately.
- Copy the database once for testing (see below) and test the app end to end on its HTTPS address.
- Take the old app offline, copy the database one last time, and point your domain's A record at the server's IP address. The certificate is issued automatically.
You have root access, and you can manage everything from the panel if you prefer.
How do you move the database?
Replit's database is PostgreSQL-compatible, and the tools are ready in its Shell:
- Export it in the Replit Shell:
pg_dump -Fc "$DATABASE_URL" --no-owner --no-privileges -f backup.dump - That command exports the development database, and live data usually sits in production. In the Database tool, select the production database, copy the connection string from Settings and use it in place of
"$DATABASE_URL". - Download
backup.dump. Keep it out of the repository, because it holds all your data. - Create PostgreSQL in Coolify and upload the file with Import backup on the database's Backups page.
- Set the database's internal address as
DATABASE_URLin the app and deploy again.
Anything written after pg_dump runs isn't in the copy, which is why the final copy comes after you stop the old app.
Files and sign-in
App Storage buckets don't move, so download the files from Replit's storage tool. If your code uses Replit's SDK, that part has to change. The simplest replacement is writing files to a folder on the server and mounting it with Persistent Storage in Coolify.
Replit Auth has your users sign in with Replit accounts. To stop depending on Replit, you may need another sign-in method. Your coding tool can rewrite that section, but back up your user table and test on the temporary address first.
Frequently asked questions
What size does a Replit project need?
The sales page recommends at least 4 GB of RAM, 2 vCores and 40 GB of disk, based on Next.js builds: a project with 85 packages failed at 2 GB and built at 4 GB. Allow extra if the database shares the server, and scale up from your panel if you need to.
What will it cost per month?
The recommended minimum size is about $6 a month (VAT included), and outside Turkey you pay in US dollars. Daily backups are included in the price and traffic is unlimited. Your Replit usage and subscription continue until you close them.
How do I move my domain away from Replit?
Remove the domain under Publishing, Domains in Replit, point the A record at the server's IP address, then add it with https on the Domains page in Coolify and deploy again.
Can I keep developing in Replit?
Yes. Turn on auto-sync in the Git pane so changes reach GitHub. With a webhook, the server rebuilds on every push. Without one, press Redeploy in Coolify. Remember that the Replit preview and the live server use different databases.
Can I leave the database on Replit?
You can try by giving the server its connection string, but your app and data then live apart and your Replit bill continues. If you're really moving the app, it's cleaner to bring the database onto the same server.
Comments0
No Comments Yet
Be the first to share your thoughts.
Please sign in or sign up to leave a comment.