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

# Quickstart on self-hosted GitLab

Sourcery reviews every merge request on the projects you connect. Connect your self-hosted GitLab instance one of two ways: an automatic path that uses an admin token, or a manual one where you create the OAuth application and review user yourself.

## Before you start

**Required permissions**

> You connect a self-hosted GitLab instance as an admin. The automatic path needs an admin
>     personal access token with the `api` scope. The manual path needs admin access to create an
>     instance-wide OAuth application and a review user.

Allow Sourcery's static egress IPs so Sourcery's API can reach the self-hosted instance. See [Network requirements](/trust/network-requirements/) for the addresses to allowlist.

## Install Sourcery


    <Step title="Enter your GitLab URL">
        Go to [`/login/gitlab-self-hosted`](https://app.sourcery.ai/login/gitlab-self-hosted), enter
        your **GitLab URL** (for example, `https://gitlab.example.com`), and click **Login**. If the
        instance isn't connected yet, Sourcery shows the setup view with **Automatic** and
        **Manual** tabs.
    </Step>

    <Step title="Set up the connection">
        The automatic path is the easier one: hand Sourcery an admin token and it does the setup
        for you. Pick manual if your policy requires you to create the OAuth application and
        review user yourself.

        <Tabs>
            <TabItem label="Automatic">
                On the **Automatic** tab, paste an admin personal access token with the `api` scope,
                then click **Setup**. Sourcery uses the token to create the `sourcery-ai` review
                user and an instance-wide OAuth application on your GitLab. You can delete the admin
                token afterward.
            </TabItem>
            <TabItem label="Manual">
                On the **Manual** tab, first create an instance-wide OAuth application at
                `Admin > Applications` named `sourcery-ai`, with the redirect URIs
                `https://auth.sourcery.ai/login/callback` and
                `https://sourcery.eu.auth0.com/login/callback`, and the scopes `api`, `openid`, and
                `email`. Then create a `sourcery-ai` review user and a personal access token with the
                `api` scope. Paste the OAuth application ID and secret and the review user's token
                into the form, then click **Setup**.
            </TabItem>
        </Tabs>
    </Step>

    <Step title="Choose projects">
        Sourcery signs you in and the account dashboard opens. Enable Sourcery on each project you
        want reviewed. That's it for setup: Sourcery installs a webhook on each selected project, so
        it sees merge requests and comments as they happen.
    </Step>



## Your first review

Open a merge request on any connected project and Sourcery reviews it. You'll see:

- A summary in the merge request description covering the change's purpose and risk.
- A reviewer's guide comment with the code paths that changed and how to verify them.
- Inline comments on the specific lines they're about.

Push more commits and Sourcery reviews the new changes. To talk to it, comment `@sourcery-ai` on the merge request.

Billing is handled per seat. See [Billing](/admin/billing/) for how to manage it.

## What's next
