---
title: "Move a Replit app and its data to exe.dev"
description: "Move a Replit app, built by Replit Agent or by hand, to an exe.dev VM: its .replit run and build, PostgreSQL, Replit Database, secrets, and domain."
url: https://exe.dev/deploy/migrate-replit
category: "Migration"
updated: 2026-11-16
---

# Move a Replit app and its data to exe.dev

Your Replit app and its data on an always-on VM of your own.

- **Software:** Apps from Replit (https://replit.com)
- **Source:** https://github.com/replit/replit-py
- **License:** Proprietary (Replit); your app's code is yours
- **Time:** 30 minutes
- **Example VM name:** `my-replit` (yours will differ; on the VM, `hostname` prints it)
- **Machine-readable:** https://exe.dev/deploy/migrate-replit/manifest.json
- **File:** https://exe.dev/deploy/migrate-replit/app-deploy
- **File:** https://exe.dev/deploy/migrate-replit/app-import
- **File:** https://exe.dev/deploy/migrate-replit/replit-plan
- **File:** https://exe.dev/deploy/migrate-replit/replitdb

## What you get

- Node.js 24, pnpm 10, uv, and Caddy installed; PostgreSQL 18 with an empty `app` database and nightly backups, as in the PostgreSQL recipe; `replitdb.service` answering Replit Database's API on 127.0.0.1:8099.
- `~/app.git` with the app's code, and `~/bin/replit-plan`'s reading of its `.replit` in place: each published server as a unit in `app.target`, Caddy on port 8000 routing paths and serving static builds, and the build in `~/bin/app-build`.
- `~/app.env` (mode 600) pointing the app at the VM's PostgreSQL and Replit Database, and Replit AI Integrations' variables at exe.dev's LLM gateway.
- `~/bin/app-deploy` building a commit into `~/releases`, updating the schema, switching over, and keeping the previous release if a page doesn't answer; run by `app-deploy.timer` for a GitHub repository, or by a push to `~/app.git`.
- The app answering at https://my-replit.exe.xyz/, still private, and `~/bin/app-import` ready to copy the production database and Replit Database from Replit.
- A report of what in the app still needs Replit (`replit-plan`'s `Uses` lines), each with the section of this page that deals with it.

Running on the VM:

- **Caddy**: The front door on port 8000; routes paths to your servers and serves static builds, as Replit's router did, port 8000
- **Your Replit app**: Each server it publishes as a systemd service in app.target, read from .replit by replit-plan; always on, data in `~/app → the current release in ~/releases`
- **PostgreSQL 18**: In place of Replit's production database, set up as in the PostgreSQL recipe, with nightly backups, data in `/var/lib/postgresql/18/main, ~/postgres/backups`
- **Replit Database**: replitdb answers its API on 127.0.0.1:8099, so the replit and @replit/database clients work unchanged, port 8099, data in `~/replitdb.sqlite`
- **Node.js 24, pnpm 10, and uv**: In place of Replit's modules and Nix; system packages come from apt
- **Deploys**: app-deploy builds each new commit, updates the schema, and switches over; from GitHub every minute, or on git push, data in `~/app.git, ~/releases`

How it is reached:

- https://my-replit.exe.xyz/ (private): Your app, until you make it public
- https://my-replit.shelley.exe.xyz/ (private): Shelley, to change the app in place of Replit Agent

## Deploy with Shelley

Open https://exe.dev/new?prompt=REPO%3D%3Cfill-this-in%3E%0A%0ASet%20up%20Apps%20from%20Replit%20on%20this%20VM%20by%20following%20the%20exe.dev%20recipe%20at%20https%3A%2F%2Fexe.dev%2Fdeploy%2Fmigrate-replit.md%20from%20top%20to%20bottom.%0A%0AThe%20values%20at%20the%20top%20of%20this%20message%20are%20mine%3A%0A-%20REPO%3A%20the%20GitHub%20repository%20your%20Replit%20app%20syncs%20to%2C%20as%20owner%2Fname%20%28in%20Replit%3A%20Tools%20%E2%86%92%20Git%29.%20Without%20one%2C%20say%20so%20and%20upload%20the%20app%27s%20zip%20as%20%22Get%20your%20code%20out%22%20says%0AAsk%20me%20for%20any%20that%20still%20say%20%3Cfill-this-in%3E%20before%20you%20need%20them.%0A%0AThe%20recipe%27s%20example%20VM%20name%20is%20my-replit.%20This%20VM%27s%20name%20is%20the%20output%20of%20%60hostname%60%3A%20use%20it%20wherever%20the%20recipe%20writes%20my-replit.%20Skip%20the%20step%20that%20creates%20the%20VM%3B%20you%20are%20on%20it.%0A%0AYou%20are%20done%20when%20all%20of%20these%20are%20true.%20Check%20each%20one%20yourself%3A%0A-%20Node.js%2024%2C%20pnpm%2010%2C%20uv%2C%20and%20Caddy%20installed%3B%20PostgreSQL%2018%20with%20an%20empty%20%60app%60%20database%20and%20nightly%20backups%2C%20as%20in%20the%20PostgreSQL%20recipe%3B%20%60replitdb.service%60%20answering%20Replit%20Database%27s%20API%20on%20127.0.0.1%3A8099.%0A-%20%60~%2Fapp.git%60%20with%20the%20app%27s%20code%2C%20and%20%60~%2Fbin%2Freplit-plan%60%27s%20reading%20of%20its%20%60.replit%60%20in%20place%3A%20each%20published%20server%20as%20a%20unit%20in%20%60app.target%60%2C%20Caddy%20on%20port%208000%20routing%20paths%20and%20serving%20static%20builds%2C%20and%20the%20build%20in%20%60~%2Fbin%2Fapp-build%60.%0A-%20%60~%2Fapp.env%60%20%28mode%20600%29%20pointing%20the%20app%20at%20the%20VM%27s%20PostgreSQL%20and%20Replit%20Database%2C%20and%20Replit%20AI%20Integrations%27%20variables%20at%20exe.dev%27s%20LLM%20gateway.%0A-%20%60~%2Fbin%2Fapp-deploy%60%20building%20a%20commit%20into%20%60~%2Freleases%60%2C%20updating%20the%20schema%2C%20switching%20over%2C%20and%20keeping%20the%20previous%20release%20if%20a%20page%20doesn%27t%20answer%3B%20run%20by%20%60app-deploy.timer%60%20for%20a%20GitHub%20repository%2C%20or%20by%20a%20push%20to%20%60~%2Fapp.git%60.%0A-%20The%20app%20answering%20at%20https%3A%2F%2Fmy-replit.exe.xyz%2F%2C%20still%20private%2C%20and%20%60~%2Fbin%2Fapp-import%60%20ready%20to%20copy%20the%20production%20database%20and%20Replit%20Database%20from%20Replit.%0A-%20A%20report%20of%20what%20in%20the%20app%20still%20needs%20Replit%20%28%60replit-plan%60%27s%20%60Uses%60%20lines%29%2C%20each%20with%20the%20section%20of%20this%20page%20that%20deals%20with%20it.%0A%0ARead%20the%20whole%20recipe%2C%20including%20the%20closed%20details.%20Follow%20%22Set%20up%20by%0Ahand%22%20from%20%22Install%20Node.js%2C%20pnpm%2C%20and%20Caddy%22%20to%20the%20end%20of%20it%2C%20as%0Aexedev%3B%20the%20walkthrough%20above%20it%20is%20for%20the%20owner%20afterwards.%20Do%20not%0Arun%20%22Update%22%2C%20do%20not%20reboot%2C%20and%20leave%20public%20sharing%20off.%20The%20scripts%0Aand%20units%20were%20tested%20as%20written%3A%20use%20them%20unchanged%2C%20and%20leave%20no%20test%0Afiles%20behind.%0AREPO%20is%20a%20GitHub%20repository%3B%20turn%20a%20URL%20into%20owner%2Fname.%20Clone%20it%0Athrough%20the%20GitHub%20integration.%20If%20that%20fails%20with%20%22not%20found%22%20or%20a%20403%2C%0Aand%20https%3A%2F%2Fgithub.com%2FOWNER%2FNAME%20is%20public%2C%20clone%20that%20instead%3B%0Aotherwise%20give%20the%20owner%20the%20integration%20command%20from%20%22Get%20the%20code%22%2C%0Awith%20this%20VM%27s%20name%2C%20and%20wait%20for%20them.%20Install%20everything%20else%0Ameanwhile.%20If%20the%20owner%20has%20no%20repository%2C%20ask%20for%20the%20zip%20and%20the%20scp%0Acommand%20from%20%22Get%20your%20code%20out%22%2C%20and%20use%20the%20zip%20steps.%0ANever%20commit%20or%20push%20to%20a%20GitHub%20repository%20in%20this%20setup.%0AIf%20replit-plan%20prints%20a%20Nix%20line%2C%20install%20the%20apt%20packages%20that%0Aprovide%20those%20tools%20before%20the%20first%20deploy.%20If%20the%20first%20deploy%20fails%2C%0Aread%20the%20error%20above%20FAILED%20and%20fix%20what%27s%20on%20the%20VM%27s%20side%20%28a%20missing%0Aapt%20package%2C%20a%20setting%20in%20~%2Fapp.env%29%3B%20if%20the%20code%20itself%20needs%20Replit%2C%0Asay%20what%20and%20leave%20the%20rest%20set%20up.%0ADon%27t%20run%20app-import%3A%20the%20owner%20runs%20it%20with%20Replit%27s%20connection%20strings%2C%0Awhich%20should%20never%20be%20pasted%20into%20this%20conversation.%0AKeep%20keys%20and%20passwords%20out%20of%20your%20replies%3B%20say%20which%20file%20holds%20them.%0AIn%20your%20report%2C%20say%20in%20plain%20words%20what%20the%20Uses%20lines%20found%2C%20with%20the%0Asection%20of%20this%20recipe%20that%20deals%20with%20each.%20Then%20give%20the%20owner%20the%0Anext%20steps%3A%20copy%20the%20secrets%20over%20and%20bring%20the%20data%20across%2C%20as%20%22Settings%0Aand%20secrets%22%20and%20%22Bring%20your%20data%20over%22%20say%2C%20with%20this%20VM%27s%20name.%0A%0AFinish%20with%20the%20URLs%20I%20should%20open.%0A to create a VM whose agent, Shelley, follows this recipe. From a terminal:

```sh
curl -fsSL https://exe.dev/deploy/migrate-replit/prompt.txt | ssh exe.dev new --prompt=/dev/stdin
```

Or follow the steps below by hand.

This recipe moves a Replit app, built by Agent or by hand, and its data
to an exe.dev VM. A small tool, `replit-plan`, reads the app's `.replit`
the way Replit's publishing does, and Replit's services get stand-ins
that speak the same API, so most code doesn't change.

What exe.dev adds:

- **One always-on computer.** The app and its database share a real
  disk: no cold starts, no per-request billing, room for more apps.
- **Private until you say so.** [Share](/docs/sharing) it with your team;
  the app knows who's visiting from exe.dev's
  [login headers](/docs/login-with-exe).
- **AI without keys.** Replit AI Integrations become exe.dev's
  [LLM gateway](/docs/integrations-llm), billed to your exe.dev account.
- **Shelley in place of Replit Agent**, on the VM, knowing this setup.

## How the move works

1. **Deploy** sets up the VM: your app from GitHub (or a zip), on an
   empty database. Replit keeps serving.
2. **Copy secrets and data** from Replit and check the app. Repeat as
   often as you like.
3. **Replace what only works on Replit**: sign-in, connectors, App
   Storage. Shelley makes the code changes.
4. **Make the move**: a final data copy, your domain on the VM, Replit
   shut down.

## Where everything goes

| On Replit | On the VM |
|---|---|
| Autoscale or Reserved VM deployment | systemd services in `app.target`, behind Caddy on port 8000 |
| Static deployment, Agent app front end | Served by Caddy, same routes |
| Background worker | A service with no port |
| Scheduled deployment | A [systemd timer](#scheduled-jobs) |
| `.replit`, `artifact.toml` | Read by `replit-plan` into units, Caddy, and a build script |
| Modules, `replit.nix` | Node.js 24, pnpm 10, uv, apt packages |
| PostgreSQL | PostgreSQL 18, as in [PostgreSQL](/deploy/postgres) |
| Replit Database | `replitdb`: the same API, in SQLite |
| App Storage | Files on disk; see [App Storage](#app-storage) |
| Secrets | `~/app.env`, or an exe.dev [integration](/docs/integrations-catalog) |
| AI Integrations | exe.dev's [LLM gateway](/docs/integrations-llm) |
| Replit Auth, Clerk Auth | exe.dev login, or your own Clerk; see [Sign-in](#sign-in) |
| Connectors | Your own keys, or an exe.dev integration |
| Private deployment | Private by default; [share](/docs/sharing) |
| Custom domain | A CNAME to `my-replit.exe.xyz` |
| Agent, checkpoints | Shelley, git, `app-deploy <commit>` |

## Get your code out

**With GitHub**, which keeps Replit Agent usable: in your Repl, **Tools →
Git**, connect a repository, push, and turn on
[auto-sync](https://docs.replit.com/features/workspace-tools/git-interface).
Link GitHub on exe.dev's [Integrations page](https://exe.dev/integrations),
then **Deploy** with the repository's name.

**Without GitHub**: the three-dot menu atop the file tree, **Download as
zip**. Make the VM, then, on your computer, copy the zip and ask Shelley
to set it up from this page:

```bash
ssh my-replit.exe.xyz mkdir -p replit
scp ~/Downloads/my-app.zip my-replit.exe.xyz:replit/project.zip
```

Then open `https://my-replit.exe.xyz/`: private to you, on an empty
database. Shelley's report lists what still needs Replit.

## Settings and secrets

In your Repl, open **Secrets → Edit as .env** (the published app's values
are under **Publishing → Adjust settings → Production app secrets**).
Copy all but `DATABASE_URL`, `PG*`, `REPLIT_*`, and `AI_INTEGRATIONS_*`,
which the VM sets. On your computer, run this, paste, then Enter and
Ctrl-D:

```bash
ssh my-replit.exe.xyz 'cat >> app.env'
```

Then, on the VM, `sudo systemctl restart app.target` (`~/bin/app-deploy
--force` for a `VITE_` variable, which is built into the page).

## Bring your data over

From Replit, copy:

- **The production database's URL**: **Database → Production Database →
  Settings** ([Replit's guide](https://docs.replit.com/features/data-and-storage/work-with-your-data)).
- **Replit Database's URL**, if used: `echo $REPLIT_DB_URL` in the
  Repl's Shell. It expires after a while.

On your computer, run the import; it asks for each (Enter skips one), so
neither lands in a log or chat:

```bash
ssh -t my-replit.exe.xyz bin/app-import
```

It fetches both, stops the app to swap them in, prints row counts, and
starts it again. Repeat it any time until you
[make the move](#make-the-move).

> [!NOTE]
> Never published? Only Agent's development database exists. In
> Replit's Shell, `pg_dump "$DATABASE_URL" --no-owner --no-privileges -f
> dev.sql`; download it, `scp` it to the VM, and give `app-import` its
> path (`/home/exedev/dev.sql`).

### App Storage

App Storage works only on Replit. Ask Shelley to "store uploads in
~/storage instead of Replit App Storage", then copy the files over.

<details id="app-storage-export" class="dp-details">
<summary>Download App Storage's files</summary>

In Replit's Shell, with Replit's
[Python SDK](https://docs.replit.com/features/sdks/object-storage-python-sdk):

```bash
pip install replit-object-storage
python3 - <<'EOF'
import os
from replit.object_storage import Client
c = Client()  # Client(bucket_id="...") for a bucket other than the default
for o in c.list():
    dest = os.path.join("storage-export", o.name)
    os.makedirs(os.path.dirname(dest), exist_ok=True)
    c.download_to_filename(o.name, dest)
print("done")
EOF
zip -qr storage-export.zip storage-export
```

Download `storage-export.zip`, `scp` it to the VM, and there: `unzip -q
storage-export.zip && mv storage-export ~/storage`.

</details>

## Sign-in

Replit Auth (sign in with a Replit account) and Clerk Auth (a Clerk
application Replit manages) both stay behind. Pick by who uses the app:

- **A team or internal tool: exe.dev login.** Keep the VM private and
  [share](/docs/sharing) it; the app reads the visitor's email from the
  `X-ExeDev-Email` header ([Login with exe](/docs/login-with-exe)). No
  keys, no sign-in pages to maintain. On a public VM, send visitors to
  `/__exe.dev/login?redirect=/` to sign in by email.
- **A public app with accounts: your own Clerk.** Users keep their
  passwords and Google sign-in. Export them from the managed Clerk
  dashboard (Replit: **Users & Auth → Configure → Advanced → Open Clerk
  dashboard**; then **Settings → User exports**), import them into your
  own Clerk application
  ([Clerk's guide](https://clerk.com/docs/guides/development/migrating/overview)),
  and put its keys in `~/app.env` under the same names. Replit opens
  that dashboard on Pro and Enterprise only. Replit Auth has nothing to
  export: users sign up again.

Existing rows keep their old user IDs, so switching to exe.dev login
means matching users by email. Ask Shelley, for example:

```text
Replace Clerk sign-in with exe.dev login: read the user from the
X-ExeDev-Email header, and link existing users by email.
```

## AI and connectors

`~/app.env` points `AI_INTEGRATIONS_OPENAI_*` and
`AI_INTEGRATIONS_ANTHROPIC_*` at exe.dev's gateway, which needs no key.
Calls work unchanged if the model is listed (`curl -s
https://llm.int.exe.xyz/v1/models | jq -r '.data[].id'`); for Gemini,
Grok, or OpenRouter, ask Shelley to switch models.

Connectors fetch keys from Replit at run time. Ask Shelley to "read
STRIPE_SECRET_KEY from the environment instead of Replit's connector"
and add your key to `~/app.env`, or keep it off the VM with an
[HTTP proxy integration](/docs/integrations-http-proxy).

## Scheduled jobs

A Scheduled deployment becomes a systemd timer: cron `0 9 * * 1-5` in
New York is `OnCalendar=Mon..Fri *-*-* 09:00:00 America/New_York`. Ask
Shelley, or do it by hand:

<details id="job-timer" class="dp-details">
<summary>A job as a systemd timer</summary>

With your command and schedule, on the VM:

```bash
sudo tee /etc/systemd/system/app-job-report.service >/dev/null <<'EOF'
[Unit]
Description=The weekday report, once a Replit Scheduled deployment
After=postgresql.service

[Service]
Type=oneshot
User=exedev
EnvironmentFile=/home/exedev/app.env
TimeoutStartSec=30min
ExecStart=/home/exedev/bin/app-run python scripts/report.py
EOF
sudo tee /etc/systemd/system/app-job-report.timer >/dev/null <<'EOF'
[Timer]
OnCalendar=Mon..Fri *-*-* 09:00:00 America/New_York
Persistent=true

[Install]
WantedBy=timers.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now app-job-report.timer
```

`sudo systemctl start app-job-report` runs it now; `journalctl -u
app-job-report` shows the result.

</details>

## Keep building

**With Replit Agent**: push to GitHub as before. Within a minute the VM
builds the commit, updates the schema, and switches over, keeping the old
version if the new one fails (`journalctl -u app-deploy -f`).

**With Shelley**, at `https://my-replit.shelley.exe.xyz/`: it works in
`~/src`. To let it push, untick **Read-only** for `replit-repo` on the
[Integrations page](https://exe.dev/integrations); without GitHub, its
pushes to `~/app.git` deploy directly.

Roll back with `~/bin/app-deploy <commit>`. To try changes first, see
[Dev, test, and prod](/deploy/dev-test-prod).

## Make the move

Lower your DNS TTL to 300 seconds a day ahead. The app is down from
step 1 to 3.

1. **Stop Replit**: **Publishing → shut down** the deployment.
2. **Import again**: `ssh -t my-replit.exe.xyz bin/app-import`.
3. **Go public**, on your computer. For your domain, replace Replit's `A`
   and `replit-verify` `TXT` records with a CNAME to `my-replit.exe.xyz`
   ([custom domains](/docs/cnames)), then:

   ```bash
   ssh exe.dev share set-public my-replit
   ssh exe.dev domain add my-replit app.example.com
   ```

4. **Tell the app its domain**, on the VM:

   ```bash
   sed -i 's|^REPLIT_DOMAINS=.*|REPLIT_DOMAINS=app.example.com|' ~/app.env
   sudo systemctl restart app.target
   ```

Without a domain, skip the DNS steps. Once you're sure, delete the
production database in Replit to stop paying for it.

## Backups

PostgreSQL backs up nightly to `~/postgres/backups`
([restoring](/deploy/postgres#back-up-and-restore)). `~/bin/replitdb
export > replitdb.json` saves Replit Database. Keep `~/app.env` and
`~/storage` safe too. To copy backups off: `scp -r
my-replit.exe.xyz:postgres/backups .`

## Ask Shelley

At `https://my-replit.shelley.exe.xyz/`. Try: "Which secrets does the
server need that aren't in app.env?", "Why did the last deploy fail?",
or "Add a CSV export to the reports page".

## The nuts and bolts

What Shelley runs, for doing it by hand.

<details id="create-the-vm" data-manual-setup class="dp-details">
<summary>Set up by hand</summary>

### Create the VM

On your computer:

```bash
ssh exe.dev new --name=my-replit
ssh my-replit.exe.xyz
```

Everything below runs on the VM, as `exedev`.

### Install Node.js, pnpm, and Caddy

Node.js 24, pnpm 10 (what Agent apps' lockfiles expect), and Caddy as
the front door. uv, for Python, comes with the VM.

```bash
curl -fsSL https://deb.nodesource.com/setup_24.x | sudo -E bash -
sudo apt-get install -y nodejs caddy jq unzip
sudo npm install -g pnpm@10
sudo systemctl disable --now caddy
sudo usermod -aG exedev caddy
node --version; pnpm --version; uv --version; caddy version
```

Expect `v24`, `10`, `uv 0.`, and `v2` versions. Caddy stays off until
it's configured; `usermod` lets it read static files in your home.

### Install PostgreSQL

Follow the [PostgreSQL recipe's "Install by
hand"](/deploy/postgres#create-the-vm) from "Install PostgreSQL 18 and
pgvector" to "Test a backup", skipping "Add a web admin" (port 8000 is
the app's). You get an `app` database, its URL in `~/postgres/app.env`,
and nightly backups. SSL is on, so `sslmode=require` works unchanged.

### Get this page's tools

- [replit-plan](https://exe.dev/deploy/migrate-replit/replit-plan) reads
  `.replit` and `artifact.toml`, and writes the units, Caddyfile, and
  build script.
- [replitdb](https://exe.dev/deploy/migrate-replit/replitdb) serves
  Replit Database's API from SQLite, and imports a Repl's store.
- [app-deploy](https://exe.dev/deploy/migrate-replit/app-deploy) builds a
  commit as a new release and switches over if it works.
- [app-import](https://exe.dev/deploy/migrate-replit/app-import) copies
  the data from Replit.

```bash
mkdir -p ~/bin
for f in replit-plan replitdb app-deploy app-import; do
  curl -fsSL "https://exe.dev/deploy/migrate-replit/$f" -o ~/bin/$f
done
chmod +x ~/bin/replit-plan ~/bin/replitdb ~/bin/app-deploy ~/bin/app-import
head -3 ~/bin/replit-plan
```

### Replit Database

On 127.0.0.1:8099, which `REPLIT_DB_URL` will point to:

```bash
sudo tee /etc/systemd/system/replitdb.service >/dev/null <<'EOF'
[Unit]
Description=Replit Database's API on 127.0.0.1:8099, from ~/replitdb.sqlite

[Service]
User=exedev
ExecStart=/home/exedev/bin/replitdb serve 8099
Restart=always

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable --now replitdb
sleep 1; curl -s -o /dev/null -w '%{http_code}\n' 'http://127.0.0.1:8099/?prefix='
```

Expect `200`.

### Get the code

From GitHub, attach the repository read-only through exe.dev's
[GitHub integration](/docs/integrations-github), so no token lands on the
VM. On your computer:

```bash
ssh exe.dev integrations add github --name replit-repo --repository OWNER/NAME --readonly --attach vm:my-replit
```

Then, on the VM:

```bash
git clone --bare https://github.int.exe.xyz/OWNER/NAME.git ~/app.git
git clone -q https://github.int.exe.xyz/OWNER/NAME.git ~/src
git -C ~/app.git symbolic-ref --short HEAD
```

The last line prints the branch that deploys. "Not found" or a 403
means the integration isn't attached; a public repository also clones
from `https://github.com/OWNER/NAME.git`.

From a zip in `~/replit/project.zip` instead, make a repository to
push to:

```bash
mkdir -p ~/replit/project && cd ~/replit/project
unzip -q ../project.zip
[ -d .git ] || { git init -q -b main && git add -A && git commit -qm "From Replit"; }
git clone -q --bare ~/replit/project ~/app.git
git -C ~/app.git remote remove origin
git clone -q ~/app.git ~/src
cd ~ && ls -a ~/src
```

Expect to see `.replit` among the files.

### Read .replit

```bash
~/bin/replit-plan ~/src --write ~/replit-plan
```

For an Agent app, something like:

```text
Shape:      agent (artifacts), deploymentTarget autoscale
Modules:    nodejs-24, postgresql-16
Nix:        -
Install:    pnpm install --frozen-lockfile
Build:      NODE_ENV=production pnpm --filter @workspace/api-server run build
Build:      PORT=25915 BASE_PATH=/ pnpm --filter @workspace/my-app run build
Server:     app-api-server: node --enable-source-maps artifacts/api-server/dist/index.mjs  (port 8080, /api), health /api/healthz
Static:     artifacts/my-app/dist/public at / (single-page app)
Schema:     pnpm --filter @workspace/db run push  (before each release goes live, as Replit's publish does)
Uses:       Replit AI Integrations -> exe.dev's LLM integration, https://llm.int.exe.xyz
              in lib/integrations-openai-ai-server/src/client.ts
```

A classic Repl shows one `Server`, from `[deployment] run` and
`[[ports]]`. For each tool under `Nix`, install its apt package (`sudo
apt-get install -y ffmpeg`). Each `Uses` line needs Replit; the sections
above deal with each.

### Settings

`~/app.env` points the app at the VM's databases and exe.dev's LLM
gateway (any key works), and sets `REPLIT_DOMAINS` to its address:

```bash
(umask 077; { cat ~/postgres/app.env; cat <<EOF; } > ~/app.env)
REPLIT_DB_URL=http://127.0.0.1:8099
REPLIT_DOMAINS=$(hostname).exe.xyz
AI_INTEGRATIONS_OPENAI_BASE_URL=https://llm.int.exe.xyz/v1
AI_INTEGRATIONS_OPENAI_API_KEY=not-needed-on-exe-dev
AI_INTEGRATIONS_ANTHROPIC_BASE_URL=https://llm.int.exe.xyz
AI_INTEGRATIONS_ANTHROPIC_API_KEY=not-needed-on-exe-dev
SESSION_SECRET=$(openssl rand -hex 32)
EOF
stat -c '%a' ~/app.env
```

Expect `600`. The units add `NODE_ENV=production` and
`REPLIT_DEPLOYMENT=1`, as Replit does when published.

### Services and the front door

`~/bin/app-run` runs a command in the live release with the app's
settings and tools, as the units do. `app.target` groups the services:

```bash
cat > ~/bin/app-run <<'EOF'
#!/usr/bin/env bash
# app-run CMD...: run CMD the way the app's services do, in ~/app (the live
# release) with ~/app.env and the release's .venv and node_modules/.bin.
set -e
cd "$HOME/app"
if [ -z "${INVOCATION_ID:-}" ]; then set -a; . "$HOME/app.env"; set +a; fi
export PATH="$PWD/.venv/bin:$PWD/node_modules/.bin:$PATH"
exec "$@"
EOF
chmod +x ~/bin/app-run
sudo tee /etc/systemd/system/app.target >/dev/null <<'EOF'
[Unit]
Description=The app's services, from replit-plan

[Install]
WantedBy=multi-user.target
EOF
```

Put `replit-plan`'s files in place:

```bash
sudo cp ~/replit-plan/app-*.service /etc/systemd/system/
sudo cp ~/replit-plan/Caddyfile /etc/caddy/Caddyfile
install -m 755 ~/replit-plan/build.sh ~/bin/app-build
[ ! -e ~/replit-plan/release.sh ] || install -m 755 ~/replit-plan/release.sh ~/bin/app-release
cp ~/replit-plan/health ~/app.health
sudo systemctl daemon-reload
sudo systemctl enable app.target
for u in ~/replit-plan/app-*.service; do sudo systemctl enable "$(basename "$u")"; done
caddy validate --adapter caddyfile --config /etc/caddy/Caddyfile 2>&1 | tail -1
sudo systemctl enable --now caddy
```

Expect `Valid configuration`. After editing the Caddyfile, `sudo
systemctl restart caddy`; `reload` doesn't work with the admin API off.

### Deploys

`app-deploy` builds the newest commit in `~/releases`, runs
`app-build` and `app-release`, points `~/app` at it, restarts
`app.target`, and checks the paths in `~/app.health`. On failure the
previous release keeps running, and the commit waits for `--force`.

For a GitHub repository, a timer runs it every minute:

```bash
sudo tee /etc/systemd/system/app-deploy.service >/dev/null <<'EOF'
[Unit]
Description=Deploy the newest commit from GitHub

[Service]
Type=oneshot
User=exedev
ExecStart=/home/exedev/bin/app-deploy
# Log deploys, not the quiet minutes in between.
SyslogLevel=notice
LogLevelMax=notice
EOF
sudo tee /etc/systemd/system/app-deploy.timer >/dev/null <<'EOF'
[Unit]
Description=Deploy the newest commit from GitHub, every minute

[Timer]
OnCalendar=minutely

[Install]
WantedBy=timers.target
EOF
sudo systemctl daemon-reload
```

Without GitHub, a push to `~/app.git` deploys:

```bash
cat > ~/app.git/hooks/post-receive <<'EOF'
#!/usr/bin/env bash
# A push to the deploy branch deploys it.
branch=$(git symbolic-ref --short HEAD)
while read -r _ _ ref; do
  if [ "$ref" = "refs/heads/$branch" ]; then exec env -u GIT_DIR "$HOME/bin/app-deploy"; fi
done
EOF
chmod +x ~/app.git/hooks/post-receive
```

### Deploy and check

```bash
~/bin/app-deploy
```

It ends with `==> Deployed` and the commit. Then:

```bash
git -C ~/app.git remote get-url origin >/dev/null 2>&1 && sudo systemctl enable --now app-deploy.timer
systemctl is-active app.target caddy replitdb postgresql
for p in $(cat ~/app.health); do curl -s -o /dev/null -w "$p %{http_code}\n" "http://localhost:8000$p"; done
```

Expect `active` four times and `200` for each path. Next:
[Settings and secrets](#settings-and-secrets) and
[Bring your data over](#bring-your-data-over).

</details>

<details id="update" class="dp-details">
<summary>Update Node.js, pnpm, Caddy, and PostgreSQL</summary>

The app's packages update with its lockfile. For the tools:

```bash
sudo apt-get update && sudo apt-get install -y nodejs caddy
sudo npm install -g pnpm@10
uv self update
~/bin/app-deploy --force
```

For a new Node.js major, rerun NodeSource's setup (`setup_26.x`)
first; for PostgreSQL, see [Update PostgreSQL](/deploy/postgres#update).
If `.replit` changes how the app runs, rerun `replit-plan` and redo
"Services and the front door".

</details>

<details id="troubleshooting" class="dp-details">
<summary>Something not working?</summary>

The logs, on the VM:

```bash
journalctl -u app-deploy -n 100 --no-pager
journalctl -u 'app-*' -n 100 --no-pager
journalctl -u caddy -n 50 --no-pager
```

- **A change doesn't show up.** Check it's on GitHub's deploy branch,
  then look for `FAILED` in `journalctl -u app-deploy`;
  `~/bin/app-deploy --force` retries.
- **"command not found" in the build.** Replit's Nix provided it;
  install it with apt, then `~/bin/app-deploy --force`.
- **`app-release failed`.** The schema push asked a question, such as
  whether to drop a column with data. Ask Shelley, or answer it in
  `~/src` (`git pull && pnpm install`, then `(set -a; . ~/app.env; bash
  ~/bin/app-release)`), and deploy with `--force`.
- **502.** The server isn't running; `journalctl -u 'app-*'` says why,
  often a missing secret.
- **AI errors.** Check the `AI_INTEGRATIONS_` lines in `~/app.env` and
  that the model is listed.
- **`REPLIT_CONNECTORS_HOSTNAME`, `REPL_IDENTITY`, or
  `REPLIT_SIDECAR_ENDPOINT` errors.** See
  [AI and connectors](#ai-and-connectors) and [App Storage](#app-storage).
- **`app-import` fails dumping.** Recopy the URL; Replit's database
  may need a moment to wake. Nothing on the VM changed.
- **Disk filling up.** `pnpm store prune` and `uv cache prune` free
  the caches.

</details>

## Frequently asked questions

### What moves, and what stays with Replit?

Code (via GitHub or a zip), the production database, Replit Database, and App Storage files move. Secrets you copy. Sign-in, AI Integrations, and Connectors stay behind; this page replaces each.

### Will it cost less than Replit's deployments?

It's easier to predict. Replit bills each deployment and database by usage ([Replit's pricing](https://docs.replit.com/billing/deployment-pricing)); your [exe.dev plan](https://exe.dev/pricing) runs the app, its database, and more apps on one always-on VM.

### Can I keep building with Replit Agent?

Yes: each change Agent pushes to GitHub deploys on the VM within a minute. Or use Shelley; see [Keep building](#keep-building).

### Which Replit apps does this work for?

Today's Agent apps (a pnpm workspace with an `artifacts` folder) and classic Node.js or Python Repls with a run command. Other languages need their toolchain installed; Shelley can do it. Expo mobile apps are out of scope.

### Should sign-in move to exe.dev login?

For a team or internal tool, yes: no keys, and sharing decides who gets in. For a public app with accounts, keep Clerk in an account of your own, so users keep their passwords. See [Sign-in](#sign-in).

### How big a VM does this need?

The default. An Agent app's release takes about 800 MB of disk, and three are kept, plus the database and its backups.


## Related

- [Move a Lovable app and its data to exe.dev](https://exe.dev/deploy/migrate-lovable.md): Your Lovable app, its database, and its users, on a server of your own.
- [Migrate a Heroku app to exe.dev](https://exe.dev/deploy/migrate-heroku.md): Your Procfile, config vars, and Postgres on a VM of your own.
- [Self-host PostgreSQL](https://exe.dev/deploy/postgres.md): Your own Postgres on a real disk, with backups you've actually restored.
- [Deploy a Node.js app](https://exe.dev/deploy/nodejs.md): Your Express app on a server of its own. git push to deploy.
- [Dev, Test, Prod: Choose One, Two, or Three](https://exe.dev/deploy/dev-test-prod.md): You can build, test, and deploy on exe.dev.
- [Give agents API access without giving them the keys](https://exe.dev/deploy/agent-secrets.md): Your agents call your APIs. The keys stay with exe.dev, outside the VM.
