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

# Quickstart

> Get started with EmitKit in under 5 minutes

## Get Started in 3 Steps

Monitor your first critical product moment and get instant alerts.

### Step 1: Get an API Key

<Steps>
  <Step title="Sign up or self-host">
    You'll need an EmitKit API key to get started. You can either:

    * Sign up for a hosted account at [emitkit.com](https://emitkit.com)
    * [Self-host EmitKit](/self-hosting/overview) on your own infrastructure
  </Step>

  <Step title="Create an API key">
    1. Log into your dashboard
    2. Navigate to Settings → API Keys
    3. Click "Create API Key"
    4. Copy your API key (it starts with `emitkit_`)

    <Note>
      Keep in mind that API keys are scoped to organizations and projects.
    </Note>
  </Step>
</Steps>

### Step 2: Install the SDK

<CodeGroup>
  ```bash npm theme={null}
  npm install @emitkit/js
  ```

  ```bash pnpm theme={null}
  pnpm add @emitkit/js
  ```

  ```bash yarn theme={null}
  yarn add @emitkit/js
  ```
</CodeGroup>

### Step 3: Send Your First Event

<CodeGroup>
  ```typescript TypeScript theme={null}
  import { EmitKit } from '@emitkit/js';

  // Initialize the client
  const client = new EmitKit('emitkit_xxxxxxxxxxxxxxxxxxxxx');

  // Send an event
  const result = await client.events.create({
    channelName: 'general',
    title: 'Hello from EmitKit!',
    description: 'My first event',
    icon: '👋'
  });

  console.log('Event created:', result.data.id);
  ```

  ```javascript JavaScript theme={null}
  const { EmitKit } = require('@emitkit/js');

  // Initialize the client
  const client = new EmitKit('emitkit_xxxxxxxxxxxxxxxxxxxxx');

  // Send an event
  const result = await client.events.create({
    channelName: 'general',
    title: 'Hello from EmitKit!',
    description: 'My first event',
    icon: '👋'
  });

  console.log('Event created:', result.data.id);
  ```
</CodeGroup>

<Check>
  **Success!** You've sent your first event. You should see it in your EmitKit dashboard immediately.
</Check>

## Next Steps

Now that you've sent your first event, explore more features:

<CardGroup cols={2}>
  <Card title="Track Users" icon="user" href="/sdk/identify">
    Identify users and track events by user ID
  </Card>

  <Card title="Add Metadata" icon="database" href="/sdk/events">
    Attach custom data to your events
  </Card>

  <Card title="Error Handling" icon="shield-exclamation" href="/sdk/error-handling">
    Handle errors and rate limits properly
  </Card>

  <Card title="API Reference" icon="code" href="/api-reference/introduction">
    Explore the full API documentation
  </Card>
</CardGroup>

## Common Patterns

### Monitor Critical Events

```typescript theme={null}
import { EmitKit } from '@emitkit/js';

const client = new EmitKit('your_api_key');

// Get alerted when a user signs up
await client.events.create({
  channelName: 'signups',
  title: 'New user signed up',
  userId: 'user_123',
  metadata: {
    email: 'user@example.com',
    source: 'google',
    plan: 'free'
  }
});
```

### Send Notifications

```typescript theme={null}
// Send a notification
await client.events.create({
  channelName: 'alerts',
  title: 'Payment Failed',
  description: 'Credit card declined',
  icon: '⚠️',
  notify: true
});
```

### Track Payments

```typescript theme={null}
await client.events.create({
  channelName: 'payments',
  title: 'Payment Received',
  description: 'User upgraded to Pro plan',
  icon: '💰',
  userId: 'user_123',
  tags: ['payment', 'upgrade'],
  metadata: {
    amount: 99.99,
    currency: 'USD',
    plan: 'pro',
    transactionId: 'txn_abc123'
  }
});
```

### Identify Users

```typescript theme={null}
// Create user identity with aliases
await client.identify({
  user_id: 'user_123',
  properties: {
    email: 'john@example.com',
    name: 'John Doe',
    plan: 'pro',
    signupDate: '2025-01-15'
  },
  aliases: [
    'john@example.com',  // Email
    'johndoe',            // Username
    'ext_12345'           // External system ID
  ]
});

// Now you can reference the user by any alias
await client.events.create({
  channelName: 'activity',
  title: 'User logged in',
  userId: 'john@example.com',  // ← Alias works!
});
```

## Environment Variables

<Tip>
  **Best Practice**: Store your API key in environment variables, not in your code.
</Tip>

<CodeGroup>
  ```bash .env theme={null}
  EMITKIT_API_KEY=emitkit_xxxxxxxxxxxxxxxxxxxxx
  ```

  ```typescript app.ts theme={null}
  import { EmitKit } from '@emitkit/js';

  const client = new EmitKit(process.env.EMITKIT_API_KEY);
  ```
</CodeGroup>

## Configuration Options

```typescript theme={null}
const client = new EmitKit('your_api_key', {
  // Custom base URL (for self-hosted instances)
  baseUrl: 'https://api.your-domain.com',

  // Request timeout in milliseconds
  timeout: 30000,

  // Custom fetch implementation (optional)
  fetch: customFetch
});
```

## Need Help?

<CardGroup cols={2}>
  <Card title="Full SDK Documentation" icon="book" href="/sdk/typescript">
    Learn about all SDK features and capabilities
  </Card>

  <Card title="API Reference" icon="terminal" href="/api-reference/introduction">
    Complete API endpoint documentation
  </Card>

  <Card title="Self-Hosting Guide" icon="server" href="/self-hosting/overview">
    Deploy your own EmitKit instance
  </Card>

  <Card title="Community Support" icon="comments" href="https://github.com/emitkithq/emitkit/discussions">
    Get help from the community
  </Card>
</CardGroup>
