Ring Platform Logo

    Loading Documentation Hub...

    Scanning documentation library

    Documentation

    Welcome — mission & audiences

    Welcome to Ring Platform - Gateway Between Humanity and the Quantum World

    Library hub

    Welcome to Ring Platform - Gateway Between Humanity and the Quantum World

    Getting Started

    Index
    Prerequisites
    Installation
    Database migrations
    First Success Validation
    Troubleshooting
    Next Steps

    Architecture

    Index
    Backend modes and databases
    Data Model
    Authentication Architecture
    Email AI-CRM Architecture
    PaymentConductor architecture
    Refcodes architecture
    News Kingdom architecture
    Proxy and internationalization
    Real Time
    Security

    Features

    Platform Features
    Authentication
    Email AI-CRM System
    Entities
    Opportunities
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Web3 Wallet
    Multi-Vendor Store
    Ring ERP
    Inventory & Stock
    Vendor Management

    API

    Index
    Authentication
    Email AI-CRM API
    Entities
    Opportunities
    Messaging API
    Notifications API
    Wallet
    Store API

    CLI

    Ring CLI (enterprise only)

    Customization

    Index
    Branding
    Features
    Localization
    Themes
    Components

    Deployment

    Index
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery

    Development

    Index
    Local Setup
    Code Structure
    Community tooling
    Ring MCP Server
    Generative Images (ImageConductor)
    Autonomous Newsroom (Grok)
    OSS vs enterprise

    Roadmap

    Platform Roadmap (Technical)

    Examples

    Index
    Quick Start
    Authentication
    Email AI-CRM Tutorial
    Api Integration
    Web3 Integration
    White Label
    Real World

    Integrations

    Ethereum wallets (Wagmi v3)

    Quick entry (CTOs · auditors · agents)

    Library hub
    Welcome — mission & audiences
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP
    Deploy (Docker · k8s)
    Security & compliance reads
    Ring Platform Logo

    Loading Documentation Hub...

    Scanning documentation library

    Documentation

    Welcome — mission & audiences

    Welcome to Ring Platform - Gateway Between Humanity and the Quantum World

    Library hub

    Welcome to Ring Platform - Gateway Between Humanity and the Quantum World

    Getting Started

    Index
    Prerequisites
    Installation
    Database migrations
    First Success Validation
    Troubleshooting
    Next Steps

    Architecture

    Index
    Backend modes and databases
    Data Model
    Authentication Architecture
    Email AI-CRM Architecture
    PaymentConductor architecture
    Refcodes architecture
    News Kingdom architecture

    Features

    Platform Features
    Authentication
    Email AI-CRM System
    Entities
    Opportunities
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Web3 Wallet

    API

    Index
    Authentication
    Email AI-CRM API
    Entities
    Opportunities
    Messaging API
    Notifications API
    Wallet
    Store API

    CLI

    Ring CLI (enterprise only)

    Customization

    Index
    Branding
    Features
    Localization
    Themes
    Components

    Deployment

    Index
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery

    Development

    Index
    Local Setup
    Code Structure
    Community tooling
    Ring MCP Server
    Generative Images (ImageConductor)
    Autonomous Newsroom (Grok)
    OSS vs enterprise

    Roadmap

    Platform Roadmap (Technical)

    Examples

    Index
    Quick Start
    Authentication
    Email AI-CRM Tutorial
    Api Integration
    Web3 Integration
    White Label
    Real World

    Integrations

    Ethereum wallets (Wagmi v3)

    Quick entry (CTOs · auditors · agents)

    Library hub
    Welcome — mission & audiences
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP
    Deploy (Docker · k8s)
    Security & compliance reads
    Ring Platform Logo

    Loading Documentation Hub...

    Scanning documentation library

    Documentation

    Welcome — mission & audiences

    Welcome to Ring Platform - Gateway Between Humanity and the Quantum World

    Library hub

    Welcome to Ring Platform - Gateway Between Humanity and the Quantum World

    Getting Started

    Index
    Prerequisites
    Installation
    Database migrations
    First Success Validation
    Troubleshooting
    Next Steps

    Architecture

    Index
    Backend modes and databases
    Data Model
    Authentication Architecture
    Email AI-CRM Architecture
    PaymentConductor architecture
    Refcodes architecture
    News Kingdom architecture

    Features

    Platform Features
    Authentication
    Email AI-CRM System
    Entities
    Opportunities
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Web3 Wallet

    API

    Index
    Authentication
    Email AI-CRM API
    Entities
    Opportunities
    Messaging API
    Notifications API
    Wallet
    Store API

    CLI

    Ring CLI (enterprise only)

    Customization

    Index
    Branding
    Features
    Localization
    Themes
    Components

    Deployment

    Index
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery

    Development

    Index
    Local Setup
    Code Structure
    Community tooling
    Ring MCP Server
    Generative Images (ImageConductor)
    Autonomous Newsroom (Grok)
    OSS vs enterprise

    Roadmap

    Platform Roadmap (Technical)

    Examples

    Index
    Quick Start
    Authentication
    Email AI-CRM Tutorial
    Api Integration
    Web3 Integration
    White Label
    Real World

    Integrations

    Ethereum wallets (Wagmi v3)

    Quick entry (CTOs · auditors · agents)

    Library hub
    Welcome — mission & audiences
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP
    Deploy (Docker · k8s)
    Security & compliance reads

    Refcodes architecture

    System diagram

    Core modules

    ModulePathResponsibility
    Cookie captureproxy.tsFirst-touch ring_ref from ?ref=
    Code registryrefcode-service.tsCRUD codes per (userId, wallet)
    Attributionattribution-service.tsSelf-ref, first-purchase, wallet overlap guards
    Reward ledgerreferral-reward-service.tsFiat/credit paths, approval, oracle sizing
    On-chain mintreward-minter.tsviem simulateContract + writeContract
    Server walletlib/web3/server-wallet.tsREFERRAL_MINTER_PRIVATE_KEY → viem account

    Integration points

    Store order creation

    app/api/store/orders/route.ts resolves attribution before StoreOrdersService.createOrder. Referral fields are stored in the orders JSONB document:

    • referralCode
    • referrerUserId
    • referrerWallet

    PaymentConductor (fiat)

    lib/payments/conductor/handlers/store-order.ts calls ReferralRewardService.onOrderPaid inside the Approved + isNew branch — after stock deduction and vendor settlement. Failures are logged but do not fail the webhook.

    Internal credit (instant)

    app/api/store/payments/credit/route.ts marks the order paid, deducts stock, writes settlements via settlement-pipeline.ts, then calls onOrderPaid with rail: 'crypto' (auto-approved mint).

    Membership (fiat)

    handlers/membership-upgrade.ts → ReferralRewardService.onMembershipPaid when users.data.referredBy is set (first-touch signup attribution).

    Cron + visit beacon

    EndpointRole
    POST /api/refcodes/trackIncrements refcodes.data.visits
    GET /api/cron/refcodes-mintBatch-mints approved rewards (CRON_SECRET)

    Idempotency

    LayerKey
    PostgreSQLUnique index on referral_rewards (data->>'orderReference')
    ServicerewardExistsForOrder short-circuit
    ContractpaidOrders[orderRef] mapping — reverts ReferralRewards__AlreadyPaid

    orderRef on-chain = keccak256(bytes(orderReference)) where orderReference comes from PaymentConductor.

    Contract roles

    text
    
    initialize(admin, operator, token, mode)
      ├─ DEFAULT_ADMIN_ROLE → admin (upgrade, pause, setRewardToken/Mode)
      └─ OPERATOR_ROLE      → operator (payReferral)
    
    MINT mode: token must authorize proxy to mint
    TRANSFER mode: contract must hold token balance (treasury-funded)

    i18n

    • Locale bundle: locales/{en,uk,ru}/modules/refcodes.json
    • Scope: modRefcodes in lib/i18n/message-scopes.ts (authenticated + admin)
    • Routes: REFCODES, ADMIN_REFCODES in constants/routes.ts

    Database placement

    EnvironmentDatabaseNotes
    ring-platform.org devring_platformring-postgres-dev, init 00-create-ring-platform-db.sh
    ring-platform.org prodring_platformpostgres.ring-platform-org.svc.cluster.local
    ring-connect-softwarering_connect_software_dev / prod nameSeparate clone DB
    ring-ringdom-orgring_ringdom_orgSeparate clone DB

    Migration file: data/migrations/005_refcodes_schema.sql.

    Related

    • Feature: Referral Codes
    • PaymentConductor architecture
    • Proxy and i18n

    Refcodes architecture

    System diagram

    Core modules

    ModulePathResponsibility
    Cookie captureproxy.tsFirst-touch ring_ref from ?ref=
    Code registryrefcode-service.tsCRUD codes per (userId, wallet)
    Attributionattribution-service.tsSelf-ref, first-purchase, wallet overlap guards
    Reward ledgerreferral-reward-service.tsFiat/credit paths, approval, oracle sizing
    On-chain mintreward-minter.tsviem simulateContract + writeContract
    Server walletlib/web3/server-wallet.tsREFERRAL_MINTER_PRIVATE_KEY → viem account

    Integration points

    Store order creation

    app/api/store/orders/route.ts resolves attribution before StoreOrdersService.createOrder. Referral fields are stored in the orders JSONB document:

    • referralCode
    • referrerUserId
    • referrerWallet

    PaymentConductor (fiat)

    lib/payments/conductor/handlers/store-order.ts calls ReferralRewardService.onOrderPaid inside the Approved + isNew branch — after stock deduction and vendor settlement. Failures are logged but do not fail the webhook.

    Internal credit (instant)

    app/api/store/payments/credit/route.ts marks the order paid, deducts stock, writes settlements via settlement-pipeline.ts, then calls onOrderPaid with rail: 'crypto' (auto-approved mint).

    Membership (fiat)

    handlers/membership-upgrade.ts → ReferralRewardService.onMembershipPaid when users.data.referredBy is set (first-touch signup attribution).

    Cron + visit beacon

    EndpointRole
    POST /api/refcodes/trackIncrements refcodes.data.visits
    GET /api/cron/refcodes-mintBatch-mints approved rewards (CRON_SECRET)

    Idempotency

    LayerKey
    PostgreSQLUnique index on referral_rewards (data->>'orderReference')
    ServicerewardExistsForOrder short-circuit
    ContractpaidOrders[orderRef] mapping — reverts ReferralRewards__AlreadyPaid

    orderRef on-chain = keccak256(bytes(orderReference)) where orderReference comes from PaymentConductor.

    Contract roles

    text
    
    initialize(admin, operator, token, mode)
      ├─ DEFAULT_ADMIN_ROLE → admin (upgrade, pause, setRewardToken/Mode)
      └─ OPERATOR_ROLE      → operator (payReferral)
    
    MINT mode: token must authorize proxy to mint
    TRANSFER mode: contract must hold token balance (treasury-funded)

    i18n

    • Locale bundle: locales/{en,uk,ru}/modules/refcodes.json
    • Scope: modRefcodes in lib/i18n/message-scopes.ts (authenticated + admin)
    • Routes: REFCODES, ADMIN_REFCODES in constants/routes.ts

    Database placement

    EnvironmentDatabaseNotes
    ring-platform.org devring_platformring-postgres-dev, init 00-create-ring-platform-db.sh
    ring-platform.org prodring_platformpostgres.ring-platform-org.svc.cluster.local
    ring-connect-softwarering_connect_software_dev / prod nameSeparate clone DB
    ring-ringdom-orgring_ringdom_orgSeparate clone DB

    Migration file: data/migrations/005_refcodes_schema.sql.

    Related

    • Feature: Referral Codes
    • PaymentConductor architecture
    • Proxy and i18n

    Refcodes architecture

    System diagram

    Core modules

    ModulePathResponsibility
    Cookie captureproxy.tsFirst-touch ring_ref from ?ref=
    Code registryrefcode-service.tsCRUD codes per (userId, wallet)
    Attributionattribution-service.tsSelf-ref, first-purchase, wallet overlap guards
    Reward ledgerreferral-reward-service.tsFiat/credit paths, approval, oracle sizing
    On-chain mintreward-minter.tsviem simulateContract + writeContract
    Server walletlib/web3/server-wallet.tsREFERRAL_MINTER_PRIVATE_KEY → viem account

    Integration points

    Store order creation

    app/api/store/orders/route.ts resolves attribution before StoreOrdersService.createOrder. Referral fields are stored in the orders JSONB document:

    • referralCode
    • referrerUserId
    • referrerWallet

    PaymentConductor (fiat)

    lib/payments/conductor/handlers/store-order.ts calls ReferralRewardService.onOrderPaid inside the Approved + isNew branch — after stock deduction and vendor settlement. Failures are logged but do not fail the webhook.

    Internal credit (instant)

    app/api/store/payments/credit/route.ts marks the order paid, deducts stock, writes settlements via settlement-pipeline.ts, then calls onOrderPaid with rail: 'crypto' (auto-approved mint).

    Membership (fiat)

    handlers/membership-upgrade.ts → ReferralRewardService.onMembershipPaid when users.data.referredBy is set (first-touch signup attribution).

    Cron + visit beacon

    EndpointRole
    POST /api/refcodes/trackIncrements refcodes.data.visits
    GET /api/cron/refcodes-mintBatch-mints approved rewards (CRON_SECRET)

    Idempotency

    LayerKey
    PostgreSQLUnique index on referral_rewards (data->>'orderReference')
    ServicerewardExistsForOrder short-circuit
    ContractpaidOrders[orderRef] mapping — reverts ReferralRewards__AlreadyPaid

    orderRef on-chain = keccak256(bytes(orderReference)) where orderReference comes from PaymentConductor.

    Contract roles

    text
    
    initialize(admin, operator, token, mode)
      ├─ DEFAULT_ADMIN_ROLE → admin (upgrade, pause, setRewardToken/Mode)
      └─ OPERATOR_ROLE      → operator (payReferral)
    
    MINT mode: token must authorize proxy to mint
    TRANSFER mode: contract must hold token balance (treasury-funded)

    i18n

    • Locale bundle: locales/{en,uk,ru}/modules/refcodes.json
    • Scope: modRefcodes in lib/i18n/message-scopes.ts (authenticated + admin)
    • Routes: REFCODES, ADMIN_REFCODES in constants/routes.ts

    Database placement

    EnvironmentDatabaseNotes
    ring-platform.org devring_platformring-postgres-dev, init 00-create-ring-platform-db.sh
    ring-platform.org prodring_platformpostgres.ring-platform-org.svc.cluster.local
    ring-connect-softwarering_connect_software_dev / prod nameSeparate clone DB
    ring-ringdom-orgring_ringdom_orgSeparate clone DB

    Migration file: data/migrations/005_refcodes_schema.sql.

    Related

    • Feature: Referral Codes
    • PaymentConductor architecture
    • Proxy and i18n
    Commissions & Settlements
    Referral Codes (Refcodes)
    Payment Integration
    PaymentConductor
    WayForPay Payment Integration
    News Module - Digital Newspaper Experience
    Member Blogs
    Scientific Editor
    Locale System
    Security & Compliance
    NFT Marketplace
    Token Staking System
    Performance Optimization Patterns
    Mobile Experience
    Admin API
    Whitelabel Navigation
    Best Practices
    Workflow
    Code Style
    Performance
    Testing
    Deployment
    Debugging
    Contributing
    Api Examples
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    Proxy and internationalization
    Real Time
    Security
    Multi-Vendor Store
    Ring ERP
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    Referral Codes (Refcodes)
    Payment Integration
    PaymentConductor
    WayForPay Payment Integration
    News Module - Digital Newspaper Experience
    Member Blogs
    Scientific Editor
    Locale System
    Security & Compliance
    NFT Marketplace
    Token Staking System
    Performance Optimization Patterns
    Mobile Experience
    Admin API
    Whitelabel Navigation
    Best Practices
    Workflow
    Code Style
    Performance
    Testing
    Deployment
    Debugging
    Contributing
    Api Examples
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    Proxy and internationalization
    Real Time
    Security
    Multi-Vendor Store
    Ring ERP
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    Referral Codes (Refcodes)
    Payment Integration
    PaymentConductor
    WayForPay Payment Integration
    News Module - Digital Newspaper Experience
    Member Blogs
    Scientific Editor
    Locale System
    Security & Compliance
    NFT Marketplace
    Token Staking System
    Performance Optimization Patterns
    Mobile Experience
    Admin API
    Whitelabel Navigation
    Best Practices
    Workflow
    Code Style
    Performance
    Testing
    Deployment
    Debugging
    Contributing
    Api Examples
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    Back
    Back
    Back