Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
ad274ff
chore(husky): remove deprecated lines from commit-msg hook
james-miview Sep 17, 2025
df123b4
fix(onboarding): remove overzealous type from useRun to prevent compo…
james-miview Sep 17, 2025
050d801
feat(trigger): make project id configurable via env
james-miview Sep 17, 2025
2d746b5
refactor(env): dedupe BETTER_AUTH_URL with fallback to NEXT_PUBLIC_BE…
james-miview Sep 17, 2025
b22204a
chore: update concurrently to latest version
james-miview Sep 17, 2025
d44f35e
refactor(env): dedupe NEXT_PUBLIC_PORTAL_URL with fallback to NEXT_PU…
james-miview Sep 17, 2025
77be9ed
Merge remote-tracking branch 'upstream/main' into Local-Compose-Fixes
james-miview Sep 19, 2025
7959602
refactor(env): allow NEXT_PULIC_PORTAL_URL to be optional
james-miview Sep 19, 2025
32218e1
refactor(Docker): geet docker compose local working
james-miview Sep 19, 2025
3a180c9
feat(suppress-posthig): added optional envrionment flag to suppress p…
james-miview Sep 19, 2025
14c456f
feat(seeder migrator): added ability to reset db and added to local c…
james-miview Sep 19, 2025
ae6c9cf
chore(BetterAuth): fix better auth command deprecation warning
james-miview Sep 19, 2025
eb7c21b
Merge remote-tracking branch 'upstream/main' into Local-Compose-Fixes
james-miview Sep 19, 2025
8e482f9
chore(auth): dynamic point to self as auth provider
james-miview Sep 19, 2025
63cd640
chore(loginurl): cleaned up login urls some more
james-miview Sep 19, 2025
3175b7f
chore(compose): fallback url fix
james-miview Sep 19, 2025
985fd27
Merge remote-tracking branch 'upstream/main' into Local-Compose-Fixes
james-miview Sep 19, 2025
2376b7d
chore(DatabaseTimeout): increased timeout for db transactions
james-miview Sep 19, 2025
d0135a1
chore(imagefix): fixed images when running locally
james-miview Sep 19, 2025
e47c421
chore(imagefix): fixed images when running locally complete
james-miview Sep 19, 2025
1026365
feat(env): update sample env to work with compose
james-miview Sep 19, 2025
54f7bf1
chore(documentation): updated readme
james-miview Sep 20, 2025
854582e
feat(compose): fix fallback url on portal
james-miview Sep 20, 2025
7dfb967
chore(tests): fixing tests
james-miview Sep 20, 2025
72e8c16
Merge remote-tracking branch 'upstream/main' into Local-Compose-Fixes
james-miview Oct 1, 2025
e6f7574
Merge remote-tracking branch 'upstream/main' into Local-Compose-Fixes
james-miview Oct 2, 2025
2b18cba
feat(local): trigger.dev fixes
james-miview Oct 2, 2025
28ba07f
Merge remote-tracking branch 'upstream/main' into Local-Compose-Fixes
james-miview Oct 2, 2025
805a03c
chore(local): remove merge comments
james-miview Oct 2, 2025
47d6f45
chore(readme): updated readme notes
james-miview Oct 2, 2025
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
79 changes: 51 additions & 28 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,29 +1,52 @@
# Required
AUTH_SECRET="" # openssl rand -base64 32
DATABASE_URL="" # Format: "postgresql://postgres:[email protected]:5432/comp"
RESEND_DOMAIN="" # Domain configured in Resend, e.g. mail.trycomp.ai
RESEND_API_KEY="" # API key from Resend for email authentication / invites
RESEND_FROM_MARKETING="Lewis Carhart <[email protected]>"
RESEND_FROM_SYSTEM="Comp AI <[email protected]>"
RESEND_FROM_DEFAULT="Comp AI <[email protected]>"
RESEND_TO_TEST="[email protected]"
RESEND_REPLY_TO_MARKETING="[email protected]"
REVALIDATION_SECRET="" # openssl rand -base64 32
NEXT_PUBLIC_PORTAL_URL="http://localhost:3002" # The employee portal uses port 3002 by default
# Commented out variables are optional -- NOTE: This is for local Docker-compose use only, additional variables will need to be set to deploy on development+

# Recommended
# Store attachemnts 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

