5 Features of Anvil You May Have Missed
Tags: python, webdev
Published: 2022-02-20 19:50:44

Not only does [Anvil](https://anvil.works/) let you build web apps with nothing but Python, it also comes jam-packed with features like [easy user management](https://anvil.works/beta-docs/users), [built-in databases](https://anvil.works/beta-docs/data-tables) and [two-click deployment](https://anvil.works/beta-docs/deployment-new-ide). Today, I'm going to show you some of the lesser-known features of Anvil - lesser-known but very useful!

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pfbuk5l1g1e6cxke6j6y.png">
<figcaption>Anvil's Editor</figcaption>
</figure>

> Disclaimer: Anvil has a free plan which includes all the features you need to build and deploy a web app. However, some of the features in this article are advanced features only available on paid plans.

---

## [1 - Creating Progressive Web Apps](https://anvil.works/docs/server/offline-apps)

Anvil apps are progressive web apps (PWAs) and can be installed almost like native apps.

Installation varies by platform but usually it's as simple as finding the option to 'Add to home screen' in your devices browser. For example, on iOS you can browse to your web app in Safari, select the share icon and then 'Add to home screen'.

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/5mookcr107eti1fbh680.png">
<figcaption>Example of How To Download An Anvil App</figcaption>
</figure>

You can also run your Anvil apps offline. Once downloaded, the app will continue to function even with no internet connection. If the app needs to store data when it's offline, [you can cache the data in the browser](https://anvil.works/docs/server/offline-apps#working-with-data-offline) until an internet connection can be established.

---

## [2 - Deployment Environments](https://anvil.works/beta-docs/deployment-new-ide/environments)

Deploying Anvil web apps on the internet only takes [two clicks](https://anvil.works/beta-docs/deployment-new-ide/quickstart#publish-your-app) and it's one of Anvil's best-loved features. One feature you may have missed is the ability to create [multiple deployment environments](https://anvil.works/beta-docs/deployment-new-ide/environments). This means you can easily deploy multiple versions of your app for things like production, testing and development.

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/eirk203yu7tbzythj56j.png">
<figcaption>Production, Testing and Development Environments Example</figcaption>
</figure>

You can create as many deployment environments as you need and customise each one's [URL](https://anvil.works/beta-docs/deployment-new-ide/quickstart#choose-your-own-url), [app version](https://anvil.works/beta-docs/version-control), [database](https://anvil.works/beta-docs/data-tables/multiple-databases), [Uplink key](https://anvil.works/beta-docs/uplink/quickstart/) and [Scheduled Tasks](https://anvil.works/beta-docs/background-tasks/scheduled-tasks). You can develop in a separate environment safe in the knowledge that your production app won't change until you're completely ready.

---

## [3 - App Logs](https://anvil.works/docs/editor/app-logs)

Having logs for you web app is an important but often overlooked part of web development. Anvil makes it easy by providing built-in app logs. App logs can be searched through, filtered by device and Exception tracebacks let you jump to the exact line of code where the error occurred.


<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/94o638359d7jvbhzy70f.png">
<figcaption>
App Logs View</figcaption>
</figure>

---

## [4 - Version Control](https://anvil.works/docs/version-control)

Anvil's version control is based on [Git](https://git-scm.org/), the industry standard version control system, and it allows you to:

- Track changes to your app
- Revert to previous versions of your app
- Collaborate with other developers
- Publish specific versions of your app while editing another

Click the Version History tab at the bottom of the Anvil Editor to see the history of your app:

<figure>
  <img src="https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l6i8nimwgfkft8job7xw.png">
<figcaption>
Toggle Version Control Tab</figcaption>
</figure>

---

## [5 - Using JavaScript](https://anvil.works/docs/client/javascript)

> **Wait - you don't need to use JavaScript with Anvil?**

That's right but Anvil knows that there are lots of useful JavaScript libraries out there that you may want to use, so Anvil doesn't limit you to only Python.

You can import JavaScript into your Anvil app's [Native Libraries](https://anvil.works/docs/client/javascript#using-native-javascript-libraries) using a [CDN](https://developer.mozilla.org/en-US/docs/Glossary/CDN):

```
<script crossorigin src="https://unpkg.com/@daily-co/daily-js"></script>
```

Then in your app's form, import the JavaScript class you want to use straight into Python:

```
from anvil.js.window import DailyIframe
```

Now, you use the JavaScript library with nothing but Python:

```
self.call_frame = DailyIframe.createFrame()
```

Check out this tutorial to see an example of using a JavaScript library with Anvil:
[Using Daily's JavaScript video chat API with Anvil](https://anvil.works/articles/daily-co-video-chat)

---

That's it! Hopefully this article showed you some new features of Anvil. **I'd love to hear what your favourite features of Anvil are.**

 
---

### New to Anvil?

If you're new to Anvil, welcome! [Anvil](https://anvil.works/) is a platform for building full-stack web apps with nothing but Python. No need to wrestle with JS, HTML, CSS, Python, SQL and all their frameworks - just **build it all in Python.**

Yes - Python that [runs in the browser](https://anvil.works/docs/client/python). Python that [runs on the server](https://anvil.works/docs/server). Python that [builds your UI](https://anvil.works/docs/client). A [drag-and-drop UI editor](https://anvil.works/docs/client/ui). Anvil even has a built-in [Python database](https://anvil.works/docs/data-tables), in case you don't have your own.

Why not have a play with the app builder? **It's free!** Click here to get started:
https://anvil.works/build