Loyalty
Docs

Search...

⌘K

Configuration

Learn how to configure your Loyalty program with custom rules, point values, and program behavior.

Configuration File

Create a loyalty.config.ts file in your project root to define your program settings:

typescript

import { defineConfig } from "@loyalty/sdk";

export default defineConfig({
  program: {
    name: "My Rewards Program",
    currency: "points",
    defaultMultiplier: 1,
  },
  tiers: [
    { name: "Bronze", minPoints: 0, multiplier: 1 },
    { name: "Silver", minPoints: 1000, multiplier: 1.5 },
    { name: "Gold", minPoints: 5000, multiplier: 2 },
    { name: "Platinum", minPoints: 10000, multiplier: 3 },
  ],
  rules: {
    pointExpiry: 365, // days
    minRedemption: 100,
    maxRedemption: 50000,
  },
});

Program Options

The program object defines the basic settings for your loyalty program, including the display name, point currency label, and default earning multiplier.

Tier Configuration

Tiers define membership levels within your program. Each tier specifies a minimum point threshold and a multiplier that affects how quickly members in that tier earn points.

Automatic tier upgrades

Members are automatically upgraded to the next tier when their point balance exceeds the tier threshold. Downgrades are evaluated at the end of each billing cycle.

Rules

The rules section controls program behavior such as point expiration, minimum and maximum redemption amounts, and other operational constraints.

Environment-Specific Config

You can override configuration values per environment using environment variables or by creating environment-specific config files:

typescript

import { defineConfig } from "@loyalty/sdk";

export default defineConfig({
  program: {
    name: process.env.NODE_ENV === "production"
      ? "My Rewards Program"
      : "My Rewards Program (Dev)",
    currency: "points",
    defaultMultiplier: 1,
  },
  // ... rest of config
});