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

# Quickstart

> Get started with BRX in minutes

# BRX Quickstart Guide

This guide will help you get started with BRX quickly. You'll learn how to set up your environment, create your first BRK, and execute it.

## Prerequisites

Before you begin, make sure you have:

* A BRX account (sign up at [app.brx.ai](https://app.brx.ai) if you don't have one)
* Node.js 14+ installed (for using the Node.js SDK)
* Basic understanding of JavaScript/TypeScript (for the examples in this guide)

## Installation

### Install the BRX Node.js SDK

```bash theme={null}
# Using npm
npm install brx-node --save

# Using yarn
yarn add brx-node

# Using pnpm
pnpm add brx-node
```

### Get Your API Key

1. Log in to the [BRX Dashboard](https://app.brx.ai)
2. Navigate to Settings > API Keys
3. Click "Generate New API Key"
4. Copy your API key for use in your application

## Your First BRK

Let's create a simple BRK that generates a product description based on some input parameters.

### 1. Initialize the BRX Client

Create a new file called `index.js` (or `index.ts` for TypeScript) and add the following code:

```javascript theme={null}
import BRX, { BRK } from 'brx-node';

// Initialize the BRX client with your API key
const brx = new BRX('your-api-key');

async function main() {
  // We'll add more code here
}

main().catch(console.error);
```

### 2. Create a BRK

Now, let's create a BRK for generating product descriptions:

```javascript theme={null}
async function main() {
  // Define the BRK
  const createRequest = {
    modifyBrxMode: 'CREATE',
    brx: {
      brxId: 'product-description-generator',
      brxName: 'Product Description Generator',
      description: 'Generates compelling product descriptions',
      prompt: {
        prompt: new Map([
          ['main', `
            Generate a compelling product description for the following product:
            
            Product Name: {{product_name}}
            Product Category: {{product_category}}
            Key Features: {{key_features}}
            Target Audience: {{target_audience}}
            
            The description should be engaging, highlight the key features, and appeal to the target audience.
            Keep it between 100-150 words.
          `]
        ])
      },
      processParams: {
        processType: 0 // Standard processing
      },
      dependantBrxIds: new Map([
        ['main_brx_entry_schema', 'product-description-generator']
      ])
    },
    schema: {
      schemaFields: new Map([
        ['product_name', {
          fieldValueDataType: 'string',
          fieldValue: ''
        }],
        ['product_category', {
          fieldValueDataType: 'string',
          fieldValue: ''
        }],
        ['key_features', {
          fieldValueDataType: 'string',
          fieldValue: ''
        }],
        ['target_audience', {
          fieldValueDataType: 'string',
          fieldValue: ''
        }]
      ]),
      brxName: 'Product Description Generator',
      brxId: 'product-description-generator'
    }
  };

  // Send the create request
  const result = await brx.create(createRequest);
  console.log('BRK created:', result);
}
```

### 3. Use the BRK

Now that we've created a BRK, let's use it to generate a product description:

```javascript theme={null}
async function main() {
  // ... previous code ...

  // Fetch the BRK Schema
  const productDescriptionSchema = await brx.get('product-description-generator');

  // Initialize the BRK using the schema
  const productDescription = new BRK(productDescriptionSchema);

  // Add inputs
  productDescription.input['product_name'] = 'Ultra Comfort Ergonomic Chair';
  productDescription.input['product_category'] = 'Office Furniture';
  productDescription.input['key_features'] = 'Adjustable height, lumbar support, breathable mesh, 360-degree swivel';
  productDescription.input['target_audience'] = 'Office workers, remote professionals, people who sit for long periods';

  // Run the BRK
  const descriptionResult = await brx.run(productDescription);
  
  // Print the result
  console.log('Generated Description:');
  console.log(descriptionResult[0].brxRes.output);
}
```

### 4. Run Your Code

Save your file and run it:

```bash theme={null}
node index.js  # or ts-node index.ts for TypeScript
```

You should see a generated product description in the console output.

## Next Steps

Now that you've created and used your first BRK, here are some next steps to explore:

<CardGroup cols={2}>
  <Card title="Create Complex BRKs" icon="puzzle-piece" href="/docs/Core Concepts/Composability">
    Learn how to create BRKs with dependencies for more complex workflows
  </Card>

  <Card title="Explore the API" icon="code" href="/api-reference/introduction">
    Dive into the BRX API for more advanced usage
  </Card>

  <Card title="Tool Calling" icon="wrench" href="/docs/Core Concepts/ToolCalling">
    Integrate external tools and APIs with your BRX workflows
  </Card>

  <Card title="BRX Client" icon="server" href="/docs/Core Concepts/BRXClient">
    Learn more about the BRX Client and its capabilities
  </Card>
</CardGroup>

## Troubleshooting

### Common Issues

<AccordionGroup>
  <Accordion icon="triangle-exclamation" title="Authentication Error">
    If you see an authentication error, make sure your API key is correct and has not expired. You can generate a new API key in the BRX Dashboard.
  </Accordion>

  <Accordion icon="bug" title="BRK Execution Error">
    If your BRK fails to execute, check the error message for details. Common issues include:

    * Invalid input values
    * Exceeded token limits
    * Rate limiting
    * Dependency errors
  </Accordion>

  <Accordion icon="network-wired" title="Network Issues">
    If you're experiencing network issues, check your internet connection and firewall settings. The BRX API requires outbound HTTPS connections.
  </Accordion>
</AccordionGroup>

### Getting Help

If you're still having issues, you can:

* Check the [API Reference](/api-reference/introduction) for detailed documentation
* Join the [BRX Community Slack](https://join.slack.com/t/brx-communityslack/shared_invite/zt-2vfndoyuv-FTxv0Wc2CzpfO6TH3VHpkg) for community support
* Contact [BRX Support](mailto:support@brx.ai) for direct assistance
