> ## Documentation Index
> Fetch the complete documentation index at: https://docs.superblocks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Couchbase

export const IntegrationSuccess = ({integrationName}) => {
  return <p>
      <b>{integrationName} connected!</b><br />You can now use{" "}
      <a href="/building-with-clark">Clark to build</a> with {integrationName}.
    </p>;
};

export const Alert = ({type, title, children}) => {
  const getIcon = () => {
    switch (type) {
      case 'info':
        return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm0 15c-.552 0-1-.448-1-1s.448-1 1-1 1 .448 1 1-.448 1-1 1zm1-3H9V6h2v6z' fill='%230099FF'/%3E%3C/svg%3E";
      case 'success':
        return "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm4.293 6.293L9 11.586 5.707 8.293c-.391-.391-1.024-.391-1.414 0s-.391 1.024 0 1.414l4 4c.391.391 1.024.391 1.414 0l6-6c.391-.391.391-1.024 0-1.414s-1.024-.391-1.414 0z' fill='%230CC26D'/%3E%3C/svg%3E";
      case 'warning':
        return "data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHhtbDpzcGFjZT0ncHJlc2VydmUnIHdpZHRoPScxMDgwJyBoZWlnaHQ9JzEwODAnPjxyZWN0IHdpZHRoPScxMDAlJyBoZWlnaHQ9JzEwMCUnIGZpbGw9J3RyYW5zcGFyZW50Jy8+PHBhdGggZD0nTTEzLjc5NCAxMC43NSA4LjMgMS4yNWExLjUgMS41IDAgMCAwLTIuNiAwbC01LjQ5NCA5LjVBMS40OTQgMS40OTQgMCAwIDAgMS41IDEzaDExYTEuNDkzIDEuNDkzIDAgMCAwIDEuMjk0LTIuMjVNNi41IDUuNWEuNS41IDAgMCAxIDEgMFY4YS41LjUgMCAwIDEtMSAwek03IDExYS43NS43NSAwIDEgMSAwLTEuNS43NS43NSAwIDAgMSAwIDEuNScgc3R5bGU9J3N0cm9rZTpub25lO3N0cm9rZS13aWR0aDoxO3N0cm9rZS1kYXNoYXJyYXk6bm9uZTtzdHJva2UtbGluZWNhcDpidXR0O3N0cm9rZS1kYXNob2Zmc2V0OjA7c3Ryb2tlLWxpbmVqb2luOm1pdGVyO3N0cm9rZS1taXRlcmxpbWl0OjQ7ZmlsbDojZmY5ZjM1O2ZpbGwtcnVsZTpub256ZXJvO29wYWNpdHk6MScgdHJhbnNmb3JtPSd0cmFuc2xhdGUoLjAyIDE5LjMwNSlzY2FsZSg3Ny4xNCknLz48L3N2Zz4=";
      case 'danger':
        return "data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm5.707 4.293L10 9.586 4.293 4.293c-.391-.391-1.024-.391-1.414 0s-.391 1.024 0 1.414L8.586 11l-5.707 5.293c-.391.391-.391 1.024 0 1.414s1.024.391 1.414 0L10 12.414l5.707 5.293c.391.391 1.024.391 1.414 0s.391-1.024 0-1.414L11.414 11l5.707-5.293c.391-.391.391-1.024 0-1.414s-1.024-.391-1.414 0z' fill='%23F45252'/%3E%3C/svg%3E";
      case 'note':
        return "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20' fill='none'%3E%3Cpath d='M10 0C4.477 0 0 4.477 0 10s4.477 10 10 10 10-4.477 10-10S15.523 0 10 0zm0 15c-.552 0-1-.448-1-1s.448-1 1-1 1 .448 1 1-.448 1-1 1zm1-3H9V6h2v6z' fill='%230099FF'/%3E%3C/svg%3E";
      default:
        return "";
    }
  };
  return <div className={`alert alert--${type}`}>
      <div className="alert-icon" style={{
    backgroundImage: `url("${getIcon()}")`,
    backgroundRepeat: 'no-repeat',
    backgroundPosition: 'center center',
    backgroundSize: '20px',
    width: '24px',
    height: '24px',
    position: 'absolute',
    left: '16px',
    top: '16px'
  }} />
      <div className="alert-content">
        {title && <div className="alert-title">{title}</div>}
        <div className="alert-body">{children}</div>
      </div>
    </div>;
};

Couchbase is a NoSQL database management system that is designed for high-performance, scalability, and flexibility. Integrate Couchbase with Superblocks to build applications and other custom internal tools on top of your Couchbase documents.

## Setting up Couchbase

### Create Cluster Access Credentials

