Skip to content
Merged
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
ff3f6f7
refactor: enhance EmployeeCompletionChart with profile links
Marfuen Aug 26, 2025
50222fa
Merge pull request #1411 from trycompai/mariano/new-agent
Marfuen Aug 26, 2025
8a81f42
fix: Enforce role-based access control in app
Dhanus3133 Aug 26, 2025
a9957cd
fix: Prisma seed command in `packages/db`
Dhanus3133 Aug 26, 2025
d7ac38b
Merge pull request #1414 from Dhanus3133/fix/prisma-seed-command
Marfuen Aug 27, 2025
f8700e9
Merge branch 'main' into fix/deny-access-non-owners-and-non-admin
Dhanus3133 Aug 27, 2025
a4056bf
fix: Move role checks on org level
Dhanus3133 Aug 27, 2025
237a1fc
Merge branch 'fix/deny-access-non-owners-and-non-admin' of https://gi…
Dhanus3133 Aug 27, 2025
1553400
fix: Allow access to auditor role
Dhanus3133 Aug 27, 2025
bfa18f0
chore: Just restrict access to employee role
Dhanus3133 Aug 27, 2025
4bedd51
Merge pull request #1413 from Dhanus3133/fix/deny-access-non-owners-a…
Marfuen Aug 27, 2025
f16ad2f
chore(deps): bump @tiptap/extension-highlight from 2.22.3 to 3.3.0 (#…
dependabot[bot] Aug 28, 2025
ee901ab
chore(deps): bump dub from 0.63.7 to 0.66.1 (#1399)
dependabot[bot] Aug 28, 2025
0740452
chore(deps): bump @dub/embed-react from 0.0.15 to 0.0.16 (#1337)
dependabot[bot] Aug 28, 2025
dd928ad
chore: update Header component and enhance NoAccess page layout (#1425)
github-actions[bot] Aug 28, 2025
9035238
fix: remove duplicate dependsOn key (#1426)
golamrabbiazad Aug 28, 2025
abedc9a
[dev] [Marfuen] mariano/videos (#1427)
github-actions[bot] Aug 28, 2025
1a3b08d
[dev] [Marfuen] mariano/fix-bug (#1429)
github-actions[bot] Aug 28, 2025
a717403
Mariano/updated employees (#1430)
Marfuen Aug 28, 2025
98c6503
chore: remove training video backfill action and related documentatio…
github-actions[bot] Aug 28, 2025
2691ce8
[dev] [Marfuen] mariano/batch (#1432)
github-actions[bot] Aug 28, 2025
3fe72a9
show loader while marking video as complete (#1437)
github-actions[bot] Aug 29, 2025
af81122
Merge branch 'release' into main
Marfuen Aug 29, 2025
21cd3af
chore(deps): bump @radix-ui/react-popover from 1.1.14 to 1.1.15 (#1434)
dependabot[bot] Aug 29, 2025
460b72d
chore(deps): bump embla-carousel-react from 8.5.1 to 8.6.0 (#1436)
dependabot[bot] Aug 29, 2025
b85c277
chore(deps-dev): bump eslint-config-next from 15.4.2-canary.16 to 15.…
dependabot[bot] Aug 29, 2025
4b90703
Merge branch 'release' into main
Marfuen Aug 29, 2025
0801b32
[dev] [Marfuen] mariano/docker-fix (#1440)
github-actions[bot] Aug 29, 2025
153341d
Env-ify Better Auth trustedOrigins + refactor Resend sender config (#…
ishu-harsh Aug 29, 2025
239590b
Merge branch 'release' into main
Marfuen Sep 1, 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
8 changes: 7 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
# 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_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 <lewis@mail.trycomp.ai>"
RESEND_FROM_SYSTEM="Comp AI <mail@mail.trycomp.ai>"
RESEND_FROM_DEFAULT="Comp AI <mail@mail.trycomp.ai>"
RESEND_TO_TEST="mail@mail.trycomp.ai"
RESEND_REPLY_TO_MARKETING="lewis@mail.trycomp.ai"
REVALIDATION_SECRET="" # openssl rand -base64 32
NEXT_PUBLIC_PORTAL_URL="http://localhost:3002" # The employee portal uses port 3002 by default

Expand All @@ -21,3 +26,4 @@ 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
2 changes: 1 addition & 1 deletion apps/app/src/utils/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export const auth = betterAuth({
provider: 'postgresql',
}),
baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL,
trustedOrigins: ['http://localhost:3000', 'https://*.trycomp.ai', 'http://localhost:3002'],
trustedOrigins: process.env.AUTH_TRUSTED_ORIGINS ? process.env.AUTH_TRUSTED_ORIGINS.split(",").map(o => o.trim()) : ['http://localhost:3000', 'https://*.trycomp.ai', 'http://localhost:3002'],
emailAndPassword: {
enabled: true,
},
Expand Down
40 changes: 31 additions & 9 deletions packages/email/lib/resend.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Resend } from 'resend';

export const resend = process.env.RESEND_API_KEY ? new Resend(process.env.RESEND_API_KEY) : null;
export const domain = process.env.RESEND_DOMAIN ?? 'mail.trycomp.ai';

export const sendEmail = async ({
to,
Expand All @@ -26,18 +25,41 @@ export const sendEmail = async ({
throw new Error('Resend not initialized - missing API key');
}


// 1) Pull each env var into its own constant
const fromMarketing = process.env.RESEND_FROM_MARKETING;
const fromSystem = process.env.RESEND_FROM_SYSTEM;
const fromDefault = process.env.RESEND_FROM_DEFAULT;
const toTest = process.env.RESEND_TO_TEST;
const replyMarketing= process.env.RESEND_REPLY_TO_MARKETING;

// 2) Decide which one you need for this email
const fromAddress = marketing
? fromMarketing
: system
? fromSystem
: fromDefault;

const toAddress = test ? toTest : to;

const replyTo = marketing ? replyMarketing : undefined;

// 3) Guard against undefined
if (!fromAddress) {
throw new Error('Missing FROM address in environment variables');
}
if (!toAddress) {
throw new Error('Missing TO address in environment variables');
}

try {
const { data, error } = await resend.emails.send({
from: marketing
? `Lewis Carhart <lewis@${domain}>`
: system
? `Comp AI <mail@${domain}>`
: `Comp AI <mail@${domain}>`,
to: test ? `mail@${domain}` : to,
from: fromAddress, // now always a string
to: toAddress, // now always a string
cc,
replyTo: marketing ? `lewis@${domain}` : undefined,
replyTo,
subject,
//@ts-ignore expected
// @ts-ignore – React node allowed by the SDK
react,
scheduledAt,
});
Expand Down
Loading