Skip to main content
doc0blade47/compdocumentation home
Sign in

Quickstart

Last updated Oct 11, 2026

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.

Prerequisites

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)
  1. Get the Comp AI Codebase

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

    1. Clone the repository:
      git clone https://github.com/trycompai/comp.git
    2. Navigate to the project directory:
      cd comp
  2. Install Project Dependencies

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

    bun install
  3. 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.

      cp apps/app/.env.example apps/app/.env
      cp apps/portal/.env.example apps/portal/.env
      cp packages/db/.env.example packages/db/.env
    2. Fill in required variables for apps/app/.env: Open the apps/app/.env file and add or update the following variables.

      AUTH_SECRET=""
      DATABASE_URL="postgresql://user:password@host:port/database"
      RESEND_API_KEY=""
      NEXT_PUBLIC_PORTAL_URL="http://localhost:3002"
      REVALIDATION_SECRET=""
      • 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).

      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.

  4. 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.
      • 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:
        project: 'proj_****az***ywb**ob*'; // Replace with your actual Project ID
    2. Google OAuth (Authentication)

      • Go to the Google Cloud OAuth Console.
      • 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.

      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.

    3. Redis (Upstash for Key-Value Store)

      If Redis environment variables are not recognized, you might need to hard-code them into packages/kv/src/index.ts.

  5. 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:

      cd packages/db
    2. Start the PostgreSQL database using Docker:

      bun run docker:up

      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';.
    3. Generate Prisma client:

      bun run db:generate
    4. Push the schema to the database:

      bun run db:push
    5. Optionally, seed the database with initial data:

      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):

      psql "postgresql://postgres:<your_password>@localhost:5432/comp" -f ./prisma/functionDefinition.sql

      Expected output: CREATE FUNCTION

      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.
  6. Start the Application

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

    1. Return to the root directory of the project:

      cd ../..
    2. Start all applications in parallel:

      bun run dev

      Alternatively, if you have Turbo installed, you can use:

      turbo dev

      If you don't have Turbo installed, you can install it globally using Bun:

      bun add -g turbo

    🎉 Congratulations! You now have a working local instance of Comp AI!

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:

Was this page helpful?