Getting Started
Core Features
How-To Guides
Configuration
Troubleshooting
Integrations
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.
Before you begin, ensure you have the following software installed on your system:
20.x or higher1.1.36 or higher15.x or higherFirst, you need to download the Comp AI project files to your local machine.
git clone https://github.com/trycompai/comp.gitcd compOnce you're in the project directory, install all necessary dependencies using Bun.
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:
bun installComp 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.
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/.envFill 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.Comp AI integrates with several external services for authentication, workflows, and data storage. You'll need to set these up.
Trigger.dev (Workflows)
apps/app/trigger.config.ts and update the project field with your Project ID:
project: 'proj_****az***ywb**ob*'; // Replace with your actual Project IDGoogle OAuth (Authentication)
comp_app.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
Client ID (your GOOGLE_ID) and Client Secret (your GOOGLE_SECRET)..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.
Redis (Upstash for Key-Value Store)
.env file.If Redis environment variables are not recognized, you might need to hard-code them into packages/kv/src/index.ts.
Comp AI uses PostgreSQL. You'll use Docker to run a local PostgreSQL instance and then apply the necessary schema and data.
Navigate to the database package:
cd packages/dbStart the PostgreSQL database using Docker:
bun run docker:upThe default credentials for the database are:
comppostgrespostgres
You can change the password by connecting to the database and running ALTER USER postgres WITH PASSWORD 'new_password';.Generate Prisma client:
bun run db:generatePush the schema to the database:
bun run db:pushOptionally, seed the database with initial data:
bun run db:seedFix 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.sqlExpected 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.After all configurations are complete, you can start the Comp AI application.
Return to the root directory of the project:
cd ../..Start all applications in parallel:
bun run devAlternatively, if you have Turbo installed, you can use:
turbo devIf 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!
RESEND_API_KEYThe .env.example files might not include NEXT_PUBLIC_PORTAL_URL and REVALIDATION_SECRET. Ensure you add these manually to your apps/app/.env file.
bun run docker:clean: Remove the database container and its volume.