To connect to Couchbase, you'll need a `username` and `password`. For self-managed clusters, refer to Couchbase's guide on how to [Connect a Self-Managed Cluster](https://docs.cloud.couchbase.com/cloud/BETA/clusters/connect-self-managed-cluster.html).

For Couchbase Cloud, use the following instructions to create Cluster Access Credentials.

1. Navigate to your Couchbase Cluster
2. Click **Settings**
3. In the navigation menu, click **Cluster Access**
4. Click **Create Cluster Access**
5. Specify a cluster access name and secret, these will serve as the `username` and `password` when connecting
6. Specify the buckets and scope the credentials should have access to
7. Once you have finished making the desired configurations, click **Create Cluster Access**

Learn more about how to [Configure Cluster Access Credentials](https://docs.couchbase.com/cloud/clusters/manage-database-users.html#create-database-credentials)

### Set up allowed IP Addresses

If you're using Superblocks Cloud, add [Superblocks' IPs](/enterprise/security/overview#ip-addresses) as allowed IPs for your cluster. Learn how to in Couchbase's guide on [Configuring Allowed IP Addresses](https://docs.couchbase.com/cloud/clusters/allow-ip-address.html).

### Add integration

1. In the web app, navigate to the **Integrations** page
2. Click the **Couchbase** tile
3. **Name** the integration
4. Fill out the connection configuration as follows:

| Field    | Required                                   | Description                                                                                                                                                                                                                                                      |
| -------- | ------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| URI      | <span className="table-checkmark">✓</span> | Comma-delimited list of IP addresses and/or hostnames to connect to. Learn more about the format of Couchbase connection strings in Couchbase's guide on [Managing Connections](https://docs.couchbase.com/nodejs-sdk/current/howtos/managing-connections.html). |
| Username | <span className="table-checkmark">✓</span> | Cluster access credential name or username.                                                                                                                                                                                                                      |
| Password | <span className="table-checkmark">✓</span> | Cluster access credential secret or cluster password.                                                                                                                                                                                                            |

5. Optionally, add more configurations to set credentials for [different environments](/development-lifecycle/build/data-tags)
6. Click **Test Connection** to check that Superblocks can connect
7. Click **Create**

<Alert type="success">
  <IntegrationSuccess integrationName="Couchbase" />
</Alert>

## Use Couchbase in APIs

Once your Couchbase integration is created, you can start using Couchbase actions in Superblocks APIs.

<Tabs>
  <Tab title="Raw query">
    Write [SQL++ queries](https://docs.couchbase.com/server/current/n1ql/n1ql-intro/queriesandresults.html) to issue queries to Couchbase.

    <div className="no-shadow">
      <img src="https://mintcdn.com/superblocks/G-ib4vcIpqKg18lL/images/integrations/integrations-library/couchbase/couchbase_query.png?fit=max&auto=format&n=G-ib4vcIpqKg18lL&q=85&s=d877693c2257d5904c57abc27b71b5db" alt="Query Couchbase with SQL++" title="Query Couchbase with SQL++" width="2336" height="1216" data-path="images/integrations/integrations-library/couchbase/couchbase_query.png" />
    </div>
  </Tab>

  <Tab title="Insert Item">
    Insert new documents into Couchbase collections with the **Insert item** action.

    <div className="no-shadow">
      <img src="https://mintcdn.com/superblocks/G-ib4vcIpqKg18lL/images/integrations/integrations-library/couchbase/couchbase_insert_item.png?fit=max&auto=format&n=G-ib4vcIpqKg18lL&q=85&s=819ce78e75f5905a1a382d4404236cf0" alt="Insert item into Couchbase" title="Insert item into Couchbase" width="2344" height="1266" data-path="images/integrations/integrations-library/couchbase/couchbase_insert_item.png" />
    </div>
  </Tab>

  <Tab title="Get Item">
    Get a single document from your Couchbase collection with the **Get item** action.

    <div className="no-shadow">
      <img src="https://mintcdn.com/superblocks/G-ib4vcIpqKg18lL/images/integrations/integrations-library/couchbase/couchbase_get_item.png?fit=max&auto=format&n=G-ib4vcIpqKg18lL&q=85&s=423ef704b1e93af602d1093b30a19981" alt="Get item from Couchbase" title="Get item from Couchbase" width="2348" height="1494" data-path="images/integrations/integrations-library/couchbase/couchbase_get_item.png" />
    </div>
  </Tab>

  <Tab title="Remove Item">
    Remove individual documents from a Couchbase collection with the **Remove item** action.

    <div className="no-shadow">
      <img src="https://mintcdn.com/superblocks/G-ib4vcIpqKg18lL/images/integrations/integrations-library/couchbase/couchbase_remove_item.png?fit=max&auto=format&n=G-ib4vcIpqKg18lL&q=85&s=9980d369ca6f79a95c8ed115400457d4" alt="Remove item from Couchbase" title="Remove item from Couchbase" width="2348" height="1136" data-path="images/integrations/integrations-library/couchbase/couchbase_remove_item.png" />
    </div>
  </Tab>
</Tabs>
