Skip to content

armitage-labs/creem

Repository files navigation

CREEM

The Merchant of Record for modern software teams

Sell software globally. We handle taxes, compliance, payments, and payouts.

Website · Docs · API Reference · Discord · Twitter

npm version License Discord


What is CREEM?

CREEM is a Merchant of Record (MoR) that lets software companies sell globally without worrying about sales tax, VAT, compliance, or payment infrastructure. We act as the legal seller of your software, so you can focus on building.

What we handle for you:

  • 🌍 Global tax compliance across 140+ countries (US state taxes, EU VAT, UK VAT, and more)
  • 💳 Payment processing with optimized checkout experiences
  • 🔄 Subscription management with trials, upgrades, downgrades, and dunning
  • 💸 Automated payouts to your bank account
  • 📊 Revenue analytics and reporting
  • 🛡️ Fraud protection and chargeback handling
  • 🏪 Storefronts for no-code product pages
  • 🤝 Affiliate programs with built-in tracking and payouts

Repository Structure

This is a pnpm monorepo containing all of CREEM's open-source packages, SDKs, and documentation.

creem/
├── packages/
│   ├── creem-sdk/        # Official TypeScript SDK (auto-generated via Speakeasy)
│   ├── creem-io/         # Lightweight TypeScript wrapper (framework-agnostic)
│   ├── nextjs/           # Next.js integration (@creem_io/nextjs)
│   ├── better-auth/      # Better Auth plugin (@creem_io/better-auth)
│   ├── convex/           # Convex integration (@creem_io/convex)
│   ├── webhook-types/    # Shared webhook type definitions
│   └── docs/             # Documentation site (Mintlify)
├── .github/workflows/    # CI, release, and SDK generation pipelines
├── turbo.json            # Turborepo build configuration
└── pnpm-workspace.yaml   # Workspace package definitions

Packages

Package npm Description
creem npm Official TypeScript SDK with full API coverage, MCP server, and standalone functions
creem_io npm Lightweight wrapper SDK, framework-agnostic, zero dependencies
@creem_io/nextjs npm Next.js integration with React components and webhook handlers
@creem_io/better-auth npm Better Auth plugin for payments and subscription management
@creem_io/convex npm Convex billing component with backend helpers and React/Svelte widgets
@creem_io/webhook-types npm Shared TypeScript types for webhook events

Quick Start

1. Install

# Official SDK (recommended for most use cases)
npm install creem

# Or the lightweight wrapper
npm install creem_io

# Next.js integration
npm install @creem_io/nextjs

# Better Auth plugin
npm install @creem_io/better-auth

# Convex integration
npm install @creem_io/convex

2. Create a Checkout

import { Creem } from "creem";

const creem = new Creem({
  apiKey: process.env.CREEM_API_KEY,
});

const checkout = await creem.checkouts.create({
  productId: "prod_123",
  successUrl: "https://yourapp.com/success",
});

// Redirect your customer to checkout.checkoutUrl

3. Handle Webhooks

import { Creem } from "creem_io";

const creem = new Creem({ apiKey: process.env.CREEM_API_KEY });

// Verify and parse webhook payload
const event = creem.webhooks.verify(rawBody, signature, webhookSecret);

switch (event.eventType) {
  case "checkout.completed":
    // Provision access
    break;
  case "subscription.canceled":
    // Revoke access
    break;
}

Next.js Example

// app/api/checkout/route.ts
import { createCheckout } from "@creem_io/nextjs/server";

export async function POST() {
  const checkout = await createCheckout({
    productId: "prod_123",
    successUrl: "/success",
  });
  return Response.redirect(checkout.checkoutUrl);
}
// app/api/webhook/creem/route.ts
import { handleWebhook } from "@creem_io/nextjs/server";

export const POST = handleWebhook({
  onCheckoutCompleted: async (event) => {
    // Provision access for the customer
  },
  onSubscriptionCanceled: async (event) => {
    // Revoke access
  },
});

Documentation

The full documentation lives in packages/docs and is deployed at docs.creem.io.

