Apps, stubs, and other concepts

Every object in Modal is attached to an app. This includes things like functions, secrets, and images.

There are two ways an app can run:


This is when you run something with the .run method. This creates a temporary app that only exists for the duration of your script. Ephemeral apps are garbage collected automatically when the app exits, or when the server detects that the client is no longer connected.


When you deploy an app, the app is persisted, and runs indefinitely. You can re-deploy an app that already exists, in which case objects such as functions will be updated to their new definitions.

When you create secrets in the web UI, these secrets are attached to “dummy” apps which are deployed.

Apps vs stubs

An app is something that’s running in the cloud. A stub is a description of how to construct that app. The stub defines all the functions, images, and other objects. When you run or deploy a stub, it’s turned into an app.