Deploying a full-stack web application on Replit requires shifting out of the ephemeral development workspace and into Replit's managed cloud deployment environment. At 365Finds, we appreciate tools that cut through boilerplate infrastructure work: Replit allows you to take code written in your browser or generated with Replit Agent and launch it straight onto Google Cloud Platform containers in a few clicks. You do not touch Dockerfiles, configure AWS IAM roles, or build manual CI/CD pipelines.
That speed is intoxicating. But full-stack deployments also introduce real architectural constraints—specifically around cold starts, ephemeral local storage, and database billing. If you treat a live production deployment like a development Repl, your app will break or silently run up bills. Here is how to configure, deploy, and operate a full-stack application properly using Replit's built-in deployment tools.
1. Preparing Your Codebase for Production
Before touching the deploy button, your codebase must meet three requirements that development mode hides.
Bind to 0.0.0.0 and Read Dynamic Ports
In Replit's interactive dev environment, hardcoding localhost:3000 or 127.0.0.1:5000 often works because the preview proxy routes traffic internally. In a production container, Replit's ingress proxy cannot reach your application if it binds strictly to the loopback interface.
Your backend web server must bind to 0.0.0.0 and read the PORT environment variable supplied by Replit:
// Express.js example
const express = require('express');
const app = express();
const PORT = process.env.PORT || 5000;
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server listening on 0.0.0.0:${PORT}`);
});
# FastAPI / Uvicorn example
import os
import uvicorn
port = int(os.environ.get("PORT", 5000))
if __name__ == "__main__":
uvicorn.run("main:app", host="0.0.0.0", port=port)
Abandon SQLite and Local File Storage
Deployment containers on Replit are stateless and ephemeral. If you write user uploads to a local folder or store state in a local SQLite file (app.db), all data disappears whenever the deployment container restarts, updates, or scales to zero.
For persistent data, use Replit's built-in managed PostgreSQL or an external managed database (such as Neon, Supabase, or AWS RDS). For uploaded user files, store assets in external object storage (AWS S3, Cloudflare R2, or Replit Object Storage).
2. Defining Build and Run Commands in .replit
Replit separates your build step from your execution step. You can configure this directly in the Deployment UI, but at 365Finds we strongly favor committing these rules explicitly into your .replit configuration file. It avoids silent configuration drift across deployments.
Open .replit in the root of your project and configure the [deployment] block:
[deployment]
build = "npm run build"
run = "npm start"
ignorePorts = false
build: Runs once during the deployment preparation phase inside a temporary container. Use this to compile frontend bundles (Vite, Next.js, or Webpack), install production assets, and execute database schema migrations (e.g.,npx prisma migrate deployornpm run db:push).run: The persistent execution command that starts your web server once the build succeeds (e.g.,node dist/server.jsorgunicorn app:app).ignorePorts: Leave this set tofalsefor web applications. Replit monitors open network ports to verify that your app is healthy before directing public traffic to it.
3. Selecting the Right Deployment Type
When you click Publish in the top-right toolbar (or navigate to Tools > Publishing), Replit asks you to pick a deployment architecture. For full-stack applications, only two options matter:
| Deployment Type | Best Suited For | Pricing Model | Key Trade-off |
|---|---|---|---|
| Autoscale (Recommended) | Web applications, REST/GraphQL APIs, customer dashboards | Base fee (~$1-$2/mo) + compute units and inbound requests | Scales to zero when idle; incurs a cold start of 2–5 seconds on first visitor |
| Reserved VM | Background queue workers, WebSockets, Discord/Telegram bots | Fixed monthly fee (starts at ~$15/mo depending on RAM/vCPU) | Zero cold starts, always running; higher base baseline cost |
| Static | Pure HTML/CSS/JS client-side single page apps | Free hosting + minimal bandwidth transfer | Incompatible with full-stack apps; provides no backend container |
| Scheduled | Cron jobs, database nightly backups, ETL tasks | Minimal base + execution time | Runs on a timer and shuts down; not a web server |
At 365Finds, our rule of thumb is straightforward: start with Autoscale for any full-stack web application with human-driven web traffic. It conserves compute credits while your project is quiet. Only switch to Reserved VM if your application relies on continuous real-time WebSockets, background event loops, or if your users cannot tolerate a 3-second cold start.
4. Configuring Secrets and Production PostgreSQL
Production deployments do not inherit unencrypted environment variables from your code. Instead, Replit uses an integrated Secrets manager encrypted with AES-256.
- Open the Secrets tool from the left sidebar.
- Enter your sensitive configuration values (such as
SESSION_SECRET,STRIPE_API_KEY, or external API tokens). - Connect your database:
- If using Replit's built-in managed PostgreSQL, click Database in the sidebar to create one. Replit automatically exposes the
DATABASE_URLsecret to your deployment environment. - Separate development from production: Replit provisions separate database credentials for production deployments so test data from your interactive coding workspace never corrupts live production records.
- If using Replit's built-in managed PostgreSQL, click Database in the sidebar to create one. Replit automatically exposes the
- Ensure your build script runs migrations automatically against this
DATABASE_URL. For Prisma users:"build": "vite build && npx prisma migrate deploy"
5. Deploying and Inspecting Logs
With build commands and secrets configured, launch the build:
- Click Publish in the upper-right corner of the editor.
- Under deployment settings, choose your compute tier (the default 1 vCPU and 2 GB RAM is sufficient for most standard full-stack stacks).
- Choose your access level:
- Public: Open to anyone on the web.
- Password Protected: Simple gate requiring visitors to enter a shared passcode (useful for staging and private client previews).
- Workspace Only: Restricted to authenticated members of your Replit organization.
- Click Publish App.
During deployment, Replit spins up a build container, runs your build command, tests port accessibility, and launches your container on a Google Cloud Platform cluster.
If the deployment stalls or errors out, click the build menu to view Build Logs and Runtime Logs. The most common failure modes are:
- Build timeouts during massive package installations.
- Missing environment secrets referenced at build time.
- The server binding to
127.0.0.1rather than0.0.0.0, causing the health check to time out.
Once healthy, Replit assigns your app a dedicated, SSL-secured domain in the format https://<your-app-slug>.replit.app.
6. Mapping a Custom Domain
For a branded web application, attach your own domain name:
- Open your project's Publishing settings and navigate to the Domains tab.
- Enter your custom domain (e.g.,
app.yourdomain.comor your root apex domainyourdomain.com). - Replit generates two DNS records:
- An A Record (pointing to Replit's ingress IP).
- A TXT Record (used for automated ownership verification and SSL certificate generation).
- Log into your domain registrar (e.g., Cloudflare, Namecheap, GoDaddy, or Porkbun) and create the corresponding records.
- Cloudflare Note: If managing DNS through Cloudflare, change the proxy status from Proxied (Orange Cloud) to DNS Only (Grey Cloud) during initial verification. If Cloudflare intercepts the traffic, Replit cannot verify the TXT record or provision the Let's Encrypt / Google Cloud SSL certificate. You can re-enable Cloudflare proxying later if desired.
- Click Verify in Replit. Once DNS propagation finishes (typically 2 to 30 minutes), Replit automatically installs an SSL certificate and directs HTTPS traffic to your deployment.
The 365Finds Take: Strengths and Latent Costs
We recommend Replit Deployments for founders, solo developers, and product teams building MVPs, proof-of-concepts, and internal tools. The ability to prototype in the editor, ask Replit Agent to fix a bug, and push immediately to an autoscale production cluster without touching a CI pipeline or Docker daemon saves hours of setup time.
However, keep three operational realities in mind:
First, Autoscale cold starts are noticeable. When an autoscale app sits idle, its container shuts down. The first subsequent request can take 2 to 5 seconds while GCP spins up the container and initializes your runtime. For public marketing sites, this latency hurts conversion; for internal business dashboards or authenticated SaaS tools, it is usually acceptable.
Second, database compute costs can surprise you. Replit's managed PostgreSQL bills active compute time in 5-minute increments after the last query. If an external cron service or monitoring bot pings your app once every 4 minutes, your database never enters sleep mode—running up 24/7 compute charges that will quickly drain your included Core credits.
For small applications, prototypes, and agile SaaS experiments, Replit's built-in deployment tools deliver exceptional velocity. When traffic scales to thousands of concurrent users or requires multi-region redundancy, we suggest migrating the containerized workload to a dedicated infrastructure provider like Render, Fly.io, or AWS.