Built with Mintlify, it covers:

  • Getting Started guides for new merchants
  • API Reference with interactive examples
  • SDK guides for every package in this repo
  • Webhook events and payload schemas
  • MoR explainers on tax compliance and payouts

Running Docs Locally

# Install Mintlify CLI
npm i -g mintlify

# Start local dev server
cd packages/docs
mintlify dev

AI-Friendly Docs

CREEM provides llms.txt and llms-full.txt for AI agents and LLMs to consume structured documentation. We also ship Skill Files for agent frameworks that support them.

Development

Prerequisites

Setup

# Clone the repo
git clone https://github.com/armitage-labs/creem.git
cd creem

# Install dependencies
pnpm install

# Build all packages
pnpm build

# Run tests
pnpm test

# Type check
pnpm typecheck

Monorepo Commands

This repo uses Turborepo for orchestrating builds across packages.

# Build everything
pnpm build

# Build a specific package
pnpm turbo build --filter=creem

# Run tests for a specific package
pnpm turbo test --filter=@creem_io/better-auth

# Format code
pnpm format

# Check formatting
pnpm format:check

Changesets

We use Changesets for versioning and publishing.

# Create a changeset after making changes
pnpm changeset

# Version packages (CI does this automatically)
pnpm version-packages

# Publish (CI does this automatically)
pnpm release

Architecture

┌─────────────────────────────────────────────────┐
│                  Your Application                │
├──────────┬──────────┬──────────┬────────────────┤
│  creem   │ creem_io │  nextjs  │  better-auth   │
│  (SDK)   │(wrapper) │  (React) │   (plugin)     │
├──────────┴──────────┴──────────┴────────────────┤
│              @creem_io/webhook-types              │
├──────────────────────────────────────────────────┤
│                 CREEM API (v1)                    │
│           https://api.creem.io/v1                 │
└──────────────────────────────────────────────────┘
  • creem (SDK): Auto-generated from the OpenAPI spec via Speakeasy. Full API coverage, retry logic, MCP server support. This is the recommended SDK for most use cases.
  • creem_io (wrapper): Hand-written lightweight SDK with zero dependencies. Framework-agnostic, works anywhere Node.js runs. Ideal for minimal setups or when you want full control.
  • @creem_io/nextjs: React components and server utilities built specifically for Next.js App Router. Drop-in checkout buttons, webhook route handlers, and subscription access helpers.
  • @creem_io/better-auth: Plugin for the Better Auth framework. Syncs CREEM customers with your auth users, manages subscriptions in your database, and handles webhooks automatically.
  • @creem_io/webhook-types: Shared TypeScript type definitions for all CREEM webhook events. Used internally by other packages.

CI/CD

Workflow Trigger Description
CI Push/PR to main Builds, typechecks, tests, and lints changed packages
Release Push to main Creates release PRs via Changesets, publishes to npm
SDK Generation Daily / manual Regenerates the creem SDK from the latest OpenAPI spec
Docs Deploy Changes to packages/docs Deploys documentation to docs.creem.io via Mintlify

Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a branch for your feature or fix
    git checkout -b feat/my-feature
  3. Make your changes and add tests where appropriate
  4. Create a changeset if your change affects a published package
    pnpm changeset
  5. Run checks to make sure everything passes
    pnpm build && pnpm test && pnpm typecheck
  6. Open a Pull Request against main

Contribution Guidelines

  • Follow the existing code style (Prettier is configured)
  • Write tests for new functionality
  • Keep PRs focused on a single change
  • Update documentation for user-facing changes
  • Use conventional commits for commit messages

Package-Specific Notes

  • creem (SDK): This package is auto-generated. Don't edit files in src/ directly. Instead, update the OpenAPI spec or Speakeasy configuration.
  • packages/docs: Documentation uses Mintlify MDX format. API reference pages are generated from openapi.json. See the docs README for details.
  • creem_io: When adding new API resources, follow the existing pattern in resources/ and add corresponding types in types/.

Community

License

This project is licensed under the MIT License.


CREEM
Built with 🍑 by the CREEM team

About

Creem repo for all integrations

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors