---
title: "Quickstart"
description: "Comp AI is an open-source compliance platform designed to help you achieve compliance with frameworks like SOC 2, ISO 27001, HIPAA, and GDPR. It automates evidence collection, policy management, an..."
last_updated: "2026-05-06T07:36:18.476184+00:00"
canonical_url: "https://www.doc0.dev/docs/49c89830-117b-4def-8edc-b5bcc50766e0/guide/section-1/quickstart"
---

Comp AI is an open-source compliance platform designed to help you achieve compliance with frameworks like SOC 2, ISO 27001, HIPAA, and GDPR. It automates evidence collection, policy management, and control implementation, giving you control over your data and infrastructure.

This guide provides step-by-step instructions to get Comp AI running on your local machine for development and testing. By following these steps, you'll have a fully functional local instance of the platform.

<Callout title="Prerequisites" variant="info">
Before you begin, ensure you have the following software installed on your system:

*   **Node.js**: Version `20.x` or higher
*   **Bun**: Version `1.1.36` or higher
*   **PostgreSQL**: Version `15.x` or higher
*   **Docker Desktop** or **Docker Engine** (for database setup)
</Callout>

<Steps>
<Step>
### Get the Comp AI Codebase

First, you need to download the Comp AI project files to your local machine.

1.  **Clone the repository:**
    ```sh
    git clone https://github.com/trycompai/comp.git
    ```
2.  **Navigate to the project directory:**
    ```sh
    cd comp
    ```
</Step>

<Step>
### Install Project Dependencies

Once you're in the project directory, install all necessary dependencies using Bun.

```sh
bun install
```
</Step>

<Step>
### Prepare Environment Variables

Comp AI uses environment variables to manage configurations and credentials. You'll need to create `.env` files in specific locations and fill them with your settings.

1.  **Copy example environment files:**
    These commands create the necessary `.env` files from their examples.

    <Tabs items={["Linux / macOS", "Windows (Command Prompt)", "Windows (PowerShell)"]}>
    <Tab value="Linux / macOS">
    ```sh
    cp apps/app/.env.example apps/app/.env
    cp apps/portal/.env.example apps/portal/.env
    cp packages/db/.env.example packages/db/.env
    ```
    </Tab>
    <Tab value="Windows (Command Prompt)">
    ```cmd
    copy apps\app\.env.example apps\app\.env
    copy apps\portal\.env.example apps\portal\.env
    copy packages\db\.env.example packages\db\.env
    ```
    </Tab>
    <Tab value="Windows (PowerShell)">
    ```powershell
    Copy-Item apps\app\.env.example -Destination apps\app\.env
    Copy-Item apps\portal\.env.example -Destination apps\portal\.env
    Copy-Item packages\db\.env.example -Destination packages\db\.env
    ```
    </Tab>
    </Tabs>

