About Deployments
Deployments are a way to release a snapshot of your Repl, ensuring that changes made within the editor don't disrupt the production build. Customize run and build commands, and connect the Deployment to a <app-name>.replit.app
or a custom domain.
Replit offers Deployments for all use cases:
- Autoscale Deployments: scale down to save costs, and scale up to multiple instances to handle high traffic
- Static Deployments: fast static sites, free for subscribed users
- Reserved VMs: a single VM for cost certainty and special use cases
- Scheduled Deployments: a service that allows you to schedule your applications to run at predetermined time intervals seamlessly
Want to learn more about deployments? Struggling to choose the right type?
Here's a comprehensive overview:
What is a Deployment?
A Deployment saves your Repl's current state as a "snapshot" and runs it on a shared or dedicated machine. This allows you to share your Repl with others or host a website or Discord bot with minimal downtime. Unlike publishing to the community, which doesn't host your Repl under a domain and has a wakeup phase when accessed via the cover page, the other Deployment options offer different specs and capabilities for your Repl in production.
Why deploy?
Deployments are useful for a variety of reasons. For example, you can use them to:
- Host a website or Discord bot with minimal downtime
- Separate your development environment from your production environment
- Share a snapshot of your Repl with others
How to deploy?
Deployments are initiated from the Repl editor. Select the Deploy button or open the Deployments tool to get started.
Deployment environment variables
When deploying your applications on Replit, you can customize your Deployment behavior by using environment variables. These variables provide information about the Deployment environment, helping you adapt your application's behavior accordingly.
REPLIT_DEPLOYMENT: This environment variable is set to 1
when your application is deployed on Replit. You can use this variable to determine whether your code is running in a deployed environment.
For example, in a Node.js application, you can check if your application is deployed using:
if (process.env.REPLIT_DEPLOYMENT) {
// Your code specific to the Deployment environment
}
Which Deployment should I choose?
Replit offers three types of Deployments to serve different use cases. Matt made a flow chart to help you choose the right one (click to open in new tab):
Still curious? Read on to learn more about each Deployment option.
Autoscale Deployments
Autoscale Deployments is our most commonly recommended option. It offers both flexible machine sizing and horizontal scaling.
Autoscale can scale to as many instances as required. You're charged in proportion to traffic, and you can scale up horizontally to handle high load when needed.
It is our recommended choice for websites, web applications, APIs, or microservices.
Autoscale is the right choice if:
- Your application is a server using HTTP, HTTP/2, WebSockets, or gRPCs to handle requests.
- You want to try multiple ideas without spending on applications that don't receive traffic.
- You want to be able to scale up quickly to handle large amounts of requests.
- You need our highest reliability (99.95% uptime).
Your app may not be suitable for Autoscale if:
- Your application runs background activities outside of request handling.
- Your application can't run multiple instances in parallel.
- Your application can't handle multiple requests in parallel.
- Restarts are disruptive to your application.
Reserved VM Deployments
Reserved VM Deployments run exactly one copy of your application on a single VM. It offers flexible machine sizing with cost certainty.
It is our best choice for long-running or compute-intensive applications and jobs. If your application is not suitable for Autoscale, consider Reserved VMs instead.
Reserved VM is the right choice if:
- You want cost certainty.
- Your application is not a server.
- Your application does not tolerate being restarted easily.
- You require a long-running connection (e.g., bots).
- You run background activities outside of request handling.
- You require the host VM to always run (99.9% uptime).
Static Deployments
Static Deployments serve static content such as HTML, JavaScript, and CSS files. There is no server involved.
This is a cost-effective way to share simple websites such as portfolios, personal sites, or company landing pages. For more information, refer to the billing section of the Static Deployments document.
Scheduled Deployments
Scheduled Deployments helps you schedule your app to run at specific times effortlessly. You can easily specify execution times using natural language, eliminating the need for complex setup procedures. As a Replit Core member, you receive $25/month in credits to offset expenses, enhancing your accessibility. The specifications include a 1vCPU/2 GiB RAM configuration, an 11-hour timeout duration, and no concurrency limits.
Persistent storage
Please note that Autoscale, Static, and Reserved VM Deployments do not have persistent storage. Any data saved to the filesystem will not persist after redeploying.
We currently offer three persistent storage options for your applications: Object storage, PostgreSQL, and ReplDB (KV).