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

# Create Your Own GitHub App

> Set up a custom GitHub App to deploy MatterAI in your own environment

This guide walks you through the process of creating and configuring your own GitHub App for MatterAI, giving you complete control over permissions and data access.

## Prerequisites

* GitHub organization or personal account with admin privileges

## Step 1: Register a New GitHub App

1. Navigate to your GitHub organization settings (or personal settings)
2. Select **Developer settings** > **GitHub Apps** > **New GitHub App**
3. Configure the basic app settings:
   * **GitHub App name**: Choose a descriptive name (e.g., "YourCompany MatterAI")
   * **Homepage URL**: Your company website or internal documentation URL
   * **Callback URL**: `https://matter-backend.example.com/api/v1/auth/github/callback`. Replace your domain later.
   * **Webhook URL**: `https://matter-backend.example.com/github/webhook`. Replace your domain later.
   * **Webhook secret**: Generate a secure random string to validate webhook payloads

<Note>
  Keep your webhook secret secure. You'll need to provide this to your MatterAI instance during configuration.
</Note>

## Step 2: Set Required Permissions

MatterAI requires specific permissions to function properly. Configure the following permission settings:

### Repository **Permissions**

<Frame>
  <img className="block" src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-repo-permissions-1.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=6ab1e68ec4bc17dfa824c5812fcb77b3" alt="GitHub App Permissions" width="1736" height="1670" data-path="images/enterprise/github-app-repo-permissions-1.png" />
</Frame>

<br />

<Frame>
  <img className="block" src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-repo-permissions-2.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=c007cdc92dedfb6a74cbea6cdbe1b799" alt="GitHub App Permissions" width="1660" height="1674" data-path="images/enterprise/github-app-repo-permissions-2.png" />
</Frame>

<br />

<Frame>
  <img className="block" src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-repo-permissions-3.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=4ad444bb6d12fd9e17298f8ef26dcbf1" alt="GitHub App Permissions" width="1642" height="1670" data-path="images/enterprise/github-app-repo-permissions-3.png" />
</Frame>

### Organization Permissions

<Frame>
  <img src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-org-permissions-1.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=2b7c17b2439d4072f0ceaa8b1c6896d6" alt="GitHub App Permissions" width="1436" height="1670" data-path="images/enterprise/github-app-org-permissions-1.png" />
</Frame>

### Account Permissions

<Frame>
  <img src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-account-permissions-1.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=cb367c7712ed4c4a5f67786de6384726" alt="GitHub App Permissions" width="1668" height="1674" data-path="images/enterprise/github-app-account-permissions-1.png" />
</Frame>

### Subscribe to Events

Enable the following webhook events:

<Frame>
  <img src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-webhook-events-1.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=110c04ca222cf5affe74e4b3e5f0d5d5" alt="GitHub App Events" width="1648" height="1676" data-path="images/enterprise/github-app-webhook-events-1.png" />
</Frame>

<br />

<Frame>
  <img src="https://mintcdn.com/gravitycloud-9ebb5c50/3U87DakErDeBshmz/images/enterprise/github-app-webhook-events-2.png?fit=max&auto=format&n=3U87DakErDeBshmz&q=85&s=40289850e1c6d4bbbeabc90ca48ec887" alt="GitHub App Events" width="1642" height="1674" data-path="images/enterprise/github-app-webhook-events-2.png" />
</Frame>

## Step 3: Generate Private Key

1. After creating the app, scroll down to the "Private keys" section
2. Click **Generate a private key**
3. Save the downloaded `.pem` file securely

<Warning>
  The private key is generated only once and cannot be recovered if lost. Store it securely as you would any sensitive credential.
</Warning>

## Step 4: Install the GitHub App

1. Navigate to your GitHub App's settings page
2. Click on **Install App** in the sidebar
3. Choose the organization or account where you want to install the app
4. Select the repositories you want MatterAI to have access to
   * You can choose specific repositories or grant access to all repositories

## Next Steps

Now that you've created your GitHub App, you can proceed to deploy MatterAI using one of our self-hosting options:

<CardGroup cols={2}>
  <Card title="Docker Compose Deployment" icon="docker" href="/enterprise/self-hosted-docker-compose">
    Deploy MatterAI using Docker Compose
  </Card>

  <Card title="Kubernetes Deployment" icon="dharmachakra" href="/enterprise/self-hosted-helm-chart">
    Deploy MatterAI on Kubernetes using Helm charts
  </Card>
</CardGroup>
