Skip to main content

Deploying HTTP servers

For deploying HTTP servers, you can use any framework so long as it can be imported or the port can be opened. However, we also provide templates for Ruby on Rails, Django, Node (Express), and Sinatra.

To deploy an HTTP server on Replit:

  1. Write the code that imports the required libraries or frameworks.
  2. Begin listening on a port, and your server will start up.
  3. A new pane should appear in your editor with the URL to your web app, along with a preview of the app.

Note that in some cases you need to explicitly set the host to For example, when running a Flask web application, you should use"") instead of simply If your app is also running a dev server, you may need to set the host for that server to This is so that we can detect that you are running a web server and automatically pop up the extra pane to display your app.

Once deployed, the server will continue to run in the background, even after you close the browser tab. The server will stay awake and active until an hour after its last request, after which it will enter a sleeping stage. A sleeping repl will wake as soon as it receives another request; there is no need to re-run the repl. However, if you make changes to your server, you will need to restart the repl to see those changes reflected in the live version.

Below is an example of a simple HTTP server running Flask in Python3, displaying HTML from templates/index.html. Feel free to fork and play with the code as you'd like.

Our package manager will automatically handle dependency files in your repls. See our documentation on packages for more information on installing and managing dependencies.

Private keys to external services or APIs can be kept as environment variables in the secrets manager. See our documentation on secrets.

If you are using Django and need access to specific bash commands to configure the server, please see this Django template.

Persistence and Takedown Requests

Note that a repl's public link will persist even after the repl has been deleted. You can clear a repl of its server code before deleting it in order to prevent it from loading. If you need your web app taken down, please get in touch with us at