Plugins
What is a plugin?
A plugin in Gadget is a pre-built solution/integration to a third-party API or service. Gadget plugins consist of both connections and authentication methods. By providing plugins to third parties out-of-the-box, Gadget makes it easier for you to build rich applications that are connected to other services on the internet. For example, Gadget's Shopify connection allows you to synchronize data, react to webhooks, and write to stores on the Shopify platform.
Why does Gadget provide plugins?
Plugins allow you to significantly accelerate the development timeline of your application by taking care of all the integration edge cases that developers commonly run into.
Although standalone applications can provide utility, most software we build must integrate with external third-party systems to provide business value. GitHub integrates with your continuous integration system so that you get feedback on pull requests. Commerce software integrates with warehouse management systems to track inventory.
Gadget comes with built-in plugins for this reason, letting you retrieve and manipulate data held in third-party systems without writing code. Each connection instantly provides an authenticated API connected to your Gadget backend.
Using plugins, a Gadget developer can quickly:
- Have an authentication system set up instantly
- Listen and react to third-party webhooks
- Write data back to third-party systems
- Generate performant reports by avoiding rate limits
By providing plugins, Gadget has a built-in solution to providing a full authentication setup and integrating your app with other various third-party systems, so you can start writing your custom code sooner.
Building a reliable integration is difficult and often highly repetitive. Once you get past properly authenticating your app, there are many issues one has to address when talking to the external system. Webhooks are unreliable, so how do I ensure my system always has the most up-to-date data? Communicating over the network is unreliable, so how do I make actions reliable? How do I respond to specific state changes?
Additionally, some remote APIs can be difficult to model. For example, Shopify products have many variants as child resources. Suppose you want to model products and product variants separately in your app. In that case, you also need to deal with the fact that a product variant being deleted results in a product update payload, with a variants list containing all variants except the one that was deleted.
What are connections and what do they provide?
A connection in Gadget is a built-in integration that allows you to retrieve and manipulate data from third-party systems without writing any code. It provides a real-time data sync between your Gadget app's database and the external system, enabling seamless communication and efficient data handling.
There are three major pieces Gadget provides when installing a connection on your Gadget app:
- Models: Gadget will provide models with some connections and ensure these models are kept up to date with the remote system through webhooks and background data synchronization. For example, the Shopify connection allows you to connect models to Shopify events keeping a table of data in your backend, synchronized with a Shopify store.
- Actions: For third-party systems that provide webhooks (like Shopify), Gadget will run your actions when webhooks are received, allowing you to run any code in response.
- Client: When Gadget doesn't do exactly what you need, an authenticated client is available for your custom action code to use.
Types of connections
Gadget currently provides the following connections:
Authentication
Authentication in Gadget is provided out-of-the-box, offering both email/password and Google OAuth authentication methods for new apps, eliminating the need for additional setup.
For more information on how to work and customize the authentication methods of your app, check out our guide here.