<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Daniel Spataro</title>
    <description>The latest articles on DEV Community by Daniel Spataro (@spataroinc).</description>
    <link>https://dev.to/spataroinc</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F585607%2F10bbfbb2-5c9d-442f-8b70-ecf2af393d37.jpg</url>
      <title>DEV Community: Daniel Spataro</title>
      <link>https://dev.to/spataroinc</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/spataroinc"/>
    <language>en</language>
    <item>
      <title>An Integration Guide for Next.js Apps</title>
      <dc:creator>Daniel Spataro</dc:creator>
      <pubDate>Wed, 13 Mar 2024 21:32:47 +0000</pubDate>
      <link>https://dev.to/spataroinc/how-to-add-50-integrations-to-your-react-app-for-free-56h7</link>
      <guid>https://dev.to/spataroinc/how-to-add-50-integrations-to-your-react-app-for-free-56h7</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;Building a single 3rd-party integration into your app is easy. Building, maintaining and scaling a dozen is not. This post will show you how you can build dozens of realtime, native integrations into your React app using &lt;a href="https://www.integrationos.com/"&gt;IntegrationOS&lt;/a&gt; - a comprehensive integration management platform. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyk6m2zf6pqhnlo4mdt6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fiyk6m2zf6pqhnlo4mdt6.png" alt="Logos of many CRM apps" width="800" height="390"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With IntegrationOS you can ship CRM, Accounting &amp;amp; ERP, eCommerce, generative AI and ticketing integrations. Our &lt;a href="https://www.integrationos.com/integrations"&gt;catalog&lt;/a&gt; is growing quickly and we’re looking to get feedback on which other apps/categories to support.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Disclaimer: I am one of the co-founders of IntegrationOS.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Last week, we soft launched two new products: &lt;a href="https://docs.integrationos.com/docs/authkit"&gt;AuthKit&lt;/a&gt; and &lt;a href="https://docs.integrationos.com/reference/overview"&gt;Unified API&lt;/a&gt;. Also excited to share IntegrationOS supports individual developers and small teams to host an unlimited amount of integrations with up to 20 connected accounts for free (&lt;a href="https://www.integrationos.com/blog/introducing-authkit"&gt;read more here&lt;/a&gt;).&lt;/p&gt;

&lt;p&gt;The IntegrationOS core is built in Rust, which means reads and writes are super fast. Our average latency is 360ms at time of writing. Rust also makes it super cost efficient to run at scale. &lt;/p&gt;

&lt;p&gt;In exchange we ask for product feedback - join our new community &lt;a href="https://discord.gg/c5rcPSukgP"&gt;Discord&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can also read more about &lt;a href="https://www.integrationos.com/blog/announcing-our-new-brand"&gt;IntegrationOS vs. Merge&lt;/a&gt;. &lt;/p&gt;

&lt;h2&gt;
  
  
  Watch a short demo (5 min)
&lt;/h2&gt;

&lt;p&gt;Here’s a walkthrough showing how to use IntegrationOS with Next.js App Router. &lt;/p&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/arfK4sjNfPc"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  Before getting started
&lt;/h2&gt;

&lt;p&gt;To get the most out of this guide, you'll need:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An &lt;a href="https://www.integrationos.com/"&gt;IntegrationOS account&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Your IntegrationOS &lt;a href="https://app.integrationos.com/api-keys"&gt;API Key&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Step 1: Backend - Create secure tokens
&lt;/h2&gt;

&lt;p&gt;First, we'll add an endpoint to our backend that'll let us generate secure tokens for our frontend component.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install the SDK&lt;/strong&gt;&lt;br&gt;
To make this easy, IntegrationOS offers native SDKs in several popular programming languages. This guide will use the popular AuthKit SDK for Node.js.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @integrationos/authkit-node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Set Secrets&lt;/strong&gt;&lt;br&gt;
To make calls to IntegrationOS, provide your API key. Store these values as managed secrets and pass them to the SDKs either as environment variables or directly in your app's configuration depending on your preferences.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;INTEGRATIONOS_SANDBOX_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'sk_test_example_123456789'&lt;/span&gt;
&lt;span class="nv"&gt;INTEGRATIONOS_PRODUCTION_API_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;'sk_live_example_123456789'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Create a token endpoint&lt;/strong&gt;&lt;br&gt;
Next, we'll need to add the token endpoint which will exchange the authorization token (valid for 10 minutes) for an authenticated Connected Account.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;AuthKitToken&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@integrationos/authkit-node&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;POST&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;NextRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;authKitToken&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;AuthKitToken&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;INTEGRATIONOS_SANDBOX_API_KEY&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Specifying how the token will be constructed  &lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;token&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;authKitToken&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;group&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;org_123&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// a meaningful identifier (i.e., organizationId)&lt;/span&gt;
    &lt;span class="na"&gt;label&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Acme&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="c1"&gt;// a human-friendly label (i.e., organizationName)&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;token&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Step 2: Frontend - Make AuthKit appear
&lt;/h2&gt;

&lt;p&gt;Next, we'll add the AuthKit component to your frontend application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Install the SDK&lt;/strong&gt;&lt;br&gt;
In the same fashion, IntegrationOS offers native frontend SDKs in several popular frameworks. This guide will use the popular AuthKit SDK for React.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @integrationos/authkit-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Use the AuthKit Component&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useAuthKit&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@integrationos/authkit-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;open&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useAuthKit&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;token&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;url&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://api.your-company-name.com/authkit-token&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;onSuccess&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;connections&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="na"&gt;onError&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
  &lt;span class="na"&gt;onClose&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{},&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It returns an object with the open function. Calling the open function will launch the AuthKit modal, display the Consent Pane view and start the authentication flow for the user. Calling the close function will close the AuthKit modal.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Launch the AuthKit flow&lt;/strong&gt;&lt;br&gt;
With your client and server setup complete, you can now test the authentication flow by calling open().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;open&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Add new integration&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This will open the AuthKit modal so your user can:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select an integration to connect&lt;/li&gt;
&lt;li&gt;Be guided through the authentication flow&lt;/li&gt;
&lt;li&gt;Authorize data access&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once the flow is completed, AuthKit will return a Connection object to your onSuccess callback. Each connection object contains metadata about the connected account and can be used to make API requests.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Helpful Resources&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://replit.com/@daniel370/Nextjs-App-Router-Demo?v=1"&gt;Full code for Demo App&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.integrationos.com/docs/quickstart"&gt;Developer Docs&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In 2024, integrating 3rd-party tools to satisfy a growing user base should not be a hassle.&lt;/p&gt;

&lt;p&gt;IntegrationOS is looking to remove the pain surrounding integrations so developers can get back to what’s important, instead of wasting time wrestling UI libraries, parsing through endless API docs and repeatedly building things like authentication.&lt;/p&gt;

&lt;p&gt;Give it a try now and leave me your feedback in the comments 👇&lt;/p&gt;

&lt;p&gt;Happy coding 🔥&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>react</category>
      <category>programming</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
