You are currently viewing the new Anvil Editor Docs.
Switch to the Classic Editor Docs
You are currently viewing the Classic Editor Docs.
Switch to the new Anvil Editor Docs main page

Apps in production and development

You don’t need to do this in the new Editor

If you’re using the new Anvil Editor, you can manage development, testing and production environments with powerful tools, database separation, version control integration, and more.

Read more about deployments in the Anvil manual.

    <p>Learn more about the <a href="/docs/editor/new-editor-beta">new editor</a>.</p>

It is common for people to want to run the same app in both development and production, connected to different Data Tables in each case. To do this, we create two Anvil apps, git clone one of them locally, then push the same source code to both. Each app will have its own Data Tables and URLs.

We walk through the setup and general workflow below.

Git setup

  • Clone your app in the Anvil Editor
  • Rename the app with the full history ‘App Dev’ and the new one ‘App Prod’
  • Git Clone ‘App Dev’ to your local machine. If you click the Clone with Git button in the Version History dialog, you will see the git clone command has been generated for you:
# Clone App Dev into the my-app folder (using the APP_ID for 'App Dev')
$ git clone ssh:// my-app/
$ cd my-app/
  • Open ‘App Prod’, and find the git clone command
  • Add a production remote using this ‘App Prod’ git clone command
# Using the APP_ID for 'App Prod'
$ git remote add production ssh://
  • Push to production to synchronise ‘App Dev’ and ‘App Prod’
# Push to production from master, to make sure your apps are both in sync
# The first time you push to Production, you'll need to force push
$ git push --force production master

Your apps are now synchronised with one another, and you have a separate remote set up for your Production version.

General Workflow

  • Work on ‘App Dev’ either in the browser or locally
  • Make a note of any changes you make to your Data Table schema
  • When ‘App Dev’ works, pull it to your local repository
# Pull App Dev locally
$ git pull 
  • Now you’re ready to push to Production
The Git repos don’t contain data from your Data Tables or your schema, so you’ll need to reflect any changes to your schema in App Prod before you push
  • Reflect any changes made to your Data Tables schema in ‘App Prod’
  • Push to Prod:
# Push from master to production
$ git push production master
If the production app has been run, you may need to force push to sync the table IDs in the anvil.yaml file.
  • Refresh ‘App Prod’ in your Browser, and you’ll see it’s been updated for the changes you made to App Dev.

Additional information

App secrets

If you’re using the App Secrets service in your app, encrypted secrets won’t be shared between your Development and Production apps by default. This is because the encryption uses an app-specific key (as well as a global key), which will naturally differ between your Dev and Prod apps.

To ensure encrypted App Secrets persist between your Dev and Prod Apps, email with the App IDs for your Dev and Prod Apps, and we’ll set the internal encryption key to be the same on both apps.

App ID

The <APP_ID> is a unique ID for your app that never changes (you can access it from code using

You will find your App ID in the URL while editing your app:<APP_ID>

You can also access App IDs from your app’s Clone link. Clone links have the form:<APP_ID>=<secret_token>

Data Tables & Schema

  • The Git repos don’t contain data from your Data Tables or your schema
  • If you use different Data Tables for Dev and Prod, give your tables the same name so the same code will work on both apps.

Do you still have questions?

Our Community Forum is full of helpful information and Anvil experts.