The short answer

If a Replit app works in Preview but not when published, read the publishing logs, check the production secrets, make the server listen on 0.0.0.0 rather than localhost and keep it running, and make sure the homepage answers the health check quickly. Then connect your domain with the exact DNS records Replit shows.

Why it happens

What’s actually going on

Publishing saves a snapshot of your app and runs it on Replit’s cloud, separately from the Project Editor. Replit’s troubleshooting guide lists the usual differences: production secrets, run and build commands, a program that exits instead of staying up, a server listening on localhost instead of 0.0.0.0, port settings, and a homepage too slow for the health check.

On a custom domain, the other common cause is DNS: records that don’t exactly match what Replit shows, or changes that haven’t spread yet.

Already done for you

What Replit already handles

Publishing tool

Domain, access, production database, monitoring and security scan in one pane.

Logs

The Logs tab in Publishing shows stack traces, missing packages and startup errors.

Monitoring

Replit can check that the app is online and email you if it goes down.

Custom domains

Add your domain, copy the two DNS records, and HTTPS is set up automatically.

Fix it yourself

Step by step

In this order. Most apps get most of the way with these alone.

  1. Confirm Preview works

    If Preview is broken, publishing won’t fix it.

  2. Read the publishing logs

    Look for missing packages, missing environment variables and startup errors.

  3. Check production secrets

    Replit’s docs disagree on whether editor secrets carry over, so check the published app’s secrets and use production values.

  4. Listen on 0.0.0.0 and the right port

    Servers listening on localhost or 127.0.0.1 don’t work when published. If ports are set in .replit, set externalPort to 80.

  5. Keep the process running and the homepage fast

    Published apps expect a long-running server, and Replit sends a health check request before it marks the app live.

  6. Then connect the domain

    Add it in Publishing settings, copy the records exactly at your registrar, wait for Verified, and test sign-in and checkout on the new address.

Where it still goes wrong

  • Deployment geography is locked once you publish. Changing region later means remixing the app.
  • On Autoscale, cost grows with traffic. Check the cost at maximum traffic in the machine configuration.
  • Third-party settings such as sign-in redirect URLs or Stripe details may still point at the replit.app address.

When to bring in a developer

If the steps above turn up more than you have time for, or the app already has paying users, I take Replit apps to production: login and access rules, database and backups, payments, security, SEO and deployment.

App rescue: From $1,000, fixed price, scoped in writing before any work starts.

More in app rescue, or hire a Replit developer.

Questions

Common questions

Why does my Replit app work in Preview but not after publishing?

Most often: missing production secrets, a server listening on localhost instead of 0.0.0.0, wrong run or build commands, or a slow homepage failing the health check. The Logs tab usually shows which.

How long does a custom domain take on Replit?

DNS changes can take from a few minutes to a few hours. Replit shows Verified once it sees the records.

Which deployment type should I choose?

Replit recommends Autoscale for most apps, because it scales from zero with demand.

Want your Replit app production-ready?

Send me the app and what’s worrying you. You get a written scope with a fixed price before any work starts.

Book a 30-minute call