Skip to main content

@keyban/types

Shared TypeScript types and Zod schemas for the Keyban platform.

Overview

This package provides type-safe definitions for all core domain models used across the Keyban ecosystem, including the backend API, SDK packages, and frontend applications.

Installation

npm install @keyban/types
# or
pnpm add @keyban/types
# or
yarn add @keyban/types

Usage

Import Types

import type {
Account,
Application,
DppProductSheet,
LoyaltyRewardTier,
} from '@keyban/types';

// Use types for type safety
const account: Account = {
id: '...',
email: 'user@example.com',
// ...
};

Import Enums

import {
Network,
Currency,
ApplicationFeature,
ApplicationThemeMode,
} from '@keyban/types';

// Use enums for constants
const network = Network.PolygonAmoy;
const currency = Currency.EUR;

Features

  • Type-safe domain models: All core entities (Account, Application, DPP, Loyalty) are strongly typed
  • Zod schemas: Runtime validation schemas for all types
  • Shared enums: Consistent enum definitions across frontend and backend
  • Zero runtime overhead: Types are compiled away, only enums remain at runtime

What's Included

Types

  • Account - Customer account with loyalty data
  • AccountAssignment - Assignment of accounts to loyalty programs
  • Application - Tenant application configuration
  • AuthUser - Authenticated user information
  • DppClaimPermission - Digital Product Passport claim permissions
  • DppProductSheet - Product templates for DPP minting
  • LoyaltyRewardTier - Tiered rewards configuration

Enums

  • Network - Blockchain networks (Ethereum, Polygon, Starknet, Stellar)
  • Currency - Supported currencies (EUR, USD, etc.)
  • ApplicationFeature - Application feature flags
  • ApplicationThemeMode - Theme modes (Light, Dark)
  • DppProductSheetStatus - Product sheet statuses

Why Use This Package?

For Backend Developers

  • Ensures DTOs match exactly what the frontend expects
  • Single source of truth for API contracts
  • Runtime validation with Zod schemas

For Frontend Developers

  • Type safety when consuming APIs
  • Autocomplete for all domain models
  • Catch type mismatches at compile time

For SDK Users

  • Consistent types across all SDK packages
  • No duplicate type definitions
  • Simplified imports

License

Apache-2.0