Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 43 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,39 +81,68 @@ Here is what you need to be able to run Comp AI.

## Development

To get the project working locally with all integrations, follow these extended development steps.
To get the project working locally with all integrations, follow these extended development steps

### Setup

1. Clone the repo:
## Add environment variables and fill them out with your credentials

```sh
git clone https://github.com/trycompai/comp.git
```
```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
```

2. Navigate to the project directory:
## Get code running locally

```sh
cd comp
```
1. Clone the repo

```sh
git clone https://github.com/trycompai/comp.git
```

3. Install dependencies using Bun:
2. Navigate to the project directory

```sh
bun install
cd comp
```

4. Install `concurrently` as a dev dependency:
3. Install dependencies using Bun

```sh
bun add -d concurrently
bun install
```

4. Get Database Running

```sh
cd packages/db
bun run docker:up # Spin up docker container
bun run db:migrate # Run migrations
```

5. Generate Prisma Types for each app

```sh
cd apps/app
bun run db:generate
cd ../portal
bun run db:generate
cd ../api
bun run db:generate
```

6. Run all apps in parallel from the root directory

```sh
bun run dev
```

---

### Environment Setup

Create the following `.env` files and fill them out with your credentials:
Create the following `.env` files and fill them out with your credentials

- `comp/apps/app/.env`
- `comp/apps/portal/.env`
Expand Down
75 changes: 53 additions & 22 deletions apps/app/.env.example
Original file line number Diff line number Diff line change
@@ -1,23 +1,54 @@
# Required
AUTH_SECRET="" # openssl rand -base64 32
DATABASE_URL="" # Format: "postgresql://postgres:pass@127.0.0.1:5432/comp"
RESEND_DOMAIN=" # Domain configured in Resend, e.g. mail.trycomp.ai
RESEND_API_KEY="" # API key from Resend for email authentication / invites
REVALIDATION_SECRET="" # openssl rand -base64 32
NEXT_PUBLIC_PORTAL_URL="http://localhost:3002" # The employee portal uses port 3002 by default

# Recommended
# Store attachments in any S3 compatible bucket, we use AWS
APP_AWS_ACCESS_KEY_ID="" # AWS Access Key ID
APP_AWS_SECRET_ACCESS_KEY="" # AWS Secret Access Key
APP_AWS_REGION="" # AWS Region
APP_AWS_BUCKET_NAME="" # AWS Bucket Name

TRIGGER_SECRET_KEY="" # For background jobs. Self-host or use cloud-version @ https://trigger.dev
# TRIGGER_API_URL="" # Only set if you are self-hosting
TRIGGER_API_KEY="" # API key from Trigger.dev
TRIGGER_SECRET_KEY="" # Secret key from Trigger.dev

OPENAI_API_KEY="" # AI Chat + Auto Generated Policies, Risks + Vendors
FIRECRAWL_API_KEY="" # For research, self-host or use cloud-version @ https://firecrawl.dev
# Authentication & Database

AUTH_GOOGLE_ID="" # Google login
AUTH_GOOGLE_SECRET="" # Google Login
AUTH_GITHUB_ID="" # Optional
AUTH_GITHUB_SECRET="" # Optional
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/comp" # Should be the default
AUTH_SECRET="" # Used for auth, use something random and strong
SECRET_KEY="" # Used for encrypting data, use something random and strong
NEXT_PUBLIC_BETTER_AUTH_URL=http://localhost:3000 # Must point to the domain hosting the app

# Upstash
UPSTASH_REDIS_REST_URL="" # Optional, used for rate limiting
UPSTASH_REDIS_REST_TOKEN="" # Optional, used for rate limiting

# OpenAI
OPENAI_API_KEY="" # Required for app to work

# Resend
RESEND_API_KEY="" # For sending emails, app notifications, etc.

# Trigger
TRIGGER_SECRET_KEY="" # Required, for all async jobs and tasks

# Posthog
NEXT_PUBLIC_POSTHOG_HOST=/ingest # GTM Trackers
NEXT_PUBLIC_POSTHOG_KEY="" # GTM Trackers

