Skip to content

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.

docs: open source

Brad Barbin2266fafb27ae
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
new file mode 100644
index 0000000000..4a8f01b650
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/bug_report.md
@@ -0,0 +1,39 @@
+---
+name: Bug report
+about: Report any issues with the platform
+title: ""
+labels: ["🐛 bug"]
+assignees: ""
+---
+
+Found a bug? Please fill out the sections below. 👍
+
+### Issue Summary
+
+A summary of the issue. This needs to be a clear detailed-rich summary.
+
+### Steps to Reproduce
+
+1. (for example) Went to ...
+2. Clicked on...
+3. ...
+
+Any other relevant information. For example, why do you consider this a bug and what did you expect to happen instead?
+
+### Actual Results
+
+- What's happening right now that is different from what is expected
+
+### Expected Results
+
+- This is an ideal result that the system should get after the tests are performed
+
+### Technical details
+
+- Browser version, screen recording, console logs, network requests: You can make a recording with [Bird Eats Bug](https://birdeatsbug.com/).
+- Node.js version
+- Anything else that you think could be an issue.
+
+### Evidence
+
+- How was this tested? This is quite mandatory in terms of bugs. Providing evidence of your testing with screenshots or/and videos is an amazing way to prove the bug and a troubleshooting chance to find the solution.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
new file mode 100644
index 0000000000..75648d0357
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/feature_request.md
@@ -0,0 +1,58 @@
+---
+name: Feature request
+about: Suggest a feature or idea
+title: ""
+labels: ["✨ feature", "🚨 needs approval"]
+assignees: ""
+---
+
+### Is your proposal related to a problem?
+
+<!--
+ Provide a clear and concise description of what the problem is.
+ For example, "I'm always frustrated when..."
+-->
+
+(Write your answer here.)
+
+### Describe the solution you'd like
+
+<!--
+ Provide a clear and concise description of what you want to happen.
+-->
+
+(Describe your proposed solution here.)
+
+### Describe alternatives you've considered
+
+<!--
+ Let us know about other solutions you've tried or researched.
+-->
+
+(Write your answer here.)
+
+### Additional context
+
+<!--
+ Is there anything else you can add about the proposal?
+ You might want to link to related issues here, if you haven't already.
+-->
+
+(Write your answer here.)
+
+### Requirement/Document
+
+<!--
+ Is there any type of document that could support that feature?
+-->
+
+(Share it here.)
+
+---
+
+##### House rules
+
+- If this issue has a `🚨 needs approval` label, don't start coding yet. Wait until a core member approves feature request by removing this label, then you can start coding.
+ - For clarity: Non-core member issues automatically get the `🚨 needs approval` label.
+ - Your feature ideas are invaluable to us! However, they undergo review to ensure alignment with the product's direction.
+ - Follow Best Practices lined out in our [Contributor Docs](https://github.com/crbnos/carbon/blob/main/CONTRIBUTING.md)
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 0000000000..b214d29487
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,42 @@
+## What does this PR do?
+
+<!-- Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context. List any dependencies that are required for this change. -->
+
+- Fixes #XXXX (GitHub issue number)
+
+## Visual Demo (For contributors especially)
+
+A visual demonstration is strongly recommended, for both the original and new change **(video / image - any one)**.
+
+#### Video Demo (if applicable):
+
+- Show screen recordings of the issue or feature.
+- Demonstrate how to reproduce the issue, the behavior before and after the change.
+
+#### Image Demo (if applicable):
+
+- Add side-by-side screenshots of the original and updated change.
+- Highlight any significant change(s).
+
+## Mandatory Tasks (DO NOT REMOVE)
+
+- [ ] I have self-reviewed the code (A decent size PR without self-review might be rejected).
+- [ ] I confirm automated tests are in place that prove my fix is effective or that my feature works.
+
+## How should this be tested?
+
+<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Write details that help to start the tests -->
+
+- Are there environment variables that should be set?
+- What are the minimal test data to have?
+- What is expected (happy path) to have (input and output)?
+- Any other important info that could help to test that PR
+
+## Checklist
+
+<!-- Remove bullet points below that don't apply to you -->
+
+- I haven't read the [contributing guide](https://github.com/crbnos/carbon/blob/main/CONTRIBUTING.md)
+- My code doesn't follow the style guidelines of this project
+- I haven't commented my code, particularly in hard-to-understand areas
+- I haven't checked if my changes generate no new warnings
diff --git a/CLAUDE.md b/CLAUDE.md
index a1b09a8e18..6093968339 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -2,8 +2,8 @@ Your environment:
- This project is a manufacturing system called Carbon. It contains apps for ERP, MES, and a training app called university.
-- Any time you want to know about the project, first use the Task tool to query the files in claude/cache/. Do this constantly, literally any time you want to know anything. Don't check the code first, ALWAYS check the cache.
-- There are some specific workflows I have defined in claude/workflows/. ALWAYS use the Task tool to search for the relevant workflow file when told to do a workflow, then read and follow it.
+- Any time you want to know about the project, first use the Task tool to query the files in llm/cache/. Do this constantly, literally any time you want to know anything. Don't check the code first, ALWAYS check the cache.
+- There are some specific workflows I have defined in llm/workflows/. ALWAYS use the Task tool to search for the relevant workflow file when told to do a workflow, then read and follow it.
- ALWAYS prefer your default tools over resorting to the Bash tool. You historically have a bad habit of doing `find ... | xargs ... grep` where you could just use your Grep tool. Avoid this! Just use the simple Grep tool.
Rules for using the Grep tool:
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000000..a5f582e81a
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,134 @@
+# Contributing to Carbon
+
+Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
+
+## House Rules (for PRs and Issues)
+
+### 👥 Prevent Work Duplication
+
+Before submitting a new issue or PR, check if it already exists in the [Issues](https://github.com/crbnos/carbon/issues) or [Pull Requests](https://github.com/crbnos/carbon/pulls).
+
+### ✅ Work Only on Approved Issues
+
+For feature requests, please wait for a core team member to approve and remove the `🚨 needs approval` label before you start coding or submitting a PR.
+
+For bugs, security, performance, documentation, etc., you can start coding immediately—even if the `🚨 needs approval` label is present.
+
+We highly value new feature ideas, but to maintain consistency in the product direction, they must go through a review and approval process.
+
+### 🚫 Don’t Just Drop a Link
+
+Avoid posting third-party links (e.g., Slack threads or Linear tickets) without context. A GitHub issue or PR should stand on its own—reviewers shouldn’t have to chase information across multiple tools to understand the context.
+
+### 👀 Think Like a Reviewer
+
+Put yourself in the reviewer’s shoes. What would you want to know if reading this for the first time? Are there key decisions, goals, or constraints that need clarification? Does the PR assume knowledge that isn’t obvious? Are there related issues or previous PRs that should be linked?
+
+### 🧵 Bring in Context from Private Channels
+
+If the task originated from a private conversation (e.g., Slack), take a moment to extract the relevant details and include them in the GitHub issue or PR. Avoid sharing sensitive information, but make sure important reasoning is captured.
+
+> Example:
+> “A user requested feature X to solve problem Y. I considered approaches A, B, and C, but chose C for the following reasons…”
+
+### 📚 Treat It Like Documentation
+
+GitHub is a shared source of truth. Every issue and PR contributes to the long-term understanding of the codebase. Write clearly enough that someone—possibly you—can revisit it months later and still understand what happened and why.
+
+### ✅ Summarize Your PR at the Top
+
+Even if the code changes are minor or self-explanatory, a short written summary helps reviewers quickly understand the intent. You can use GitHub Copilot’s auto-summarize feature, but make sure to verify it for accuracy and relevance.
+
+### 🔗 Use GitHub Keywords to Auto-Link Issues
+
+Use phrases like “Closes #123” or “Fixes #456” in your PR descriptions. This automatically links your PR to the related issue and closes it once merged—keeping everything traceable and organized.
+
+### 🧪 Mention What Was Tested (and How)
+
+Explain how you validated your changes. It doesn’t need to be exhaustive—just enough to give reviewers confidence that things were tested and work as expected.
+
+> Example:
+> “Tested locally with mock data and confirmed the flow works on staging.”
+
+### 🧠 Assume Future-You Won’t Remember
+
+Write with the future in mind. If there are trade-offs, edge cases, or temporary workarounds, document them clearly so they don’t get lost or misinterpreted later.
+
+## Priorities
+
+<table>
+ <tr>
+ <td><strong>Type of Issue</strong></td>
+ <td><strong>Priority</strong></td>
+ </tr>
+ <tr>
+ <td>Minor improvements, non-core feature requests</td>
+ <td>
+ <a href="https://github.com/crbnos/carbon/issues?q=is:issue+is:open+sort:updated-desc+label:%22Low+priority%22">
+ <img src="https://img.shields.io/badge/-Low%20Priority-green">
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td>Confusing UX (but still functional)</td>
+ <td>
+ <a href="https://github.com/crbnos/carbon/issues?q=is:issue+is:open+sort:updated-desc+label:%22Medium+priority%22">
+ <img src="https://img.shields.io/badge/-Medium%20Priority-yellow">
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td>Core Features (Booking page, availability, timezone calculation)</td>
+ <td>
+ <a href="https://github.com/crbnos/carbon/issues?q=is:issue+is:open+sort:updated-desc+label:%22High+priority%22">
+ <img src="https://img.shields.io/badge/-High%20Priority-orange">
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <td>Core Bugs (Login, Booking page, Emails not working)</td>
+ <td>
+ <a href="https://github.com/crbnos/carbon/issues?q=is:issue+is:open+sort:updated-desc+label:Urgent">
+ <img src="https://img.shields.io/badge/-Urgent-red">
+ </a>
+ </td>
+ </tr>
+</table>
+
+## Developing
+
+[See README](https://github.com/crbnos/carbon#development)
+
+## Building
+
+You can build the project with:
+
+```bash
+npm run build
+```
+
+Please ensure that you can make a full production build before pushing code.
+
+## Testing
+
+More info on how to add new tests coming soon.
+
+#### Resolving Issues
+
+## Linting
+
+To check the formatting of your code:
+
+```sh
+npm run lint
+```
+
+If you get errors, be sure to fix them before committing.
+
+## Making a Pull Request
+
+- Be sure to [check the "Allow edits from maintainers" option](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork) when creating your PR. (This option isn't available if you're [contributing from a fork belonging to an organization](https://github.com/orgs/community/discussions/5634))
+- If your PR refers to or fixes an issue, add `refs #XXX` or `fixes #XXX` to the PR description. Replace `XXX` with the respective issue number. See more about [linking a pull request to an issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).
+- Fill out the PR template accordingly.
+- Review the [App Contribution Guidelines](./packages/app-store/CONTRIBUTING.md) when building integrations.
+- Lastly, make sure to keep your branches updated (e.g., click the `Update branch` button on the GitHub PR page).
diff --git a/SECURITY.md b/SECURITY.md
new file mode 100644
index 0000000000..f2cb5da7e8
--- /dev/null
+++ b/SECURITY.md
@@ -0,0 +1,57 @@
+# Security
+
+
+Based on [https://supabase.com/.well-known/security.txt](https://supabase.com/.well-known/security.txt)
+
+At Carbon, we consider the security of our systems a top priority. But no
+matter how much effort we put into system security, there can still be
+vulnerabilities present.
+
+If you discover a vulnerability, we would like to know about it so we can take
+steps to address it as quickly as possible. We would like to ask you to help us
+better protect our clients and our systems.
+
+## Out of scope vulnerabilities
+
+- Clickjacking on pages with no sensitive actions.
+- Unauthenticated/logout/login CSRF.
+- Attacks requiring MITM or physical access to a user's device.
+- Any activity that could lead to the disruption of our service (DoS).
+- Content spoofing and text injection issues without showing an attack
+ vector/without being able to modify HTML/CSS.
+- Email spoofing
+- Missing DNSSEC, CAA, CSP headers
+- Lack of Secure or HTTP only flag on non-sensitive cookies
+- Deadlinks
+
+## Please do the following
+
+- E-mail your findings to [[email protected]](mailto:[email protected]).
+- Do not run automated scanners on our infrastructure or dashboard. If you wish
+ to do this, contact us and we will set up a sandbox for you.
+- Do not take advantage of the vulnerability or problem you have discovered,
+ for example by downloading more data than necessary to demonstrate the
+ vulnerability or deleting or modifying other people's data,
+- Do not reveal the problem to others until it has been resolved,
+- Do not use attacks on physical security, social engineering, distributed
+ denial of service, spam or applications of third parties,
+- Do provide sufficient information to reproduce the problem, so we will be
+ able to resolve it as quickly as possible. Usually, the IP address or the URL
+ of the affected system and a description of the vulnerability will be
+ sufficient, but complex vulnerabilities may require further explanation.
+
+## What we promise
+
+- We will respond to your report within 3 business days with our evaluation of
+ the report and an expected resolution date,
+- If you have followed the instructions above, we will not take any legal
+ action against you in regard to the report,
+- We will handle your report with strict confidentiality, and not pass on your
+ personal details to third parties without your permission,
+- We will keep you informed of the progress towards resolving the problem,
+- In the public information concerning the problem reported, we will give your
+ name as the discoverer of the problem (unless you desire otherwise), and
+- We strive to resolve all problems as quickly as possible, and we would like
+ to play an active role in the ultimate publication on the problem after it
+ is resolved.
diff --git a/apps/mes/app/routes/x+/assigned.tsx b/apps/mes/app/routes/x+/assigned.tsx
index abc15953a8..2a03094fe5 100644
--- a/apps/mes/app/routes/x+/assigned.tsx
+++ b/apps/mes/app/routes/x+/assigned.tsx
@@ -22,7 +22,7 @@ import type { Operation } from "~/services/types";
import { makeDurations } from "~/utils/durations";
export async function loader({ request, params }: LoaderFunctionArgs) {
- const { client, companyId, userId } = await requirePermissions(request, {});
+ const { companyId, userId } = await requirePermissions(request, {});
const serviceRole = await getCarbonServiceRole();
diff --git a/commercial/LICENSE b/commercial/LICENSE
new file mode 100644
index 0000000000..8bf2c28564
--- /dev/null
+++ b/commercial/LICENSE
@@ -0,0 +1,45 @@
+Copyright © 2025, Carbon Manufacturing Systems Corp.
+
+The Carbon Commercial License (the “Commercial License”)
+
+With regard to the Carbon Software:
+
+This software and associated documentation files (the "Software") may only be
+used in production, if you (and any entity that you represent) have agreed to,
+and are in compliance with, the Carbon Subscription Terms available
+at https://carbon.ms/terms, or other agreements governing
+the use of the Software, as mutually agreed by you and Carbon Manufacturing Systems Corp. ("Carbon"),
+and otherwise have a valid Carbon Commercial License ("Commercial License")
+for the correct number of hosts as defined in the "Commercial Terms ("Hosts").
+
+Subject to the foregoing sentence,
+you are free to modify this Software and publish patches to the Software. You agree
+that Carbon and/or its licensors (as applicable) retain all right, title and interest in
+and to all such modifications and/or patches, and all such modifications and/or
+patches may only be used, copied, modified, displayed, distributed, or otherwise
+exploited with a valid Commercial License for the correct number of hosts.
+Notwithstanding the foregoing, you may copy and modify the Software for development
+and testing purposes, without requiring a subscription. You agree that Carbon and/or
+its licensors (as applicable) retain all right, title and interest in and to all such
+modifications. You are not granted any other rights beyond what is expressly stated herein.
+Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense,
+and/or sell the Software.
+
+This Commercial License applies only to the part of this Software that is not distributed under
+the AGPLv3 license. Any part of this Software distributed under the MIT license or which
+is served client-side as an image, font, cascading stylesheet (CSS), file which produces
+or is compiled, arranged, augmented, or combined into client-side JavaScript, in whole or
+in part, is copyrighted under the AGPLv3 license. The full text of this Commercial License shall
+be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
+
+For all third party components incorporated into the Carbon Software, those
+components are licensed under the original license provided by the owner of the
+applicable component.
diff --git a/claude/cache/authentication-system.md b/llm/cache/authentication-system.md
similarity index 100%
rename from claude/cache/authentication-system.md
rename to llm/cache/authentication-system.md
diff --git a/llm/cache/billing-system.md b/llm/cache/billing-system.md
new file mode 100644
index 0000000000..5330b72d2f
--- /dev/null
+++ b/llm/cache/billing-system.md
@@ -0,0 +1,135 @@
+# Billing System in Carbon
+
+## Overview
+
+Carbon implements a comprehensive billing system integrated with Stripe for subscription management. The system supports different product editions, subscription plans, and usage-based pricing.
+
+## Editions
+
+Carbon has three editions defined in `packages/utils/src/types.ts`:
+
+1. **Cloud** - SaaS version with Stripe billing integration
+2. **Enterprise** - Self-hosted enterprise version
+3. **Community** - Free community version
+
+## Plans
+
+The system supports multiple subscription plans defined in the database:
+
+### Public Plans
+- **STARTER** (`price_1RgUYhFV6ecOa0XvD37hQOhK`) - Cloud Starter plan with user-based pricing
+- **BUSINESS** (`price_1RjLE1FV6ecOa0Xv0kmTHWPu`) - Cloud Business plan with user-based pricing
+
+### Private Plans (Design Partners)
+- **PARTNER-400** (`price_1RgXMSFV6ecOa0XvLQtlhQr0`) - Flat fee pricing
+- **PARTNER-300** (`price_1Rj20jFV6ecOa0Xvk4WV6b7l`) - Flat fee pricing
+- **PARTNER-500** (`price_1Rj21OFV6ecOa0XvCTdELYdv`) - Flat fee pricing
+
+### Plan Features
+Each plan includes:
+- `tasksLimit` - Maximum number of tasks (default: 10,000)
+- `aiTokensLimit` - Maximum AI tokens (default: 1,000,000)
+- `stripeTrialPeriodDays` - Trial period length (default: 7-30 days)
+- `userBasedPricing` - Whether pricing is per-user or flat fee
+
+## Database Schema
+
+### Core Tables
+
+**plan** table:
+- Stores plan definitions with Stripe price IDs
+- Includes limits for tasks, AI tokens, and trial periods
+- Supports both user-based and flat fee pricing models
+
+**companyPlan** table:
+- Links companies to their active plans
+- Stores Stripe customer and subscription IDs
+- Tracks subscription status and dates
+- Includes usage limits inherited from the plan
+
+**companyUsage** table:
+- Tracks actual usage of users, tasks, and AI tokens
+- Includes reset date for usage periods
+- Used for enforcing plan limits
+
+## Stripe Integration
+
+Located in `/packages/stripe/`, the integration provides:
+
+### Key Features
+1. **Customer Management**
+ - Automatic customer creation during checkout
+ - Customer ID stored in Redis KV store
+ - Metadata linking to userId and companyId
+
+2. **Subscription Management**
+ - Checkout session creation with multiple payment methods
+ - Subscription status syncing via webhooks
+ - Automatic quantity updates for user-based pricing
+
+3. **Billing Portal**
+ - Self-service subscription management
+ - Payment method updates
+ - Plan changes and cancellations
+
+### Webhook Events
+The system handles various Stripe webhook events:
+- `checkout.session.completed` - Triggers onboarding flow
+- `customer.subscription.*` - Updates subscription status
+- `invoice.*` - Payment processing events
+
+### Environment Variables
+- `STRIPE_SECRET_KEY` - Stripe API key
+- `STRIPE_WEBHOOK_SECRET` - Webhook signature verification
+- `STRIPE_BYPASS_COMPANY_IDS` - Comma-separated list of companies to bypass billing
+
+## Usage Tracking
+
+### User-Based Pricing
+For plans with `userBasedPricing = true`:
+- Counts active users per company (excluding @carbonos.dev emails)
+- Automatically updates Stripe subscription quantity
+- Triggered when users are added/removed from companies
+
+### Usage Limits
+The system tracks:
+- Number of active users
+- Task usage
+- AI token consumption
+
+## Frontend Integration
+
+### Hooks
+- `usePlan()` - Returns the current company's plan
+- `useEdition()` - Returns the Carbon edition (Cloud/Enterprise/Community)
+
+### Routes
+- `/api/webhook/stripe` - Stripe webhook endpoint
+- Checkout flow redirects to Stripe hosted checkout
+- Billing portal accessible from company settings
+
+## Security Features
+
+1. **Webhook Verification** - Validates Stripe signatures
+2. **Idempotency** - Prevents duplicate customer creation
+3. **Role-Based Access** - Plans and usage data protected by RLS
+4. **Service Role Operations** - Admin operations use service role
+
+## Bypass Mechanism
+
+For development and special cases:
+- Companies listed in `STRIPE_BYPASS_COMPANY_IDS` environment variable
+- Receive mock "Partner" plan with unlimited usage
+- No actual Stripe integration required
+
+## Integration with Authentication
+
+The billing system integrates with the authentication flow:
+1. User signs up and selects a plan
+2. Redirected to Stripe checkout
+3. Upon successful payment, webhook triggers:
+ - Company plan creation
+ - Onboarding email sequence
+ - User activation
+
+This billing system provides a complete solution for SaaS monetization while maintaining flexibility for enterprise and community editions.
\ No newline at end of file
diff --git a/claude/cache/coding-conventions.md b/llm/cache/coding-conventions.md
similarity index 100%
rename from claude/cache/coding-conventions.md
rename to llm/cache/coding-conventions.md
diff --git a/claude/cache/database-migration-patterns.md b/llm/cache/database-migration-patterns.md
similarity index 100%
rename from claude/cache/database-migration-patterns.md
rename to llm/cache/database-migration-patterns.md
diff --git a/claude/cache/database-patterns.md b/llm/cache/database-patterns.md
similarity index 100%
rename from claude/cache/database-patterns.md
rename to llm/cache/database-patterns.md
diff --git a/claude/cache/environment-configuration.md b/llm/cache/environment-configuration.md
similarity index 100%
rename from claude/cache/environment-configuration.md
rename to llm/cache/environment-configuration.md
diff --git a/claude/cache/mrp-system.md b/llm/cache/mrp-system.md
similarity index 100%
rename from claude/cache/mrp-system.md
rename to llm/cache/mrp-system.md
diff --git a/claude/cache/project-overview.md b/llm/cache/project-overview.md
similarity index 100%
rename from claude/cache/project-overview.md
rename to llm/cache/project-overview.md
diff --git a/claude/settings.local.json b/llm/settings.local.json
similarity index 100%
rename from claude/settings.local.json
rename to llm/settings.local.json
diff --git a/claude/workflows/database-migration.md b/llm/workflows/database-migration.md
similarity index 100%
rename from claude/workflows/database-migration.md
rename to llm/workflows/database-migration.md
diff --git a/claude/workflows/edge-function.md b/llm/workflows/edge-function.md
similarity index 100%
rename from claude/workflows/edge-function.md
rename to llm/workflows/edge-function.md
diff --git a/package-lock.json b/package-lock.json
index bce8b4d91c..0836658556 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -36007,6 +36007,7 @@
"@carbon/database": "*",
"@carbon/jobs": "*",
"@carbon/kv": "*",
+ "@carbon/lib": "*",
"@supabase/supabase-js": "^2.40.0",
"@trigger.dev/sdk": "3.3.12",
"stripe": "^18.3.0"
diff --git a/packages/stripe/.eslintrc.js b/packages/stripe/.eslintrc.cjs
similarity index 100%
rename from packages/stripe/.eslintrc.js
rename to packages/stripe/.eslintrc.cjs
diff --git a/packages/stripe/package.json b/packages/stripe/package.json
index 2606f7d7c3..e59aeb0629 100644
--- a/packages/stripe/package.json
+++ b/packages/stripe/package.json
@@ -5,10 +5,12 @@
"@carbon/database": "*",
"@carbon/jobs": "*",
"@carbon/kv": "*",
+ "@carbon/lib": "*",
"@supabase/supabase-js": "^2.40.0",
"@trigger.dev/sdk": "3.3.12",
"stripe": "^18.3.0"
},
+ "type": "module",
"devDependencies": {
"@carbon/logger": "*",
"@carbon/tsconfig": "*",
diff --git a/packages/stripe/src/stripe.server.ts b/packages/stripe/src/stripe.server.ts
index cc43540c9f..c4876ea9ab 100644
--- a/packages/stripe/src/stripe.server.ts
+++ b/packages/stripe/src/stripe.server.ts
@@ -6,6 +6,7 @@ import {
} from "@carbon/auth";
import type { Database } from "@carbon/database";
import { redis } from "@carbon/kv";
+import { getSlackClient } from "@carbon/lib/slack.server";
import { Edition, Plan } from "@carbon/utils";
import type { SupabaseClient } from "@supabase/supabase-js";
import { tasks } from "@trigger.dev/sdk/v3";
@@ -321,6 +322,7 @@ export async function processStripeEvent({
const eventType = event.type;
if (eventType === "checkout.session.completed") {
+ const slackClient = getSlackClient();
const data = event.data.object as Stripe.Checkout.Session;
const { customer } = data;
@@ -346,6 +348,24 @@ export async function processStripeEvent({
companyId,
userId,
}),
+ slackClient.sendMessage({
+ channel: "#sales",
+ text: "New Customer 🔔",
+ blocks: [
+ {
+ type: "section",
+ text: {
+ type: "mrkdwn",
+ text:
+ `*New Signup* 🔔\n\n` +
+ `*Contact Information*\n` +
+ `• Company: ${data.customer_details?.name}\n\n` +
+ `• Email: ${data.customer_details?.email}\n\n` +
+ `• Plan: $${data.line_items?.data[0]?.description}\n\n`,
+ },
+ },
+ ],
+ }),
]);
} catch (error) {
console.error("Error processing webhook:", error);