[AUDIO LOGO]
IMAN RAHMATI: Hi, I'm Iman Rahmati,
and today I'm here to talk to you about building a Firebase
extension for your service.
So let's say you've built this cool service that
can generate beautiful invoices in PDF for developers.
Your business generates revenue by getting the developers
to subscribe and use your API.
Your company has made it super easy to use.
Developers just go to the company website,
sign up for an account, generate an API key,
and copy that into their clipboard.
Then they take one of the code samples
you have for PHP, Java, or Node.js
and paste the API key in there.
Then they deploy that to production and bam,
they're running.
Their code calls to your service,
and each time you generate a response,
you make a few cents, after a generous fee tier.
But adoption has been much slower than expected.
Developers are not finding your great invoice API
because you're not on a platform they already use.
You don't stand out from the competition.
Where can you find these developers to let
them know about your product?
You can buy search keywords, of course,
but how do you reach the right developers?
And the few developers that do use your service
are asking all these difficult questions.
How do they get the response directly
from within their Android code?
How do they call it from within their backend?
Will you have to learn Android to support them, and iOS,
and Flutter, web?
You can just tell them it's their problem,
and then they'll go write the integration code their own way,
and the burden of supporting and troubleshooting that code
will be on your support team.
Or they'll switch to another invoice API that does support
these platforms directly.
Maybe you provide code samples for every language
and technology, and they copy that code in their app
and happily use it.
But later when you update your APIs or publish improvements,
it's difficult to find the developers
and tell them to update.
You just wanted to print cool, stylish invoices,
but now you're dealing with all these integration problems.
What if there was a way you could ease this integration
process for your developers, so they
don't run into all these problems
while working with your APIs?
What if you wrote the standard integration code for them,
documented it, and they would just
install it with a few clicks?
Ooh, lucky yes.
With Firebase Extensions, we can do exactly that.
With Extensions, you can get your code
running from the closest point to your developers' data,
their database, or where their logic is in a cloud function.
And you can put it in front of millions of developers
to install your extension right away.
Let's see how.
Don't worry, if you've ever written a Node.js script
to call your service, you've done most of the hard work
already.
Let's say, to simplify your developers' lives,
you want to allow them to only write the information needed,
like the invoice line items and their prices,
to a document in a database, and your extension
will take care of everything else
and generate the invoice for them.
That sounds pretty nice.
The first step is to create Node.js code that responds
to writes on cloud Firestore.
The code will trigger on the Insert
and receive the new data.
In a cloud functions code, we then
call out to our backend service to generate the invoice,
just passing the values from the caller to the backend service.
The backend service results could be cached or saved
to cloud storage, an option you can provide to your users.
OK, I said that was the hard part.
Now we create a wrapper for these cloud functions
that allows a user to install it.
Here we define the configuration values our code depends on,
like the Firestore collection it needs to respond to
or the API key of your backend service.
You can test this extension easily
with Firebase Emulator on your local machine.
When you feel it's ready for real use,
you can sign up to list it on extensions.dev.
To sign up, navigate to extensions.dev,
sign up as a publisher, enter your information,
reserve a unique ID, you're ready to go.
Now, you can use the Firebase CLI to upload your extension
to the registry.
After your extension has been successfully uploaded,
you'll get a link to install and test your extension.
OK, you've built the extension.
I'm going to try it out now.
Here, I click the Install link, choose a project to install.
Since this extension hasn't been published yet,
I do see an additional warning.
Then I want to look at the billing information
to see what this extension will cost me.
Lucky me, there's no charge for installing an extension
beyond using the underlying cloud resources and any costs
that are incurred by APIs used by the extension,
such as the invoice API.
I'm reviewing the APIs the extension will access,
the roles and permissions it'll use,
and then the configuration dialog appears.
Here, I will fill in all the parameters
you defined in your extension.
For example, the Firestore collection it'll listen on
and the API key I obtained from your service
and some other optional configuration
if I need to change the defaults.
And with the click of a button, the extension
will be installed into my project.
Hmm, not bad, but let me test the extension.
Am I really relieved from reading your docs
and writing integration code myself?
I configured the invoice extension
to monitor documents in this collection.
I'll create a document with the line items for the invoice.
For each line item, we have a name and a price.
I'll add a few here.
Now, when I save this new document to Firestore,
it triggers the extension, calls the API,
which in turn generates a PDF with the invoice,
and writes back the URL of that PDF into the same document
automatically.
This is how cool extensions are.
Without me needing to integrate with your API,
I have your features available to me in my database
and any app platform that runs Firebase.
OK, when you feel confident about your extension,
you can submit it for review by our team.
After it's reviewed and approved,
the extension will show up on extensions.dev.
After you're listed, you can view basic stats
on your extension, like the number
of installs for each version.
This will help you understand the adoption of your extension.
If you release a new feature or fix a bug,
you can publish a new version of your extension.
When users come to their extensions page,
they'll see an update is available and can
upgrade to the latest version.
OK.
What are some other advantages of building extensions
for your service?
Did you know, by building an extension for technologies
like Firestore, you get all the cool benefits the SDK provides?
For example, when your users don't
have an internet connection, they
can continue using Firestore SDK and your extension
in offline mode until the connection is restored,
or if you move logic into the extension
and one client generates more load
than your servers can handle, that extra load can
be shared with Firebase developers cloud project,
helping your servers remain stable.
Firestore isn't the only technology
you can build integrations for.
We have many types of triggers, including Storage
when files get created or deleted, Auth when users get
added or removed, Realtime Database when data gets
added, removed, or updated, and many other technologies,
including recently launched cloud events,
also known as Eventarc.
So over the past few years, many companies
built extensions for their APIs to integrate with Firebase.
For example, Algolia, Elastic, Typesense, and Meilisearch
are companies that provide indexing and searching content
through their APIs.
They built their extensions to integrate directly
with Firestore and provide full text search for content
in Firestore.
Stripe, RevenueCat, and Purchasely
provide subscription and payment integrations.
They built extensions that take care
of all the heavy lifting for integration
with their endpoints and provide a way
to simply use their services through the database.
They use a database as an API gateway
for their backend services.
We already have dozens of extensions
available on extensions.dev by top services.
But today, in addition to opening up building extensions
to everyone, we're announcing a whole round of new extensions
that were developed over the past few months
for Firebase developers.
These are the new companies who worked on providing developers
seamless integration with their technologies,
and their extensions are all launched as of today.
Google products are building quality integrations
for Firebase developers.
Google Maps, Firestore, and BigQuery teams
have launched multiple new extensions
to help Firebase and cloud developers use their services.
Many individual developers signed up to our alpha program
to build useful extensions.
And we're happy to announce a number of these extensions are
available today, including extensions to help developers
generate PDFs from Firestore, generate Open Graph preview
images for links in Firestore, sync document
fields in Firestore, ensure a field is unique
or an extension to use Google Sheets as a backend for custom
form submissions, and many more extensions you
can find on extensions.dev.
And to help Firebase developers build AI and ML features
into their applications, Google is
launching multiple extensions with hope
that many would follow soon.
These extensions use PaLM API, Vertex AI,
and other Google Cloud's AI technologies,
including their recent announcements
to leverage those benefits in an easy to use way.
You can also build ML extensions yourself.
Oh, by the way, did I tell you that we've
launched Python support for extensions
in our alpha program?
So you can reach millions of developers
by having your product join our existing extensions library.
Go to extensions.dev to sign up and register as a publisher.
While you wait for approval, take the CodeLab
and read our documentation to understand
how to build extensions.
Build your extension, upload and submit
it to be reviewed and listed on extensions.dev.
Thanks for watching, and enjoy the rest of I/O.
[AUDIO LOGO]