AUTH_TRUSTED_ORIGINS=http://localhost:3000,https://*.trycomp.ai,http://localhost:3002
APP_AWS_ACCESS_KEY_ID=
APP_AWS_BUCKET_NAME=
APP_AWS_REGION=
APP_AWS_SECRET_ACCESS_KEY=
APP_ENVIRONMENT="local" # Options are "local", "development", "staging", "production"
# AUTH_GITHUB_ID=
# AUTH_GITHUB_SECRET=
# AUTH_GOOGLE_ID=
# AUTH_GOOGLE_SECRET=
# AUTH_SECRET=
BETTER_AUTH_SECRET=
DATABASE_URL=
# DUB_API_KEY=
# DUB_REFER_URL=
FIRECRAWL_API_KEY=
# FLEET_URL=
# FLEET_TOKEN=
FORCE_DATABASE_WIPE_AND_RESEED="false" # Set to "true" to wipe and reseed Database
# GA4_API_SECRET=
# GA4_MEASUREMENT_ID=
# LINKEDIN_CONVERSIONS_ACCESS_TOKEN=
# NEXT_PUBLIC_API_URL=
# NEXT_PUBLIC_BETTER_AUTH_URL=
# NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL=
# NEXT_PUBLIC_GTM_ID=
# NEXT_PUBLIC_IS_DUB_ENABLED=
# NEXT_PUBLIC_LINKEDIN_CONVERSION_ID=
# NEXT_PUBLIC_LINKEDIN_PARTNER_ID=
# NEXT_PUBLIC_PORTAL_URL=
# NEXT_PUBLIC_POSTHOG_HOST=
# NEXT_PUBLIC_POSTHOG_KEY=
OPENAI_API_KEY=
REVALIDATION_SECRET=
RESEND_API_KEY=
RESEND_DOMAIN=
RESEND_FROM_DEFAULT=
RESEND_FROM_MARKETING=
RESEND_FROM_SYSTEM=
# TRIGGER_API_KEY=
# TRIGGER_API_URL=
TRIGGER_ACCESS_TOKEN=
TRIGGER_PROJECT_ID=
TRIGGER_SECRET_KEY=
# TRIGGER_QUEUE_CONCURRENCY=10
# TRUST_PORTAL_PROJECT_ID=
UPSTASH_REDIS_REST_TOKEN=
UPSTASH_REDIS_REST_URL=
# VERCEL_ACCESS_TOKEN=
# VERCEL_PROJECT_ID=
# VERCEL_TEAM_ID=
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/usr/bin/env sh
. "$(dirname "$0")/_/husky.sh"

npx commitlint --edit $1
68 changes: 63 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# syntax=docker/dockerfile:1.6
# =============================================================================
# STAGE 1: Dependencies - Install and cache workspace dependencies
# =============================================================================
Expand Down Expand Up @@ -45,8 +46,22 @@ RUN bun install
RUN cp -R packages/db/prisma/migrations node_modules/@trycompai/db/dist/

# Run migrations against the combined schema published by @trycompai/db
RUN echo "Running migrations against @trycompai/db combined schema"
CMD ["bunx", "prisma", "migrate", "deploy", "--schema=node_modules/@trycompai/db/dist/schema.prisma"]
RUN cat <<'EOF' > /migrate.sh
#!/bin/sh
set -eu

echo "[Migrator] Starting prisma migrate deploy"

if [ "${FORCE_DATABASE_WIPE_AND_RESEED:-false}" = "true" ]; then
echo "[Migrator] FORCE_DATABASE_WIPE_AND_RESEED=true detected. Resetting database before running migrations."
bunx prisma migrate reset --force --skip-seed --schema=node_modules/@trycompai/db/dist/schema.prisma
fi

bunx prisma migrate deploy --schema=node_modules/@trycompai/db/dist/schema.prisma
echo "[Migrator] Prisma migrate deploy finished"
EOF
RUN chmod +x /migrate.sh
CMD ["/migrate.sh"]

# =============================================================================
# STAGE 3: App Builder
Expand All @@ -55,6 +70,11 @@ FROM deps AS app-builder

WORKDIR /app

