Packages are another way to integrate with 3rd party services, in addition to using the Fetch API discussed in the previous lesson. You can also use packages for any number of other reasons. If there's a package out there that's already implemented some functionality that you need, there's no point in reinventing the wheel.
There are two types of package that you can use in your code:
As you probably already know, npm is the most popular registry of reusable JavaScript code. Velo allows you to install approved npm packages and use them in your site. If a package you would like to use has not yet been approved, you can request that it be added to the list of approved packages.
Some types of packages are not supported. These include private packages, packages that need to run on specific hardware, and packages that may expose a security risk.
Here are a few things to consider when using an approved package in your code:
It is your responsibility to understand the package's functionality, in what situations it can be used, and in what situations it should not be used.
You find and install packages in the Code Files tab of the Velo Sidebar. Once installed, you can import the package and use it in your code.
For example, you might want to install Lodash to make use of its handy utility functions. First, you need to install the package. Just choose your package, and click Install. Then you can import it and use its functionality.
Velo packages are bundles of code built by the Velo team that you can add to your site. The packages allow you to quickly implement complex functionality while writing a minimal amount of code.
Because these packages are specifically built to work within the Velo ecosystem, they work seamlessly with the elements, apps, and APIs you use in your sites.
See a package's readme file to learn how to use the package. Each package is different, but typically you need to perform some setup or configuration before using the package. You also might need to install some dependencies, such as apps that the package works with.
You find and install Velo packages in the Code Files tab of the Velo Sidebar.
With everything set up, you're ready to start using the package.
For example, you can easily monitor and manage data stored in a Google spreadsheet from your site using the @velo/google-sheets-integration package.
Since the google-sheets-integration package uses the Google Sheets API, you need to do a bit of setup on the Google Cloud Platform before using it. You also need to store some sensitive data in the Secrets Manager.
Once you have that set up, you can use the package to: