Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.
TypeScript ai-agentsbill-of-materialserpinventory-managementleanmanufacturingmanufacturing-execution-systemmcp-servermesmrpopen-source-erppostgresqlproduction-planningqmsquality-management-systemreact-routerself-hostedsupabasetraceabilitytypescript
chore: use environment variable for email domain
Brad Barbine9afe600c587
diff --git a/README.md b/README.mdindex be127ea99c..cb12e07df3 100644--- a/README.md+++ b/README.md@@ -190,7 +190,9 @@ $ cp ./.env.example ./.env- `STRIP_WEBHOOK_SECRET="whsec_************"`6. Signing in requires you to setup one of two methods:- - Email requires a `RESEND_API_KEY="re_**********"`+ - Email requires a Resend API key:+ - `RESEND_API_KEY="re_**********"`+ - `RESEND_DOMAIN="carbon.ms"`- Sign-in with Google requires a [Google auth client](https://supabase.com/docs/guides/auth/social-login/auth-google) with these variables:- `SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_ID="******.apps.googleusercontent.com"`- `SUPABASE_AUTH_EXTERNAL_GOOGLE_CLIENT_SECRET="GOCSPX-****************"`diff --git a/apps/erp/app/routes/x+/users+/customers.new.tsx b/apps/erp/app/routes/x+/users+/customers.new.tsxindex bcc226fdc3..2964e48857 100644--- a/apps/erp/app/routes/x+/users+/customers.new.tsx+++ b/apps/erp/app/routes/x+/users+/customers.new.tsx@@ -1,4 +1,4 @@-import { assertIsPost, getAppUrl, success } from "@carbon/auth";+import { assertIsPost, getAppUrl, RESEND_DOMAIN, success } from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import { InviteEmail } from "@carbon/documents/email";@@ -9,8 +9,8 @@ import type { ActionFunctionArgs } from "@vercel/remix";import { redirect } from "@vercel/remix";import { nanoid } from "nanoid";import {- CreateCustomerModal,createCustomerAccountValidator,+ CreateCustomerModal,} from "~/modules/users";import { createCustomerAccount } from "~/modules/users/users.server";import { path } from "~/utils/path";@@ -62,7 +62,7 @@ export async function action({ request }: ActionFunctionArgs) {}const invitationEmail = await resend.emails.send({- from: "Carbon <[email protected]>",+ from: `Carbon <no-reply@${RESEND_DOMAIN}>`,to: result.email,subject: `You have been invited to join ${company.data?.name} on Carbon`,headers: {diff --git a/apps/erp/app/routes/x+/users+/employees.new.tsx b/apps/erp/app/routes/x+/users+/employees.new.tsxindex 11f28d158e..f11fbc2b24 100644--- a/apps/erp/app/routes/x+/users+/employees.new.tsx+++ b/apps/erp/app/routes/x+/users+/employees.new.tsx@@ -1,4 +1,10 @@-import { assertIsPost, error, getAppUrl, success } from "@carbon/auth";+import {+ assertIsPost,+ error,+ getAppUrl,+ RESEND_DOMAIN,+ success,+} from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import { InviteEmail } from "@carbon/documents/email";@@ -86,7 +92,7 @@ export async function action({ request }: ActionFunctionArgs) {}const invitationEmail = await resend.emails.send({- from: "Carbon <[email protected]>",+ from: `Carbon <no-reply@${RESEND_DOMAIN}>`,to: email,subject: `You have been invited to join ${company.data?.name} on Carbon`,headers: {diff --git a/apps/erp/app/routes/x+/users+/resend-invite.tsx b/apps/erp/app/routes/x+/users+/resend-invite.tsxindex 4145f098fd..c89a4443ae 100644--- a/apps/erp/app/routes/x+/users+/resend-invite.tsx+++ b/apps/erp/app/routes/x+/users+/resend-invite.tsx@@ -1,4 +1,10 @@-import { error, getAppUrl, getCarbonServiceRole, success } from "@carbon/auth";+import {+ error,+ getAppUrl,+ getCarbonServiceRole,+ RESEND_DOMAIN,+ success,+} from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import { InviteEmail } from "@carbon/documents/email";@@ -65,7 +71,7 @@ export async function action({ request }: ActionFunctionArgs) {}const invitationEmail = await resend.emails.send({- from: "Carbon <[email protected]>",+ from: `Carbon <no-reply@${RESEND_DOMAIN}>`,to: user.data.email,subject: `You have been invited to join ${company.data?.name} on Carbon`,headers: {diff --git a/apps/erp/app/routes/x+/users+/suppliers.new.tsx b/apps/erp/app/routes/x+/users+/suppliers.new.tsxindex 0a590edde2..81bfbf7f83 100644--- a/apps/erp/app/routes/x+/users+/suppliers.new.tsx+++ b/apps/erp/app/routes/x+/users+/suppliers.new.tsx@@ -1,4 +1,4 @@-import { assertIsPost, getAppUrl, success } from "@carbon/auth";+import { assertIsPost, getAppUrl, RESEND_DOMAIN, success } from "@carbon/auth";import { requirePermissions } from "@carbon/auth/auth.server";import { flash } from "@carbon/auth/session.server";import { InviteEmail } from "@carbon/documents/email";@@ -9,8 +9,8 @@ import type { ActionFunctionArgs } from "@vercel/remix";import { redirect } from "@vercel/remix";import { nanoid } from "nanoid";import {- CreateSupplierModal,createSupplierAccountValidator,+ CreateSupplierModal,} from "~/modules/users";import { createSupplierAccount } from "~/modules/users/users.server";import { path } from "~/utils/path";@@ -62,7 +62,7 @@ export async function action({ request }: ActionFunctionArgs) {}const invitationEmail = await resend.emails.send({- from: "Carbon <[email protected]>",+ from: `Carbon <no-reply@${RESEND_DOMAIN}>`,to: result.email,subject: `You have been invited to join ${company.data?.name} on Carbon`,headers: {diff --git a/packages/auth/src/config/env.ts b/packages/auth/src/config/env.tsindex a9263ccb8f..7bb7581f8f 100644--- a/packages/auth/src/config/env.ts+++ b/packages/auth/src/config/env.ts@@ -105,6 +105,10 @@ export const NOVU_APPLICATION_ID = getEnv("NOVU_APPLICATION_ID", {isSecret: false,});export const NOVU_SECRET_KEY = getEnv("NOVU_SECRET_KEY");+export const RESEND_DOMAIN =+ getEnv("RESEND_DOMAIN", {+ isRequired: false,+ }) ?? "carbon.ms";export const SLACK_BOT_TOKEN = getEnv("SLACK_BOT_TOKEN", {isRequired: false,});diff --git a/packages/auth/src/services/verification.server.ts b/packages/auth/src/services/verification.server.tsindex b392553074..e98fa8ad30 100644--- a/packages/auth/src/services/verification.server.ts+++ b/packages/auth/src/services/verification.server.ts@@ -2,6 +2,7 @@ import { VerificationEmail } from "@carbon/documents/email";import { redis } from "@carbon/kv";import { resend } from "@carbon/lib/resend.server";import { render } from "@react-email/components";+import { RESEND_DOMAIN } from "../config/env";export async function sendVerificationCode(email: string) {try {@@ -24,7 +25,7 @@ export async function sendVerificationCode(email: string) {);const result = await resend.emails.send({- from: "Carbon <[email protected]>",+ from: `Carbon <no-reply@${RESEND_DOMAIN}>`,to: email,subject: "Verify your email address",html,diff --git a/packages/jobs/trigger/onboard.ts b/packages/jobs/trigger/onboard.tsindex f6bba0af41..9c7d0527c1 100644--- a/packages/jobs/trigger/onboard.ts+++ b/packages/jobs/trigger/onboard.ts@@ -1,4 +1,4 @@-import { getCarbonServiceRole } from "@carbon/auth";+import { getCarbonServiceRole, RESEND_DOMAIN } from "@carbon/auth";import type { Database } from "@carbon/database";import { GetStartedEmail, WelcomeEmail } from "@carbon/documents/email";import { resend } from "@carbon/lib/resend.server";@@ -28,6 +28,12 @@ export const onboardTask = task({throw new Error(user.error.message);}+ const from = `Brad from Carbon <${+ RESEND_DOMAIN === "carbon.ms"+ ? "[email protected]"+ : `no-reply@${RESEND_DOMAIN}`+ }>`;+await resend.contacts.create({email: user.data.email,firstName: user.data.firstName,@@ -43,7 +49,7 @@ export const onboardTask = task({if (sendOnboardingEmail) {await resend.emails.send({- from: "Brad from Carbon <[email protected]>",+ from,to: user.data.email,subject: `Welcome to Carbon`,html: await render(@@ -58,7 +64,7 @@ export const onboardTask = task({if (sendOnboardingEmail) {await resend.emails.send({- from: "Brad from Carbon <[email protected]>",+ from,to: user.data.email,subject: `Get the most out of Carbon`,html: render(diff --git a/packages/jobs/trigger/user-admin.ts b/packages/jobs/trigger/user-admin.tsindex a0b2fb5df9..bead6422c6 100644--- a/packages/jobs/trigger/user-admin.ts+++ b/packages/jobs/trigger/user-admin.ts@@ -2,7 +2,12 @@ import { task } from "@trigger.dev/sdk/v3";import { z } from "zod";import type { Result } from "@carbon/auth";-import { CarbonEdition, getAppUrl, getCarbonServiceRole } from "@carbon/auth";+import {+ CarbonEdition,+ getAppUrl,+ getCarbonServiceRole,+ RESEND_DOMAIN,+} from "@carbon/auth";import { deactivateUser } from "@carbon/auth/users.server";import { InviteEmail } from "@carbon/documents/email";import { resend } from "@carbon/lib/resend.server";@@ -82,7 +87,7 @@ export const userAdminTask = task({}const invitationEmail = await resend.emails.send({- from: "Carbon <[email protected]>",+ from: `Carbon <no-reply@${RESEND_DOMAIN}>`,to: user.data.email,subject: `You have been invited to join ${company.data?.name} on Carbon`,headers: {