# Install system packages needed for Trigger CLI during build
RUN apt-get update \
&& apt-get install -y --no-install-recommends ca-certificates \
&& rm -rf /var/lib/apt/lists/*

# Copy all source code needed for build
COPY packages ./packages
COPY apps/app ./apps/app
Expand All @@ -67,8 +87,10 @@ RUN cd packages/db && node scripts/combine-schemas.js
RUN cp packages/db/dist/schema.prisma apps/app/prisma/schema.prisma

# Ensure Next build has required public env at build-time
ARG TRIGGER_PROJECT_ID
ARG NEXT_PUBLIC_BETTER_AUTH_URL
ARG NEXT_PUBLIC_PORTAL_URL
ARG APP_ENVIRONMENT
ARG NEXT_PUBLIC_POSTHOG_KEY
ARG NEXT_PUBLIC_POSTHOG_HOST
ARG NEXT_PUBLIC_IS_DUB_ENABLED
Expand All @@ -77,7 +99,8 @@ ARG NEXT_PUBLIC_LINKEDIN_PARTNER_ID
ARG NEXT_PUBLIC_LINKEDIN_CONVERSION_ID
ARG NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL
ARG NEXT_PUBLIC_API_URL
ENV NEXT_PUBLIC_BETTER_AUTH_URL=$NEXT_PUBLIC_BETTER_AUTH_URL \
ENV TRIGGER_PROJECT_ID=$TRIGGER_PROJECT_ID \
NEXT_PUBLIC_BETTER_AUTH_URL=$NEXT_PUBLIC_BETTER_AUTH_URL \
NEXT_PUBLIC_PORTAL_URL=$NEXT_PUBLIC_PORTAL_URL \
NEXT_PUBLIC_POSTHOG_KEY=$NEXT_PUBLIC_POSTHOG_KEY \
NEXT_PUBLIC_POSTHOG_HOST=$NEXT_PUBLIC_POSTHOG_HOST \
Expand All @@ -87,26 +110,61 @@ ENV NEXT_PUBLIC_BETTER_AUTH_URL=$NEXT_PUBLIC_BETTER_AUTH_URL \
NEXT_PUBLIC_LINKEDIN_CONVERSION_ID=$NEXT_PUBLIC_LINKEDIN_CONVERSION_ID \
NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL=$NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL \
NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL \
APP_ENVIRONMENT=$APP_ENVIRONMENT \
NEXT_TELEMETRY_DISABLED=1 NODE_ENV=production \
NEXT_OUTPUT_STANDALONE=true \
NODE_OPTIONS=--max_old_space_size=6144

# Build the app (schema already combined above)
RUN cd apps/app && SKIP_ENV_VALIDATION=true bun run build:docker

# Run Trigger.dev deploy during build (pinned version)
RUN --mount=type=secret,id=trigger_env_file \
sh -c 'set -eu; \
set -a; \
. /run/secrets/trigger_env_file; \
set +a; \
cd apps/app; \
CI=1 bun x [email protected] deploy --env-file /run/secrets/trigger_env_file'

# =============================================================================
# STAGE 4: App Production
# =============================================================================
FROM node:22-alpine AS app

ARG TRIGGER_PROJECT_ID
ARG NEXT_PUBLIC_BETTER_AUTH_URL
ARG NEXT_PUBLIC_PORTAL_URL
ARG APP_ENVIRONMENT
ARG NEXT_PUBLIC_POSTHOG_KEY
ARG NEXT_PUBLIC_POSTHOG_HOST
ARG NEXT_PUBLIC_IS_DUB_ENABLED
ARG NEXT_PUBLIC_GTM_ID
ARG NEXT_PUBLIC_LINKEDIN_PARTNER_ID
ARG NEXT_PUBLIC_LINKEDIN_CONVERSION_ID
ARG NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL
ARG NEXT_PUBLIC_API_URL

ENV TRIGGER_PROJECT_ID=${TRIGGER_PROJECT_ID} \
NEXT_PUBLIC_BETTER_AUTH_URL=${NEXT_PUBLIC_BETTER_AUTH_URL} \
NEXT_PUBLIC_PORTAL_URL=${NEXT_PUBLIC_PORTAL_URL} \
NEXT_PUBLIC_POSTHOG_KEY=${NEXT_PUBLIC_POSTHOG_KEY} \
NEXT_PUBLIC_POSTHOG_HOST=${NEXT_PUBLIC_POSTHOG_HOST} \
NEXT_PUBLIC_IS_DUB_ENABLED=${NEXT_PUBLIC_IS_DUB_ENABLED} \
NEXT_PUBLIC_GTM_ID=${NEXT_PUBLIC_GTM_ID} \
NEXT_PUBLIC_LINKEDIN_PARTNER_ID=${NEXT_PUBLIC_LINKEDIN_PARTNER_ID} \
NEXT_PUBLIC_LINKEDIN_CONVERSION_ID=${NEXT_PUBLIC_LINKEDIN_CONVERSION_ID} \
NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL=${NEXT_PUBLIC_GOOGLE_ADS_CONVERSION_LABEL} \
NEXT_PUBLIC_API_URL=${NEXT_PUBLIC_API_URL} \
APP_ENVIRONMENT=${APP_ENVIRONMENT}

WORKDIR /app

# Copy Next standalone output
COPY --from=app-builder /app/apps/app/.next/standalone ./
COPY --from=app-builder /app/apps/app/.next/static ./apps/app/.next/static
COPY --from=app-builder /app/apps/app/public ./apps/app/public


EXPOSE 3000
CMD ["node", "apps/app/server.js"]

Expand Down Expand Up @@ -153,4 +211,4 @@ COPY --from=portal-builder /app/apps/portal/public ./apps/portal/public
EXPOSE 3000
CMD ["node", "apps/portal/server.js"]

# (Trigger.dev hosted; no local runner stage)
# (Trigger.dev hosted; no local runner stage)
Loading