- Learn
- AI App Builders
- Replit
- Deploying and Sharing on Replit
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):
https://your-repl-name.your-username.repl.co
Deployed:
https://your-repl-name.replit.app
Deploying Your Application
Step 1: Ensure App Works
Before deploying:
- Click Run and test thoroughly
- Check console for errors
- Verify all features work
- Test on mobile viewport
Step 2: Configure for Deployment
Ensure your app binds to the right host:
Python (Flask):
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
Node.js (Express):
const PORT = process.env.PORT || 3000
app.listen(PORT, '0.0.0.0', () => {
console.log(`Server running on port ${PORT}`)
})
Step 3: Deploy
- Click Deploy button in toolbar
- Choose deployment type:
- Reserved VM: Always-on server
- Autoscale: Scales with traffic
- Static: For static sites
- Configure settings
- 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
- Click Settings → Domains
- Enter your domain:
myapp.com - Follow DNS configuration instructions
- Wait for verification
DNS Configuration
Add records to your domain registrar:
For root domain (myapp.com):
Type: A
Name: @
Value: [Replit IP address]
For subdomain (app.myapp.com):
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:
- Add secrets in Tools → Secrets
- Redeploy to pick up changes
- Access via environment variables
Environment-Specific Config
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:
- Go to Settings
- Set visibility to Public
- Your Repl appears in search
- Others can view and fork
Sharing Links
Direct to running app:
https://your-app.replit.app
Direct to code:
https://replit.com/@username/repl-name
Invite to collaborate: Use the Invite button for editing access.
Embedding Repls
Embed in websites:
<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:
- Go to Repl settings
- Add description and cover image
- This displays when sharing
Forking and Templates
Forking a Repl
Copy someone's project:
- Find a public Repl
- Click Fork
- Get your own copy
- Modify as needed
Creating Templates
Share your setup:
- Build a starter project
- Add README with instructions
- Make it public
- Label as a template
- Others can fork it
Monitoring and Logs
Viewing Logs
Access application logs:
- Go to deployed app
- Click Logs in deployment panel
- View real-time output
Log Best Practices
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:
@app.route('/health')
def health():
return jsonify({
"status": "healthy",
"timestamp": datetime.utcnow().isoformat()
})
Managing Deployments
Updating Deployments
After code changes:
- Test in development
- Click Deploy
- Changes go live
Rolling Back
If deployment fails:
- Go to deployment history
- Select previous version
- Redeploy that version
Stopping Deployments
To take down an app:
- Go to deployment settings
- Click Stop deployment
- 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.