Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    Public Pools & DAO Jars
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    Peer Games
    News Module
    Member Blogs
    Public Profile Pages
    Ring File Cabinet
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    Public Pools & DAO Jars
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    Peer Games
    News Module
    Member Blogs
    Public Profile Pages
    Ring File Cabinet
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)

    Documentation

    Concepts, value, and typical clone scenarios — less code.

    Welcome to Ring
    Quick Reference
    Getting Started
    Prerequisites
    Installation
    First Success Validation
    Next Steps
    Features
    Multi-Vendor Store
    Inventory & Stock
    Vendor Management
    Commissions & Settlements
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    Public Pools & DAO Jars
    WayForPay Payment Integration
    Wallet & Credit System
    WalletConductor
    Affiliate & Referral Enablement
    Referral Codes (Refcodes)
    NFT Exhibition Marketplace
    Solana NFT Gates
    Token Staking System
    Owner Project Lab
    Entities
    Opportunities
    Real-Time Messaging
    Ring Tasks
    WebRTC Calls & STUNner TURN
    Peer Games
    News Module
    Member Blogs
    Public Profile Pages
    Ring File Cabinet
    Username Reservation System
    Scientific Editor
    Notifications
    Push Notifications with FCM (Ring-Powered)
    Email AI-CRM
    Ring Mailer & RingdomX Mail
    Tunnel Protocol
    VideoConductor
    MediaConductor
    Generative Gallery
    Authentication
    Security & Compliance
    Admin console
    Admin Wiki
    Manage via Telegram
    Locale System
    Mobile Experience
    Performance Optimization Patterns
    Examples
    Quick Start
    Basic Setup
    White Label
    Custom Branding
    Web3 Integration
    Real World
    Advanced Features
    Customization
    Quick Start — Your First Ring Clone
    Customization Guide
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Web3
    Token launch jurisdictions
    Wallet
    Wallet Security Tips
    Integrations
    Ethereum wallets (Wagmi v3)
    RingFileBase (object storage API)
    Ring CDN (RingFileBase edge)
    Deployment
    Self-hosted deployment
    Vercel
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Development
    Ring MCP Server

    Quick entry (CTOs · auditors · agents)

    Welcome — mission & audiences
    Quick Reference
    Getting started
    Architecture & Auth.js
    Backend modes & databases (DB_BACKEND_MODE)
    Self-hosted
    Ring MCP Tools
    Ring MCP Server
    Token economics
    Token launch jurisdictions
    Deploy (Docker · k8s)
    Security & compliance reads
    ringdom.org — LegioX homebase
    Source — MIT license (GitHub)
    1. Docs
    2. /Development
    3. /Performance

    Updated Jul 7, 20263 min listen

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    1. Docs
    2. /Development
    3. /Performance

    Updated Jul 7, 20263 min listen

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    1. Docs
    2. /Development
    3. /Performance

    Updated Jul 7, 20263 min listen

    Ring Platform Logo

    Завантаження документації...

    Підготовка контенту платформи Ring

    Performance Optimization

    Profiling and optimization strategies for Ring Platform integrators. For operator-facing overview, see Performance patterns. For production infrastructure, see Deployment performance.

    Use Founder / Developer tabs in the docs sidebar to filter this page.

    Ring Platform does not use client-side Firestore. Firebase is Admin SDK only via lib/firebase-admin.server.ts. Client Firebase code is limited to public/firebase-messaging-sw.js for FCM.

    What affects load times

    FactorEffect
    Server Components defaultMost routes ship zero client JS for pure rendering
    Request dedup (cache())One Firestore read per document per server render
    Cached store catalogProduct list shared across API route and server action
    Batched Web VitalsOne analytics POST per page load instead of five
    Provider SSOTSingle credit-balance stream, single tunnel connection
    Build-time Firebase mockStatic pages build without live credentials

    Caching layers (mirror of features doc)

    LayerScopeSSOT
    React cache()Per-request serverlib/services/firebase-service-manager.ts
    'use cache' + cacheTagCross-request serverfeatures/store/config.ts → getCachedProductCatalog()
    EntityCache 30s TTLServer processlib/database/DatabaseService.ts
    Vendor status single-flightClient tabhooks/use-vendor-status.ts (30s TTL)
    Credit bootstrap single-flightClient tabhooks/use-credit-balance.ts (5s TTL, userId-keyed)

    Related documentation

    Performance patterns (features)

    Operator + developer caching table and server/client SSOT.

    Best practices

    db() rules, platform_settings, SSOT script gates.

    Code structure

    Provider matrix and P4 hook consolidation.

    Deployment performance

    Production monitoring and infrastructure tuning.

    Performance Optimization

    Profiling and optimization strategies for Ring Platform integrators. For operator-facing overview, see Performance patterns. For production infrastructure, see Deployment performance.

    Use Founder / Developer tabs in the docs sidebar to filter this page.

    Ring Platform does not use client-side Firestore. Firebase is Admin SDK only via lib/firebase-admin.server.ts. Client Firebase code is limited to public/firebase-messaging-sw.js for FCM.

    What affects load times

    FactorEffect
    Server Components defaultMost routes ship zero client JS for pure rendering
    Request dedup (cache())One Firestore read per document per server render
    Cached store catalogProduct list shared across API route and server action
    Batched Web VitalsOne analytics POST per page load instead of five
    Provider SSOTSingle credit-balance stream, single tunnel connection
    Build-time Firebase mockStatic pages build without live credentials

    Caching layers (mirror of features doc)

    LayerScopeSSOT
    React cache()Per-request serverlib/services/firebase-service-manager.ts
    'use cache' + cacheTagCross-request serverfeatures/store/config.ts → getCachedProductCatalog()
    EntityCache 30s TTLServer processlib/database/DatabaseService.ts
    Vendor status single-flightClient tabhooks/use-vendor-status.ts (30s TTL)
    Credit bootstrap single-flightClient tabhooks/use-credit-balance.ts (5s TTL, userId-keyed)

    Related documentation

    Performance patterns (features)

    Operator + developer caching table and server/client SSOT.

    Best practices

    db() rules, platform_settings, SSOT script gates.

    Code structure

    Provider matrix and P4 hook consolidation.

    Deployment performance

    Production monitoring and infrastructure tuning.

    Performance Optimization

    Profiling and optimization strategies for Ring Platform integrators. For operator-facing overview, see Performance patterns. For production infrastructure, see Deployment performance.

    Use Founder / Developer tabs in the docs sidebar to filter this page.

    Ring Platform does not use client-side Firestore. Firebase is Admin SDK only via lib/firebase-admin.server.ts. Client Firebase code is limited to public/firebase-messaging-sw.js for FCM.

    What affects load times

    FactorEffect
    Server Components defaultMost routes ship zero client JS for pure rendering
    Request dedup (cache())One Firestore read per document per server render
    Cached store catalogProduct list shared across API route and server action
    Batched Web VitalsOne analytics POST per page load instead of five
    Provider SSOTSingle credit-balance stream, single tunnel connection
    Build-time Firebase mockStatic pages build without live credentials

    Caching layers (mirror of features doc)

    LayerScopeSSOT
    React cache()Per-request serverlib/services/firebase-service-manager.ts
    'use cache' + cacheTagCross-request serverfeatures/store/config.ts → getCachedProductCatalog()
    EntityCache 30s TTLServer processlib/database/DatabaseService.ts
    Vendor status single-flightClient tabhooks/use-vendor-status.ts (30s TTL)
    Credit bootstrap single-flightClient tabhooks/use-credit-balance.ts (5s TTL, userId-keyed)

    Related documentation

    Performance patterns (features)

    Operator + developer caching table and server/client SSOT.

    Best practices

    db() rules, platform_settings, SSOT script gates.

    Code structure

    Provider matrix and P4 hook consolidation.

    Deployment performance

    Production monitoring and infrastructure tuning.

    Web Vitals batch
    Client tab
    components/providers/web-vitals-provider.tsx (1.5s debounce)
    Session refetchClient tabfeatures/auth/components/session-provider.tsx (15 * 60, no focus/offline)

    Full operator narrative: Performance patterns.

    React 19 cache() in Server Components

    Cache scope is the current Server Component render pass only. For cross-request caching, use Next 16 Cache Components ('use cache') or revalidate exports.

    Build-time Firebase mocking

    During next build, lib/firebase/build-mock.server.ts detects NEXT_PHASE=phase-production-build and returns mock Firestore/Auth instances. Chainable where() / orderBy() / limit() return empty result sets — no credentials required for SSG.

    DatabaseService query optimization

    • Prefer findDocById over filtering by id in queryDocs.
    • Use filters + pagination at the database layer — do not fetch-all-then-filter in application code.
    • EntityCache provides 30s read-after-write consistency on entities — no manual cache for basic cases.

    Do not call db.users.findById() or similar. The API is db().findDocById('users', id) or db().queryDocs({ collection, filters, … }).

    PostgreSQL pool SSOT

    getSharedPgPool() in lib/database/shared-pg-pool.ts returns the connected adapter pool after initializeDatabase(). new Pool( must appear only under lib/database/ — enforced by gate 7 of scripts/validate-provider-ssot.sh.

    Routine persistence: db().createDoc / findDocById / queryDocs / transaction.

    Provider SSOT enforcement

    Before merging hook or provider changes:

    Seven gates — full table in Best practices. Key paths:

    • SessionProvider → features/auth/components/session-provider.tsx (duplicates under components/providers/ deleted)
    • useVendorStatus → sole owner of fetch('/api/vendor/status')
    • useCreditBalance → sole owner of '/api/wallet/credit/balance' string in TS/TSX

    Server Components by default

    Pages in app/ are Server Components unless marked 'use client'. Client boundaries belong on interactive leaves: checkout forms, maps, wallet UIs, admin dashboards.

    Rendering strategy exports

    Web Vitals collection

    WebVitalsProvider batches Core Web Vitals into one debounced POST /api/analytics/web-vitals. There is no per-metric POST from useReportWebVitals directly — do not document or implement five separate analytics calls per page load.

    For build analysis:

    Firebase cache metrics (getCacheMetrics()) are dev-only when FIREBASE_DEBUG_LOGS=true.

    Web Vitals batch
    Client tab
    components/providers/web-vitals-provider.tsx (1.5s debounce)
    Session refetchClient tabfeatures/auth/components/session-provider.tsx (15 * 60, no focus/offline)

    Full operator narrative: Performance patterns.

    React 19 cache() in Server Components

    Cache scope is the current Server Component render pass only. For cross-request caching, use Next 16 Cache Components ('use cache') or revalidate exports.

    Build-time Firebase mocking

    During next build, lib/firebase/build-mock.server.ts detects NEXT_PHASE=phase-production-build and returns mock Firestore/Auth instances. Chainable where() / orderBy() / limit() return empty result sets — no credentials required for SSG.

    DatabaseService query optimization

    • Prefer findDocById over filtering by id in queryDocs.
    • Use filters + pagination at the database layer — do not fetch-all-then-filter in application code.
    • EntityCache provides 30s read-after-write consistency on entities — no manual cache for basic cases.

    Do not call db.users.findById() or similar. The API is db().findDocById('users', id) or db().queryDocs({ collection, filters, … }).

    PostgreSQL pool SSOT

    getSharedPgPool() in lib/database/shared-pg-pool.ts returns the connected adapter pool after initializeDatabase(). new Pool( must appear only under lib/database/ — enforced by gate 7 of scripts/validate-provider-ssot.sh.

    Routine persistence: db().createDoc / findDocById / queryDocs / transaction.

    Provider SSOT enforcement

    Before merging hook or provider changes:

    Seven gates — full table in Best practices. Key paths:

    • SessionProvider → features/auth/components/session-provider.tsx (duplicates under components/providers/ deleted)
    • useVendorStatus → sole owner of fetch('/api/vendor/status')
    • useCreditBalance → sole owner of '/api/wallet/credit/balance' string in TS/TSX

    Server Components by default

    Pages in app/ are Server Components unless marked 'use client'. Client boundaries belong on interactive leaves: checkout forms, maps, wallet UIs, admin dashboards.

    Rendering strategy exports

    Web Vitals collection

    WebVitalsProvider batches Core Web Vitals into one debounced POST /api/analytics/web-vitals. There is no per-metric POST from useReportWebVitals directly — do not document or implement five separate analytics calls per page load.

    For build analysis:

    Firebase cache metrics (getCacheMetrics()) are dev-only when FIREBASE_DEBUG_LOGS=true.

    Web Vitals batch
    Client tab
    components/providers/web-vitals-provider.tsx (1.5s debounce)
    Session refetchClient tabfeatures/auth/components/session-provider.tsx (15 * 60, no focus/offline)

    Full operator narrative: Performance patterns.

    React 19 cache() in Server Components

    Cache scope is the current Server Component render pass only. For cross-request caching, use Next 16 Cache Components ('use cache') or revalidate exports.

    Build-time Firebase mocking

    During next build, lib/firebase/build-mock.server.ts detects NEXT_PHASE=phase-production-build and returns mock Firestore/Auth instances. Chainable where() / orderBy() / limit() return empty result sets — no credentials required for SSG.

    DatabaseService query optimization

    • Prefer findDocById over filtering by id in queryDocs.
    • Use filters + pagination at the database layer — do not fetch-all-then-filter in application code.
    • EntityCache provides 30s read-after-write consistency on entities — no manual cache for basic cases.

    Do not call db.users.findById() or similar. The API is db().findDocById('users', id) or db().queryDocs({ collection, filters, … }).

    PostgreSQL pool SSOT

    getSharedPgPool() in lib/database/shared-pg-pool.ts returns the connected adapter pool after initializeDatabase(). new Pool( must appear only under lib/database/ — enforced by gate 7 of scripts/validate-provider-ssot.sh.

    Routine persistence: db().createDoc / findDocById / queryDocs / transaction.

    Provider SSOT enforcement

    Before merging hook or provider changes:

    Seven gates — full table in Best practices. Key paths:

    • SessionProvider → features/auth/components/session-provider.tsx (duplicates under components/providers/ deleted)
    • useVendorStatus → sole owner of fetch('/api/vendor/status')
    • useCreditBalance → sole owner of '/api/wallet/credit/balance' string in TS/TSX

    Server Components by default

    Pages in app/ are Server Components unless marked 'use client'. Client boundaries belong on interactive leaves: checkout forms, maps, wallet UIs, admin dashboards.

    Rendering strategy exports

    Web Vitals collection

    WebVitalsProvider batches Core Web Vitals into one debounced POST /api/analytics/web-vitals. There is no per-metric POST from useReportWebVitals directly — do not document or implement five separate analytics calls per page load.

    For build analysis:

    Firebase cache metrics (getCacheMetrics()) are dev-only when FIREBASE_DEBUG_LOGS=true.

    typescript
    
    import { getCachedDocument, getCachedCollection } from '@/lib/services/firebase-service-manager'
    
    // Multiple calls during one render → one Firestore read
    const entity = await getCachedDocument('entities', 'abc123')
    const same = await getCachedDocument('entities', 'abc123') // cache hit
    typescript
    
    import { db } from '@/lib/database'
    
    const result = await db().queryDocs({
      collection: 'entities',
      filters: [{ field: 'status', operator: '==', value: 'active' }],
      orderBy: [{ field: 'createdAt', direction: 'desc' }],
      pagination: { limit: 20, offset: 0 },
    })
    
    if (!result.success) throw result.error ?? new Error('Query failed')
    typescript
    
    import { getSharedPgPool } from '@/lib/database'
    
    // PostGIS / raw SQL only — not for routine CRUD
    const pool = await getSharedPgPool()
    bash
    
    ./scripts/validate-provider-ssot.sh
    typescript
    
    export const revalidate = 60        // ISR — revalidate every 60s
    export const dynamic = 'force-dynamic'  // user-specific, no cache
    bash
    
    npm run build
    npm run analyze
    typescript
    
    import { getCachedDocument, getCachedCollection } from '@/lib/services/firebase-service-manager'
    
    // Multiple calls during one render → one Firestore read
    const entity = await getCachedDocument('entities', 'abc123')
    const same = await getCachedDocument('entities', 'abc123') // cache hit
    typescript
    
    import { db } from '@/lib/database'
    
    const result = await db().queryDocs({
      collection: 'entities',
      filters: [{ field: 'status', operator: '==', value: 'active' }],
      orderBy: [{ field: 'createdAt', direction: 'desc' }],
      pagination: { limit: 20, offset: 0 },
    })
    
    if (!result.success) throw result.error ?? new Error('Query failed')
    typescript
    
    import { getSharedPgPool } from '@/lib/database'
    
    // PostGIS / raw SQL only — not for routine CRUD
    const pool = await getSharedPgPool()
    bash
    
    ./scripts/validate-provider-ssot.sh
    typescript
    
    export const revalidate = 60        // ISR — revalidate every 60s
    export const dynamic = 'force-dynamic'  // user-specific, no cache
    bash
    
    npm run build
    npm run analyze
    typescript
    
    import { getCachedDocument, getCachedCollection } from '@/lib/services/firebase-service-manager'
    
    // Multiple calls during one render → one Firestore read
    const entity = await getCachedDocument('entities', 'abc123')
    const same = await getCachedDocument('entities', 'abc123') // cache hit
    typescript
    
    import { db } from '@/lib/database'
    
    const result = await db().queryDocs({
      collection: 'entities',
      filters: [{ field: 'status', operator: '==', value: 'active' }],
      orderBy: [{ field: 'createdAt', direction: 'desc' }],
      pagination: { limit: 20, offset: 0 },
    })
    
    if (!result.success) throw result.error ?? new Error('Query failed')
    typescript
    
    import { getSharedPgPool } from '@/lib/database'
    
    // PostGIS / raw SQL only — not for routine CRUD
    const pool = await getSharedPgPool()
    bash
    
    ./scripts/validate-provider-ssot.sh
    typescript
    
    export const revalidate = 60        // ISR — revalidate every 60s
    export const dynamic = 'force-dynamic'  // user-specific, no cache
    bash
    
    npm run build
    npm run analyze