Skip to main content

Install

npm install @stellartools/uploadthing-adapter uploadthing

Usage

import { shield } from "@stellartools/uploadthing-adapter";

const f = shield({
  apiKey: process.env.STELLAR_TOOLS_API_KEY!,
  productId: "prod_xxx",
});

export const fileRouter = {
  imageUploader: f({ image: { maxFileSize: "8MB" } })
    .onUploadComplete(async ({ metadata, file }) => {
      console.log("Upload complete for:", metadata.customerId);
      console.log("File URL:", file.url);
    }),
};
Each request must include an x-customer-id header with the StellarTools customer ID. The check runs before any file transfer begins — if the customer has no active subscription, the upload is rejected immediately with a FORBIDDEN error. The customerId and productId are passed through to metadata inside onUploadComplete.

Config

apiKey
string
required
Your StellarTools API key.
productId
string
required
The product the customer must have an active subscription to.

Required headers

x-customer-id
string
required
The StellarTools customer ID to verify access for.