Beginner15 min

Learn how to deploy applications, share your projects, and manage production deployments on Replit.

Deploying and Sharing on Replit

Replit makes deployment straightforward—your code runs in the cloud already. This lesson covers how to deploy apps, configure them for production, and share your work.

Understanding Replit Hosting

Development vs Production

When you click Run in a Repl:

  • App runs temporarily
  • Stops when you close the browser
  • Uses development resources

When you Deploy:

  • App runs continuously
  • Stays up even when you leave
  • Gets a permanent URL
  • Uses production resources

Repl URLs

Every Repl gets a URL:

Development (Editor open):

Terminal
https://your-repl-name.your-username.repl.co

Deployed:

Terminal
https://your-repl-name.replit.app

Deploying Your Application

Step 1: Ensure App Works

Before deploying:

  1. Click Run and test thoroughly
  2. Check console for errors
  3. Verify all features work
  4. Test on mobile viewport

Step 2: Configure for Deployment

Ensure your app binds to the right host:

Python (Flask):

Terminal
if __name__ == '__main__':
    app.run(host='0.0.0.0', port=5000)

Node.js (Express):

Terminal
const PORT = process.env.PORT || 3000
app.listen(PORT, '0.0.0.0', () => {
    console.log(`Server running on port ${PORT}`)
})

Step 3: Deploy

  1. Click Deploy button in toolbar
  2. Choose deployment type:
    • Reserved VM: Always-on server
    • Autoscale: Scales with traffic
    • Static: For static sites
  3. Configure settings
  4. Click Deploy

Step 4: Verify Deployment

After deployment:

  • Visit your production URL
  • Test all functionality
  • Check logs for errors
  • Monitor performance

Deployment Types

Reserved VM Deployment

Best for:

  • Applications needing constant uptime
  • Background jobs and crons
  • WebSocket connections
  • Database servers

Features:

  • Always running
  • Consistent performance
  • Fixed resources

Autoscale Deployment

Best for:

  • APIs and web services
  • Variable traffic loads
  • Cost optimization

Features:

  • Scales up with demand
  • Scales down when idle
  • Pay for what you use

Static Deployment

Best for:

  • HTML/CSS/JS sites
  • JAMstack applications
  • Documentation sites

Features:

  • Fast global CDN
  • Lowest cost
  • No server required

Custom Domains

Adding a Custom Domain

  1. Click SettingsDomains
  2. Enter your domain: myapp.com
  3. Follow DNS configuration instructions
  4. Wait for verification

DNS Configuration

Add records to your domain registrar:

For root domain (myapp.com):

Terminal
Type: A
Name: @
Value: [Replit IP address]

For subdomain (app.myapp.com):

Terminal
Type: CNAME
Name: app
Value: your-repl-name.replit.app

SSL Certificates

Replit automatically:

  • Provisions SSL certificates
  • Renews before expiration
  • Configures HTTPS

Your app is secure by default.

Environment Configuration

Production Secrets

Secrets set in the editor apply to deployments:

  1. Add secrets in ToolsSecrets
  2. Redeploy to pick up changes
  3. Access via environment variables

Environment-Specific Config

Terminal
import os

# Detect environment
IS_PRODUCTION = os.environ.get('REPLIT_DEPLOYMENT') == '1'

# Configure accordingly
if IS_PRODUCTION:
    DEBUG = False
    DATABASE_URL = os.environ['DATABASE_URL']
else:
    DEBUG = True
    DATABASE_URL = 'sqlite:///dev.db'

Sharing Your Work

Public Repls

Make your Repl discoverable:

  1. Go to Settings
  2. Set visibility to Public
  3. Your Repl appears in search
  4. Others can view and fork

Sharing Links

Direct to running app:

Terminal
https://your-app.replit.app

Direct to code:

Terminal
https://replit.com/@username/repl-name

Invite to collaborate: Use the Invite button for editing access.

Embedding Repls

Embed in websites:

Terminal
<iframe
  src="https://replit.com/@username/repl-name?embed=true"
  width="100%"
  height="500"
></iframe>

Options:

  • ?embed=true - Embed mode
  • ?outputonly=1 - Show only output
  • ?lite=true - Minimal interface

Cover Pages

Create a landing page:

  1. Go to Repl settings
  2. Add description and cover image
  3. This displays when sharing

Forking and Templates

Forking a Repl

Copy someone's project:

  1. Find a public Repl
  2. Click Fork
  3. Get your own copy
  4. Modify as needed

Creating Templates

Share your setup:

  1. Build a starter project
  2. Add README with instructions
  3. Make it public
  4. Label as a template
  5. Others can fork it

Monitoring and Logs

Viewing Logs

Access application logs:

  1. Go to deployed app
  2. Click Logs in deployment panel
  3. View real-time output

Log Best Practices

Terminal
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

@app.route('/api/data')
def get_data():
    logger.info("Fetching data...")
    try:
        data = fetch_data()
        logger.info(f"Retrieved {len(data)} items")
        return jsonify(data)
    except Exception as e:
        logger.error(f"Error fetching data: {e}")
        return jsonify({"error": "Failed"}), 500

Health Checks

Add a health endpoint:

Terminal
@app.route('/health')
def health():
    return jsonify({
        "status": "healthy",
        "timestamp": datetime.utcnow().isoformat()
    })

Managing Deployments

Updating Deployments

After code changes:

  1. Test in development
  2. Click Deploy
  3. Changes go live

Rolling Back

If deployment fails:

  1. Go to deployment history
  2. Select previous version
  3. Redeploy that version

Stopping Deployments

To take down an app:

  1. Go to deployment settings
  2. Click Stop deployment
  3. App goes offline

Cost Management

Understanding Pricing

Free tier includes:

  • Limited compute
  • Public projects
  • Basic features

Paid plans:

  • More resources
  • Always-on deployments
  • Private projects
  • Priority support

Optimizing Costs

  • Use Autoscale for variable traffic
  • Stop unused deployments
  • Monitor resource usage
  • Use static hosting when possible

Best Practices

Before Deploying

  • Test thoroughly in development
  • Check all secrets are configured
  • Verify database connections
  • Test error handling
  • Review security

After Deploying

  • Verify app loads correctly
  • Test critical functionality
  • Set up monitoring
  • Check logs for errors
  • Test from different devices

Ongoing Maintenance

  • Monitor logs regularly
  • Update dependencies
  • Rotate secrets periodically
  • Review performance metrics
  • Keep backups of important data

Summary

  • Deploy with one click for production hosting
  • Choose deployment type based on your needs
  • Custom domains with automatic SSL
  • Share via links, embeds, or forks
  • Monitor with built-in logs
  • Manage deployments through the dashboard

What's Next

You've completed the Replit module! You now know how to:

  • Create and manage Repls
  • Use AI Agent and Ghostwriter
  • Leverage databases and secrets
  • Deploy and share applications

Continue to the AI Editors section to learn Cursor, or explore the Foundations for deeper AI development concepts.

Mark this lesson as complete to track your progress