# Vercel
VERCEL_ACCESS_TOKEN="" # For trust portal domains
VERCEL_TEAM_ID="" # For trust portal domains
VERCEL_PROJECT_ID="" # For trust portal domains
NEXT_PUBLIC_VERCEL_URL="" # eg. trycomp.ai

# AWS
APP_AWS_BUCKET_NAME="" # Required, for task attachments
APP_AWS_REGION="" # Required, for task attachments
APP_AWS_ACCESS_KEY_ID="" # Required, for task attachments
APP_AWS_SECRET_ACCESS_KEY="" # Required, for task attachments

# TRIGGER REVAL
REVALIDATION_SECRET="" # Revalidate server side, generate something random

GROQ_API_KEY="" # For the AI chat, on dashboard
NEXT_PUBLIC_PORTAL_URL="http://localhost:3001"
ANTHROPIC_API_KEY="" # Optional, For more options with models
BETTER_AUTH_URL=http://localhost:3000 # For auth

NEXT_OUTPUT_STANDALONE=false # For deploying on AWS instead of Vercel

FLEET_URL="" # If you want to enable MDM, your hosted url
FLEET_TOKEN="" # If you want to enable MDM

FIRECRAWL_API_KEY="" # To research vendors, Required
26 changes: 5 additions & 21 deletions apps/app/src/app/(app)/[orgId]/frameworks/components/Overview.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { FrameworkEditorFramework } from '@db';
import { FrameworkEditorFramework, Policy, Task } from '@db';
import { FrameworkInstanceWithControls } from '../types';
import { ComplianceOverview } from './ComplianceOverview';
import { DraggableCards } from './DraggableCards';
Expand All @@ -11,31 +11,15 @@ import { FrameworkInstanceWithComplianceScore } from './types';
export interface PublishedPoliciesScore {
totalPolicies: number;
publishedPolicies: number;
draftPolicies: {
id: string;
status: 'draft' | 'published' | 'needs_review';
name: string;
}[];
policiesInReview: {
id: string;
status: 'draft' | 'published' | 'needs_review';
name: string;
}[];
unpublishedPolicies: {
id: string;
status: 'draft' | 'published' | 'needs_review';
name: string;
}[];
draftPolicies: Policy[];
policiesInReview: Policy[];
unpublishedPolicies: Policy[];
}

export interface DoneTasksScore {
totalTasks: number;
doneTasks: number;
incompleteTasks: {
id: string;
title: string;
status: 'todo' | 'in_progress' | 'done' | 'not_relevant';
}[];
incompleteTasks: Task[];
}

export interface OverviewProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Button } from '@comp/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@comp/ui/card';
import { ScrollArea } from '@comp/ui/scroll-area';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@comp/ui/tabs';
import { Policy, Task } from '@db';
import {
ArrowRight,
CheckCircle2,
Expand All @@ -20,18 +21,6 @@ import { useMemo, useState } from 'react';
import { toast } from 'sonner';
import { ConfirmActionDialog } from './ConfirmActionDialog';

interface Policy {
id: string;
name: string;
status: 'draft' | 'published' | 'needs_review';
}

interface Task {
id: string;
title: string;
status: 'todo' | 'in_progress' | 'done' | 'not_relevant';
}

export function ToDoOverview({
totalPolicies,
totalTasks,
Expand Down
5 changes: 0 additions & 5 deletions apps/app/src/app/(app)/[orgId]/frameworks/lib/getPolicies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@ export async function getPublishedPoliciesScore(organizationId: string) {
where: {
organizationId,
},
select: {
id: true,
name: true,
status: true,
},
});

const publishedPolicies = allPolicies.filter((p) => p.status === 'published');
Expand Down
5 changes: 0 additions & 5 deletions apps/app/src/app/(app)/[orgId]/frameworks/lib/getTasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,6 @@ export const getDoneTasks = cache(async (organizationId: string) => {
where: {
organizationId,
},
select: {
id: true,
title: true,
status: true,
},
});

const doneTasks = tasks.filter((t) => t.status === 'done');
Expand Down
Loading
Loading