2.  **Fill in required variables for `apps/app/.env`:**
    Open the `apps/app/.env` file and add or update the following variables.

    ```env
    AUTH_SECRET=""
    DATABASE_URL="postgresql://user:password@host:port/database"
    RESEND_API_KEY=""
    NEXT_PUBLIC_PORTAL_URL="http://localhost:3002"
    REVALIDATION_SECRET=""
    ```
    <Callout variant="info">
    *   **`AUTH_SECRET`** and **`REVALIDATION_SECRET`**: Generate secure random strings for these. You can use a command like `openssl rand -base64 32` in your terminal.
    *   **`DATABASE_URL`**: This will be your PostgreSQL connection string. You'll configure the database in a later step.
    *   **`RESEND_API_KEY`**: Obtain this from your Resend account (https://resend.com/api-keys).
    </Callout>
    <Callout variant="warning">
    The `.env.example` files might not include `NEXT_PUBLIC_PORTAL_URL` and `REVALIDATION_SECRET`. Ensure you add these manually to your `apps/app/.env` file.
    </Callout>
</Step>

<Step>
### Configure Cloud & Authentication Services

Comp AI integrates with several external services for authentication, workflows, and data storage. You'll need to set these up.

1.  **Trigger.dev (Workflows)**
    *   Create an account at [https://cloud.trigger.dev](https://cloud.trigger.dev).
    *   Create a new project and copy its Project ID.
    *   Open the file `apps/app/trigger.config.ts` and update the `project` field with your Project ID:
        ```ts
        project: 'proj_****az***ywb**ob*'; // Replace with your actual Project ID
        ```

2.  **Google OAuth (Authentication)**
    *   Go to the [Google Cloud OAuth Console](https://console.cloud.google.com/auth/clients).
    *   Create a new OAuth client:
        *   Select "Web Application" as the application type.
        *   Give it a name, e.g., `comp_app`.
        *   Add the following **Authorized Redirect URIs**:
            ```
            http://localhost
            http://localhost:3000
            http://localhost:3002
            http://localhost:3000/api/auth/callback/google
            http://localhost:3002/api/auth/callback/google
            http://localhost:3000/auth
            http://localhost:3002/auth
            ```
    *   After creation, copy the `Client ID` (your `GOOGLE_ID`) and `Client Secret` (your `GOOGLE_SECRET`).
    *   Add these to your `.env` files.
    <Callout variant="warning">
    If Google OAuth variables are not recognized from your `.env` files, you might need to hard-code them directly into `apps/portal/src/app/lib/auth.ts`.
    </Callout>

3.  **Redis (Upstash for Key-Value Store)**
    *   Go to [https://console.upstash.com](https://console.upstash.com).
    *   Create a new Redis database.
    *   Copy the **Redis URL** and **TOKEN**.
    *   Add these to your `.env` file.
    <Callout variant="warning">
    If Redis environment variables are not recognized, you might need to hard-code them into `packages/kv/src/index.ts`.
    </Callout>
</Step>

<Step>
### Set up the Database

Comp AI uses PostgreSQL. You'll use Docker to run a local PostgreSQL instance and then apply the necessary schema and data.

1.  **Navigate to the database package:**
    ```sh
    cd packages/db
    ```
2.  **Start the PostgreSQL database using Docker:**
    ```sh
    bun run docker:up
    ```
    <Callout variant="info">
    The default credentials for the database are:
    *   **Database name**: `comp`
    *   **Username**: `postgres`
    *   **Password**: `postgres`
    You can change the password by connecting to the database and running `ALTER USER postgres WITH PASSWORD 'new_password';`.
    </Callout>

3.  **Generate Prisma client:**
    ```sh
    bun run db:generate
    ```

4.  **Push the schema to the database:**
    ```sh
    bun run db:push
    ```

5.  **Optionally, seed the database with initial data:**
    ```sh
    bun run db:seed
    ```

6.  **Fix potential database function error:**
    If you encounter an error like `HINT: No function matches the given name and argument types...`, run the following command (replace `<your_password>` with your PostgreSQL password):
    ```sh
    psql "postgresql://postgres:<your_password>@localhost:5432/comp" -f ./prisma/functionDefinition.sql
    ```
    Expected output: `CREATE FUNCTION`

    <Callout variant="info">
    **Useful Database Commands:**
    *   `bun run db:studio`: Open Prisma Studio to view and edit data.
    *   `bun run db:migrate`: Run database migrations.
    *   `bun run docker:down`: Stop the database container.
    *   `bun run docker:clean`: Remove the database container and its volume.
    </Callout>
</Step>

<Step>
### Start the Application

After all configurations are complete, you can start the Comp AI application.

1.  **Return to the root directory of the project:**
    ```sh
    cd ../..
    ```

2.  **Start all applications in parallel:**
    ```sh
    bun run dev
    ```
    Alternatively, if you have Turbo installed, you can use:
    ```sh
    turbo dev
    ```
    <Callout variant="info">
    If you don't have Turbo installed, you can install it globally using Bun:
    ```sh
    bun add -g turbo
    ```
    </Callout>

🎉 Congratulations! You now have a working local instance of Comp AI!
</Step>
</Steps>

## Self-Hosting Comp AI

While this guide focuses on local development, Comp AI also supports self-hosting for production environments. This typically involves Docker-based deployments.

For detailed, up-to-date instructions on self-hosting, including environment variable references and Docker deployment steps, please refer to the official documentation:

*   [Docker Self-Hosting Guide](https://trycomp.ai/docs/self-hosting/docker)
*   [Environment Reference](https://trycomp.ai/docs/self-hosting/env-reference)

## Sitemap

See the full [sitemap](https://www.doc0.dev/docs/49c89830-117b-4def-8edc-b5bcc50766e0/llms.txt) for all pages in this wiki.
