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
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    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
    News Module
    Member Blogs
    Public Profile Pages
    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
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    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
    News Module
    Member Blogs
    Public Profile Pages
    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
    SubscriptionConductor
    PaymentConductor
    Payments Overview
    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
    News Module
    Member Blogs
    Public Profile Pages
    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. /Architecture
    3. /Email AI-CRM architecture

    Updated Jul 21, 20263 min listen

    Ring Platform Logo

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

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

    1. Docs
    2. /Architecture
    3. /Email AI-CRM architecture

    Updated Jul 21, 20263 min listen

    Ring Platform Logo

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

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

    1. Docs
    2. /Architecture
    3. /Email AI-CRM architecture

    Updated Jul 21, 20263 min listen

    Ring Platform Logo

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

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

    Email AI-CRM architecture

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

    System diagram

    Module boundaries (operator view)

    StageWhat happens
    ConfigureChannels in ring-config.json; passwords in CRM_CHANNEL_* secrets
    IngestCron polls each enabled mailbox, or a signed webhook pushes payloads
    ProcessSecurity scan → AI classification → CRM upsert with sourceChannel → draft queue
    ReviewAdmins filter inbox by channel, approve drafts
    SendReplies leave via CRM SMTP for that channel (not login noreply)
    TrackTasks and API cost roll up in admin analytics

    Idempotency: duplicate Message-ID values are skipped; overlapping poll batches are mutex-guarded.

    Code layout

    PathRole
    services/email/imap/config.tsloadCrmChannels(), validateCrmChannels(), legacy IMAP_* fallback
    services/email/email-processor.tsOrchestrator; dedup, poll each channel, ingest
    services/email/smtp/email-sender.tsCRM outbound — not lib/mailer.ts
    lib/mailer.tsAuth OTP / magic / reset only
    services/email/crm/Contact + task services — static import { Jsonb*Repository }
    services/email/drafts/Draft queue + auto-send rules
    services/email/ai/Classifiers, generator, cost tracker

    Schema-only tables (001 — not wired)

    Deprecated column-model tables — no app access

    001_email_crm_schema.sql defines email_analytics, email_knowledge_base, and email_security_events. No TypeScript module reads or writes these tables. Use 009 + 010 JSONB migrations instead.

    Related documentation

    Related documentation

    Email AI-CRM

    Next-step: operator checklist, channel secrets, and admin CRM shell.

    Email AI-CRM API

    Deep-dive: channels status route and sourceChannel query contract.

    Ring Mailer & RingdomX Mail

    Depends-on: Auth SMTP plane stays on lib/mailer.ts.

    Backend modes and databases

    See-also: how DB_BACKEND_MODE selects the db() adapter.

    Email AI-CRM architecture

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

    System diagram

    Module boundaries (operator view)

    StageWhat happens
    ConfigureChannels in ring-config.json; passwords in CRM_CHANNEL_* secrets
    IngestCron polls each enabled mailbox, or a signed webhook pushes payloads
    ProcessSecurity scan → AI classification → CRM upsert with sourceChannel → draft queue
    ReviewAdmins filter inbox by channel, approve drafts
    SendReplies leave via CRM SMTP for that channel (not login noreply)
    TrackTasks and API cost roll up in admin analytics

    Idempotency: duplicate Message-ID values are skipped; overlapping poll batches are mutex-guarded.

    Code layout

    PathRole
    services/email/imap/config.tsloadCrmChannels(), validateCrmChannels(), legacy IMAP_* fallback
    services/email/email-processor.tsOrchestrator; dedup, poll each channel, ingest
    services/email/smtp/email-sender.tsCRM outbound — not lib/mailer.ts
    lib/mailer.tsAuth OTP / magic / reset only
    services/email/crm/Contact + task services — static import { Jsonb*Repository }
    services/email/drafts/Draft queue + auto-send rules
    services/email/ai/Classifiers, generator, cost tracker

    Schema-only tables (001 — not wired)

    Deprecated column-model tables — no app access

    001_email_crm_schema.sql defines email_analytics, email_knowledge_base, and email_security_events. No TypeScript module reads or writes these tables. Use 009 + 010 JSONB migrations instead.

    Related documentation

    Related documentation

    Email AI-CRM

    Next-step: operator checklist, channel secrets, and admin CRM shell.

    Email AI-CRM API

    Deep-dive: channels status route and sourceChannel query contract.

    Ring Mailer & RingdomX Mail

    Depends-on: Auth SMTP plane stays on lib/mailer.ts.

    Backend modes and databases

    See-also: how DB_BACKEND_MODE selects the db() adapter.

    Email AI-CRM architecture

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

    System diagram

    Module boundaries (operator view)

    StageWhat happens
    ConfigureChannels in ring-config.json; passwords in CRM_CHANNEL_* secrets
    IngestCron polls each enabled mailbox, or a signed webhook pushes payloads
    ProcessSecurity scan → AI classification → CRM upsert with sourceChannel → draft queue
    ReviewAdmins filter inbox by channel, approve drafts
    SendReplies leave via CRM SMTP for that channel (not login noreply)
    TrackTasks and API cost roll up in admin analytics

    Idempotency: duplicate Message-ID values are skipped; overlapping poll batches are mutex-guarded.

    Code layout

    PathRole
    services/email/imap/config.tsloadCrmChannels(), validateCrmChannels(), legacy IMAP_* fallback
    services/email/email-processor.tsOrchestrator; dedup, poll each channel, ingest
    services/email/smtp/email-sender.tsCRM outbound — not lib/mailer.ts
    lib/mailer.tsAuth OTP / magic / reset only
    services/email/crm/Contact + task services — static import { Jsonb*Repository }
    services/email/drafts/Draft queue + auto-send rules
    services/email/ai/Classifiers, generator, cost tracker

    Schema-only tables (001 — not wired)

    Deprecated column-model tables — no app access

    001_email_crm_schema.sql defines email_analytics, email_knowledge_base, and email_security_events. No TypeScript module reads or writes these tables. Use 009 + 010 JSONB migrations instead.

    Related documentation

    Related documentation

    Email AI-CRM

    Next-step: operator checklist, channel secrets, and admin CRM shell.

    Email AI-CRM API

    Deep-dive: channels status route and sourceChannel query contract.

    Ring Mailer & RingdomX Mail

    Depends-on: Auth SMTP plane stays on lib/mailer.ts.

    Backend modes and databases

    See-also: how DB_BACKEND_MODE selects the db() adapter.

    features/email-crm/types/*Pure types (no runtime deps) — breaks Jsonb circular require
    features/email-crm/repositories/import type from types; JSONB repos
    features/email-crm/lib/jsonb-collection.tsreadDoc / upsertDoc / queryDocs → db()
    app/api/cron/email-processor/route.tsConstructs processor per action
    app/api/admin/email/channels/route.tsRead-only channel status

    Persistence — types + jsonb-collection → db()

    CRM repositories and services never call raw SQL. Types are split into features/email-crm/types/{contact,task,draft}.ts so repositories can import type without pulling service factories into a CJS require cycle.

    Helperdb() method
    readDoc(collection, id)readDoc()
    upsertDoc(collection, id, record)readDoc() then updateDoc() or createDoc()
    queryDocs({ collection, filters, orderBy, limit })queryDocs()
    deleteDoc(collection, id)deleteDoc()

    Active JSONB collections

    CollectionDocument idIndexed fields
    email_threadsRFC thread root / Message-IDstatus, fromEmail, lastMessageAt, sourceChannel
    email_contactscontact_<sha256(email)>email, type
    email_messagesRFC Message-IDthreadId
    email_draftsdraft_<uuid>threadId, status
    email_taskstask_<uuid>threadId, status, dueDate
    email_api_usagereq_<timestamp>_<random>timestamp, operation, emailId

    Migrations: 009_email_crm_jsonb.sql + 010_email_crm_tasks_jsonb.sql.

    Idempotency and concurrency

    1. DB dedup — EmailMessageService.exists(messageId) at start of handleEmail.
    2. Poll mutex — overlapping pollInboundBatch returns { skipped: true }.
    3. Await handlers — pollBatch waits for all handleEmail promises before disconnect.
    4. Webhook — uid === 0 skips IMAP markAsSeen.

    Cron vs IDLE

    ModeWhenMechanism
    poll (recommended)k8s CronJob, serverlessConnect → fetch UNSEEN → process → disconnect
    startDedicated Node podPersistent IMAP IDLE via instrumentation.ts
    HTTP startDebug onlyEMAIL_PROCESSOR_ALLOW_HTTP_START=true + cron action:start

    Security

    • Cron/webhook: fail-closed Bearer $CRON_SECRET or HMAC X-Email-Webhook-Signature.
    • Admin API: session + isPlatformAdmin.
    • Inbound: 4-layer injection pipeline before any LLM call.
    • Outbound: output validation on generated replies; CRM SMTP credentials required at send time.

    Owner Project Lab

    Same-workflow: orders desk under CrmAdminShell.

    features/email-crm/types/*Pure types (no runtime deps) — breaks Jsonb circular require
    features/email-crm/repositories/import type from types; JSONB repos
    features/email-crm/lib/jsonb-collection.tsreadDoc / upsertDoc / queryDocs → db()
    app/api/cron/email-processor/route.tsConstructs processor per action
    app/api/admin/email/channels/route.tsRead-only channel status

    Persistence — types + jsonb-collection → db()

    CRM repositories and services never call raw SQL. Types are split into features/email-crm/types/{contact,task,draft}.ts so repositories can import type without pulling service factories into a CJS require cycle.

    Helperdb() method
    readDoc(collection, id)readDoc()
    upsertDoc(collection, id, record)readDoc() then updateDoc() or createDoc()
    queryDocs({ collection, filters, orderBy, limit })queryDocs()
    deleteDoc(collection, id)deleteDoc()

    Active JSONB collections

    CollectionDocument idIndexed fields
    email_threadsRFC thread root / Message-IDstatus, fromEmail, lastMessageAt, sourceChannel
    email_contactscontact_<sha256(email)>email, type
    email_messagesRFC Message-IDthreadId
    email_draftsdraft_<uuid>threadId, status
    email_taskstask_<uuid>threadId, status, dueDate
    email_api_usagereq_<timestamp>_<random>timestamp, operation, emailId

    Migrations: 009_email_crm_jsonb.sql + 010_email_crm_tasks_jsonb.sql.

    Idempotency and concurrency

    1. DB dedup — EmailMessageService.exists(messageId) at start of handleEmail.
    2. Poll mutex — overlapping pollInboundBatch returns { skipped: true }.
    3. Await handlers — pollBatch waits for all handleEmail promises before disconnect.
    4. Webhook — uid === 0 skips IMAP markAsSeen.

    Cron vs IDLE

    ModeWhenMechanism
    poll (recommended)k8s CronJob, serverlessConnect → fetch UNSEEN → process → disconnect
    startDedicated Node podPersistent IMAP IDLE via instrumentation.ts
    HTTP startDebug onlyEMAIL_PROCESSOR_ALLOW_HTTP_START=true + cron action:start

    Security

    • Cron/webhook: fail-closed Bearer $CRON_SECRET or HMAC X-Email-Webhook-Signature.
    • Admin API: session + isPlatformAdmin.
    • Inbound: 4-layer injection pipeline before any LLM call.
    • Outbound: output validation on generated replies; CRM SMTP credentials required at send time.

    Owner Project Lab

    Same-workflow: orders desk under CrmAdminShell.

    features/email-crm/types/*Pure types (no runtime deps) — breaks Jsonb circular require
    features/email-crm/repositories/import type from types; JSONB repos
    features/email-crm/lib/jsonb-collection.tsreadDoc / upsertDoc / queryDocs → db()
    app/api/cron/email-processor/route.tsConstructs processor per action
    app/api/admin/email/channels/route.tsRead-only channel status

    Persistence — types + jsonb-collection → db()

    CRM repositories and services never call raw SQL. Types are split into features/email-crm/types/{contact,task,draft}.ts so repositories can import type without pulling service factories into a CJS require cycle.

    Helperdb() method
    readDoc(collection, id)readDoc()
    upsertDoc(collection, id, record)readDoc() then updateDoc() or createDoc()
    queryDocs({ collection, filters, orderBy, limit })queryDocs()
    deleteDoc(collection, id)deleteDoc()

    Active JSONB collections

    CollectionDocument idIndexed fields
    email_threadsRFC thread root / Message-IDstatus, fromEmail, lastMessageAt, sourceChannel
    email_contactscontact_<sha256(email)>email, type
    email_messagesRFC Message-IDthreadId
    email_draftsdraft_<uuid>threadId, status
    email_taskstask_<uuid>threadId, status, dueDate
    email_api_usagereq_<timestamp>_<random>timestamp, operation, emailId

    Migrations: 009_email_crm_jsonb.sql + 010_email_crm_tasks_jsonb.sql.

    Idempotency and concurrency

    1. DB dedup — EmailMessageService.exists(messageId) at start of handleEmail.
    2. Poll mutex — overlapping pollInboundBatch returns { skipped: true }.
    3. Await handlers — pollBatch waits for all handleEmail promises before disconnect.
    4. Webhook — uid === 0 skips IMAP markAsSeen.

    Cron vs IDLE

    ModeWhenMechanism
    poll (recommended)k8s CronJob, serverlessConnect → fetch UNSEEN → process → disconnect
    startDedicated Node podPersistent IMAP IDLE via instrumentation.ts
    HTTP startDebug onlyEMAIL_PROCESSOR_ALLOW_HTTP_START=true + cron action:start

    Security

    • Cron/webhook: fail-closed Bearer $CRON_SECRET or HMAC X-Email-Webhook-Signature.
    • Admin API: session + isPlatformAdmin.
    • Inbound: 4-layer injection pipeline before any LLM call.
    • Outbound: output validation on generated replies; CRM SMTP credentials required at send time.

    Owner Project Lab

    Same-workflow: orders desk under CrmAdminShell.