Sitemap

Copy Your Development Data to Production on Replit

2 min readNov 17, 2025

If you are like me and ran into the issue of needing to replicate your database rows from your development instance to production with Replit’s built-in Neon Database here’s a quick script to do just that.

Before you start, make sure you have Postgres installed locally on your device.

If you’re on Mac you can install it with homebrew (I think the minimum version you need here is 16).

brew install postgresql@16
brew link --force postgresql@16

All other systems, please look up your install instructions. Sorry, mate I got nothing.

Check and make sure it’s installed.

pg_dump --version
psql --version

Then create a file locally on your device called `migrate-to-prod.sh` and copy the following. Note: A dump file is basically a backup snapshot of your database and here we are using it to copy over the schemas and data.

#!/bin/bash

set -e

# --- CONFIG ---
DEV_DB_URL="postgresql://<dev-user>:<dev-pass>@<dev-host>/<dev-db>?sslmode=require"
PROD_DB_URL="postgresql://<prod-user>:<prod-pass>@<prod-host>/<prod-db>?sslmode=require"

# Optional: name of the dump file
DUMP_FILE="dev_dump_$(date +%Y%m%d_%H%M%S).sql"

echo "📦 Dumping dev database..."
pg_dump --no-owner --no-acl --format=plain "$DEV_DB_URL" > "$DUMP_FILE"

echo "🚀 Restoring into production..."
psql "$PROD_DB_URL" < "$DUMP_FILE"

echo "✨ Migration complete!"
echo "Dump file saved as: $DUMP_FILE"

You will need to replace DEV_DB_URL and PROD_DB_URL in the file with your URLs from Replit. You can find both of these under your database settings for both production and development as DATABASE_URL

Press enter or click to view image in full size

After pasting, save your file, and make your file executable by running the following:

chmod +x migrate-to-prod.sh

Then execute the script by running the following command:

./migrate-to-prod.sh

At this point, check back on Replit to make sure you see all the data you were expecting on your app.

If you run into any issues while following these steps, highly recommend debugging with Replit Agent or ChatGPT / or hit up my DMs on Twitter, @saminacodes. ✌🏻