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
    Ring Oracle
    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
    Profile Account Widgets
    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
    Vertical Presets (SSOT)
    Ringization playbook
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Project configuration
    Public environment variables
    Order Lab secrets
    WalletConnect Project ID (Reown Cloud)
    Supported services
    NODUS wiki (project knowledge)
    Configuration playbook
    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 Deployment
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Backend Services
    Firebase Integration
    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
    Ring Oracle
    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
    Profile Account Widgets
    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
    Vertical Presets (SSOT)
    Ringization playbook
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Project configuration
    Public environment variables
    Order Lab secrets
    WalletConnect Project ID (Reown Cloud)
    Supported services
    NODUS wiki (project knowledge)
    Configuration playbook
    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 Deployment
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Backend Services
    Firebase Integration
    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
    Ring Oracle
    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
    Profile Account Widgets
    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
    Vertical Presets (SSOT)
    Ringization playbook
    Branding
    Themes
    Features
    Localization
    Token Economics Setup
    Payment Gateway Integration
    Reference Ring deployments
    Project configuration
    Public environment variables
    Order Lab secrets
    WalletConnect Project ID (Reown Cloud)
    Supported services
    NODUS wiki (project knowledge)
    Configuration playbook
    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 Deployment
    Docker
    Environment Configuration
    Monitoring & Analytics
    Performance Optimization
    Backup & Recovery
    Architecture
    Data Model
    Security
    Real Time
    Discovery Mutation Sync
    PaymentConductor architecture
    WalletConductor architecture
    Backend Services
    Firebase Integration
    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)
    Ring Platform Logo

    Loading documentation...

    Preparing Ring Platform content

    Ring Platform Logo

    Loading documentation...

    Preparing Ring Platform content

    Ring Platform Logo

    Loading documentation...

    Preparing Ring Platform content

    Data Model

    One article, two lenses. Use the Founder / Developer tabs in the docs sidebar to filter this page. Shared sections stay visible for both audiences; wrapped blocks show concepts or integration detail respectively.

    Ring Platform stores almost all application data in PostgreSQL using a JSONB-first document shape: every row is id + data + timestamps. That gives founders a flexible product model (add fields without migrations for every tweak) and gives developers a single db() contract across every Ring clone.

    What lives in the database?

    DomainWhat founders configureTypical clone scenarios
    Users & authRoles, profiles, credit balanceMember portals, gated content, admin consoles
    EntitiesOrganizations, vendor profiles, verified listingsDirectory, marketplace sellers, NGO profiles
    OpportunitiesJobs, grants, bounties, RFPsJob board, grant matcher, project marketplace
    Store & ordersMulti-vendor catalog, inventory, checkoutWhite-label shop, B2B catalog, subscription boxes
    Wallet & paymentsLedger, WayForPay/Stripe, membership creditsToken-gated perks, prepaid credits, affiliate payouts
    Messaging & notifyConversations, in-app + FCM pushBuyer–seller chat, opportunity alerts
    Content & CRMNews, email sequences, AI matcher hooksCommunity hub, publisher ring, opportunity notifications
    Platform settingsAI provider keys, branding, web3 oracleSUPERadmin namespace config per clone

    Why this model matters for your Ring clone

    When you ringize a deployment, you are not buying a rigid CRM schema. You inherit a proven marketplace + community skeleton that already connects:

    • People (users with roles from visitor → superadmin)
    • Organizations (entities — your "vendor", "partner", or "chapter" records)
    • Demand (opportunities — anything you'd post as a listing others apply to)
    • Commerce (store products, orders, PaymentConductor settlements)
    • Trust (reviews, verification flags, confidential tiers)
    • Operator config (platform settings namespaces — AI, branding, web3)

    Founder scenarios (generalized)

    Regional opportunity network

    Entities represent local businesses; opportunities are grants and contracts; AI matcher notifies relevant members.

    Multi-vendor marketplace

    Each entity can sell through the store module; orders and inventory share one Postgres cluster per clone.

    JSONB document contract

    Every core collection table follows the same physical layout (see data/schema.sql):

    Design rules:

    • id — Firebase UID, UUID string, or domain key (e.g. lowercase username in usernames).
    • data — all domain fields; query with data->>'field' and GIN indexes for hot paths.
    • Triggers — updated_at maintained cluster-wide; LISTEN/NOTIFY hooks for realtime adapters.

    Hybrid exception: platform_settings

    Most tables are pure JSONB-in-data. platform_settings is the only hybrid table with top-level secrets and updated_by columns:

    PostgreSQLAdapter splits writes automatically: public config → data, API keys → secrets, actor → updated_by. Services consume via db().readDoc / createDoc / updateDoc:

    ModuleNamespace examplesPath
    Platform settingsai, branding, matcherfeatures/admin/platform-settings/platform-settings-service.ts

    Related documentation

    Related documentation

    Data Validation

    Next-step: Zod schemas at the route boundary before JSONB lands.

    Backend modes and databases

    Prerequisite: when Postgres is primary vs Firebase-full; shared pool SSOT.

    k8s-postgres-fcm Mode

    Deep-dive: PostGIS setup, pool tuning, K8s deployment.

    Authentication Architecture

    Same-workflow: Auth.js tables live in the same JSONB model.

    Data Model

    One article, two lenses. Use the Founder / Developer tabs in the docs sidebar to filter this page. Shared sections stay visible for both audiences; wrapped blocks show concepts or integration detail respectively.

    Ring Platform stores almost all application data in PostgreSQL using a JSONB-first document shape: every row is id + data + timestamps. That gives founders a flexible product model (add fields without migrations for every tweak) and gives developers a single db() contract across every Ring clone.

    What lives in the database?

    DomainWhat founders configureTypical clone scenarios
    Users & authRoles, profiles, credit balanceMember portals, gated content, admin consoles
    EntitiesOrganizations, vendor profiles, verified listingsDirectory, marketplace sellers, NGO profiles
    OpportunitiesJobs, grants, bounties, RFPsJob board, grant matcher, project marketplace
    Store & ordersMulti-vendor catalog, inventory, checkoutWhite-label shop, B2B catalog, subscription boxes
    Wallet & paymentsLedger, WayForPay/Stripe, membership creditsToken-gated perks, prepaid credits, affiliate payouts
    Messaging & notifyConversations, in-app + FCM pushBuyer–seller chat, opportunity alerts
    Content & CRMNews, email sequences, AI matcher hooksCommunity hub, publisher ring, opportunity notifications
    Platform settingsAI provider keys, branding, web3 oracleSUPERadmin namespace config per clone

    Why this model matters for your Ring clone

    When you ringize a deployment, you are not buying a rigid CRM schema. You inherit a proven marketplace + community skeleton that already connects:

    • People (users with roles from visitor → superadmin)
    • Organizations (entities — your "vendor", "partner", or "chapter" records)
    • Demand (opportunities — anything you'd post as a listing others apply to)
    • Commerce (store products, orders, PaymentConductor settlements)
    • Trust (reviews, verification flags, confidential tiers)
    • Operator config (platform settings namespaces — AI, branding, web3)

    Founder scenarios (generalized)

    Regional opportunity network

    Entities represent local businesses; opportunities are grants and contracts; AI matcher notifies relevant members.

    Multi-vendor marketplace

    Each entity can sell through the store module; orders and inventory share one Postgres cluster per clone.

    JSONB document contract

    Every core collection table follows the same physical layout (see data/schema.sql):

    Design rules:

    • id — Firebase UID, UUID string, or domain key (e.g. lowercase username in usernames).
    • data — all domain fields; query with data->>'field' and GIN indexes for hot paths.
    • Triggers — updated_at maintained cluster-wide; LISTEN/NOTIFY hooks for realtime adapters.

    Hybrid exception: platform_settings

    Most tables are pure JSONB-in-data. platform_settings is the only hybrid table with top-level secrets and updated_by columns:

    PostgreSQLAdapter splits writes automatically: public config → data, API keys → secrets, actor → updated_by. Services consume via db().readDoc / createDoc / updateDoc:

    ModuleNamespace examplesPath
    Platform settingsai, branding, matcherfeatures/admin/platform-settings/platform-settings-service.ts

    Related documentation

    Related documentation

    Data Validation

    Next-step: Zod schemas at the route boundary before JSONB lands.

    Backend modes and databases

    Prerequisite: when Postgres is primary vs Firebase-full; shared pool SSOT.

    k8s-postgres-fcm Mode

    Deep-dive: PostGIS setup, pool tuning, K8s deployment.

    Authentication Architecture

    Same-workflow: Auth.js tables live in the same JSONB model.

    Data Model

    One article, two lenses. Use the Founder / Developer tabs in the docs sidebar to filter this page. Shared sections stay visible for both audiences; wrapped blocks show concepts or integration detail respectively.

    Ring Platform stores almost all application data in PostgreSQL using a JSONB-first document shape: every row is id + data + timestamps. That gives founders a flexible product model (add fields without migrations for every tweak) and gives developers a single db() contract across every Ring clone.

    What lives in the database?

    DomainWhat founders configureTypical clone scenarios
    Users & authRoles, profiles, credit balanceMember portals, gated content, admin consoles
    EntitiesOrganizations, vendor profiles, verified listingsDirectory, marketplace sellers, NGO profiles
    OpportunitiesJobs, grants, bounties, RFPsJob board, grant matcher, project marketplace
    Store & ordersMulti-vendor catalog, inventory, checkoutWhite-label shop, B2B catalog, subscription boxes
    Wallet & paymentsLedger, WayForPay/Stripe, membership creditsToken-gated perks, prepaid credits, affiliate payouts
    Messaging & notifyConversations, in-app + FCM pushBuyer–seller chat, opportunity alerts
    Content & CRMNews, email sequences, AI matcher hooksCommunity hub, publisher ring, opportunity notifications
    Platform settingsAI provider keys, branding, web3 oracleSUPERadmin namespace config per clone

    Why this model matters for your Ring clone

    When you ringize a deployment, you are not buying a rigid CRM schema. You inherit a proven marketplace + community skeleton that already connects:

    • People (users with roles from visitor → superadmin)
    • Organizations (entities — your "vendor", "partner", or "chapter" records)
    • Demand (opportunities — anything you'd post as a listing others apply to)
    • Commerce (store products, orders, PaymentConductor settlements)
    • Trust (reviews, verification flags, confidential tiers)
    • Operator config (platform settings namespaces — AI, branding, web3)

    Founder scenarios (generalized)

    Regional opportunity network

    Entities represent local businesses; opportunities are grants and contracts; AI matcher notifies relevant members.

    Multi-vendor marketplace

    Each entity can sell through the store module; orders and inventory share one Postgres cluster per clone.

    JSONB document contract

    Every core collection table follows the same physical layout (see data/schema.sql):

    Design rules:

    • id — Firebase UID, UUID string, or domain key (e.g. lowercase username in usernames).
    • data — all domain fields; query with data->>'field' and GIN indexes for hot paths.
    • Triggers — updated_at maintained cluster-wide; LISTEN/NOTIFY hooks for realtime adapters.

    Hybrid exception: platform_settings

    Most tables are pure JSONB-in-data. platform_settings is the only hybrid table with top-level secrets and updated_by columns:

    PostgreSQLAdapter splits writes automatically: public config → data, API keys → secrets, actor → updated_by. Services consume via db().readDoc / createDoc / updateDoc:

    ModuleNamespace examplesPath
    Platform settingsai, branding, matcherfeatures/admin/platform-settings/platform-settings-service.ts

    Related documentation

    Related documentation

    Data Validation

    Next-step: Zod schemas at the route boundary before JSONB lands.

    Backend modes and databases

    Prerequisite: when Postgres is primary vs Firebase-full; shared pool SSOT.

    k8s-postgres-fcm Mode

    Deep-dive: PostGIS setup, pool tuning, K8s deployment.

    Authentication Architecture

    Same-workflow: Auth.js tables live in the same JSONB model.

    Membership + credits

    User JSONB holds credit_balance; wallet transactions provide an audit trail for top-ups and spends.

    Confidential deal room

    Role confidential plus entity/opportunity visibility flags — same tables, stricter layout gates.

    Operator takeaway

    You do not need separate databases per feature. Postgres + JSONB lets each clone emphasize store, opportunities, or community without forking the codebase. Schema SSOT: data/schema.sql (v4.0.3).

    Ring token oracleweb3features/wallet/services/native-token-oracle.ts
    Do not bypass db()

    Never write raw SQL or instantiate a private pg.Pool for platform_settings. The adapter hybrid path is the only supported write surface.

    DatabaseService (application API)

    All server code goes through db() from @/lib/database — never raw SQL in route handlers (except PostGIS via getSharedPgPool()).

    readDoc / queryDocs return { success, data, error }. error is an Error object, not a string. Throw on failure in services; Server Actions may map to { error: string } for forms only.

    Email CRM via jsonb-collection

    The email CRM feature does not open its own database connection. features/email-crm/lib/jsonb-collection.ts wraps db().*Doc:

    HelperDelegates to
    readDocdb().readDoc
    upsertDocdb().readDoc + updateDoc or createDoc
    queryDocsdb().queryDocs
    deleteDocdb().deleteDoc

    Repositories (jsonb-contact-repository.ts, jsonb-draft-repository.ts, etc.) import from jsonb-collection.ts — same JSONB row shape as other collections.

    Entity-relationship map (logical)

    Ring Platform — core Postgres collections

    Apply schema to a fresh database

    1. 1

      Locate SSOT

      Single file: data/schema.sql (v4.0.3). Do not use deprecated scripts/postgres-schema.sql.

    2. 2

      Apply on cluster or local Postgres

    3. 3

      Set backend mode

      Production rings use DB_BACKEND_MODE=k8s-postgres-fcm. See Backend modes and databases.

    Query and index patterns

    • Filter JSONB: (data->>'status') = 'open' with btree expression indexes on hot keys.
    • Full-text: opportunities table includes search vectors (see schema comments).
    • Geospatial: PostGIS via lib/geolocation/geolocation-service.ts and getSharedPgPool() — not private pools.

    Deep dive: AI-CONTEXT/concepts/database/query-patterns.json and Discovery & mutation sync.

    PaymentConductor architecture

    Depends-on: orders and payments JSONB plus webhook idempotency.

    Entities

    See-also: product-facing entity profiles on the same collection pattern.

    Admin Wiki

    Same-workflow: wiki_pages / wiki_links / wiki_events use id + data JSONB like other collections.

    Membership + credits

    User JSONB holds credit_balance; wallet transactions provide an audit trail for top-ups and spends.

    Confidential deal room

    Role confidential plus entity/opportunity visibility flags — same tables, stricter layout gates.

    Operator takeaway

    You do not need separate databases per feature. Postgres + JSONB lets each clone emphasize store, opportunities, or community without forking the codebase. Schema SSOT: data/schema.sql (v4.0.3).

    Ring token oracleweb3features/wallet/services/native-token-oracle.ts
    Do not bypass db()

    Never write raw SQL or instantiate a private pg.Pool for platform_settings. The adapter hybrid path is the only supported write surface.

    DatabaseService (application API)

    All server code goes through db() from @/lib/database — never raw SQL in route handlers (except PostGIS via getSharedPgPool()).

    readDoc / queryDocs return { success, data, error }. error is an Error object, not a string. Throw on failure in services; Server Actions may map to { error: string } for forms only.

    Email CRM via jsonb-collection

    The email CRM feature does not open its own database connection. features/email-crm/lib/jsonb-collection.ts wraps db().*Doc:

    HelperDelegates to
    readDocdb().readDoc
    upsertDocdb().readDoc + updateDoc or createDoc
    queryDocsdb().queryDocs
    deleteDocdb().deleteDoc

    Repositories (jsonb-contact-repository.ts, jsonb-draft-repository.ts, etc.) import from jsonb-collection.ts — same JSONB row shape as other collections.

    Entity-relationship map (logical)

    Ring Platform — core Postgres collections

    Apply schema to a fresh database

    1. 1

      Locate SSOT

      Single file: data/schema.sql (v4.0.3). Do not use deprecated scripts/postgres-schema.sql.

    2. 2

      Apply on cluster or local Postgres

    3. 3

      Set backend mode

      Production rings use DB_BACKEND_MODE=k8s-postgres-fcm. See Backend modes and databases.

    Query and index patterns

    • Filter JSONB: (data->>'status') = 'open' with btree expression indexes on hot keys.
    • Full-text: opportunities table includes search vectors (see schema comments).
    • Geospatial: PostGIS via lib/geolocation/geolocation-service.ts and getSharedPgPool() — not private pools.

    Deep dive: AI-CONTEXT/concepts/database/query-patterns.json and Discovery & mutation sync.

    PaymentConductor architecture

    Depends-on: orders and payments JSONB plus webhook idempotency.

    Entities

    See-also: product-facing entity profiles on the same collection pattern.

    Admin Wiki

    Same-workflow: wiki_pages / wiki_links / wiki_events use id + data JSONB like other collections.

    Membership + credits

    User JSONB holds credit_balance; wallet transactions provide an audit trail for top-ups and spends.

    Confidential deal room

    Role confidential plus entity/opportunity visibility flags — same tables, stricter layout gates.

    Operator takeaway

    You do not need separate databases per feature. Postgres + JSONB lets each clone emphasize store, opportunities, or community without forking the codebase. Schema SSOT: data/schema.sql (v4.0.3).

    Ring token oracleweb3features/wallet/services/native-token-oracle.ts
    Do not bypass db()

    Never write raw SQL or instantiate a private pg.Pool for platform_settings. The adapter hybrid path is the only supported write surface.

    DatabaseService (application API)

    All server code goes through db() from @/lib/database — never raw SQL in route handlers (except PostGIS via getSharedPgPool()).

    readDoc / queryDocs return { success, data, error }. error is an Error object, not a string. Throw on failure in services; Server Actions may map to { error: string } for forms only.

    Email CRM via jsonb-collection

    The email CRM feature does not open its own database connection. features/email-crm/lib/jsonb-collection.ts wraps db().*Doc:

    HelperDelegates to
    readDocdb().readDoc
    upsertDocdb().readDoc + updateDoc or createDoc
    queryDocsdb().queryDocs
    deleteDocdb().deleteDoc

    Repositories (jsonb-contact-repository.ts, jsonb-draft-repository.ts, etc.) import from jsonb-collection.ts — same JSONB row shape as other collections.

    Entity-relationship map (logical)

    Ring Platform — core Postgres collections

    Apply schema to a fresh database

    1. 1

      Locate SSOT

      Single file: data/schema.sql (v4.0.3). Do not use deprecated scripts/postgres-schema.sql.

    2. 2

      Apply on cluster or local Postgres

    3. 3

      Set backend mode

      Production rings use DB_BACKEND_MODE=k8s-postgres-fcm. See Backend modes and databases.

    Query and index patterns

    • Filter JSONB: (data->>'status') = 'open' with btree expression indexes on hot keys.
    • Full-text: opportunities table includes search vectors (see schema comments).
    • Geospatial: PostGIS via lib/geolocation/geolocation-service.ts and getSharedPgPool() — not private pools.

    Deep dive: AI-CONTEXT/concepts/database/query-patterns.json and Discovery & mutation sync.

    PaymentConductor architecture

    Depends-on: orders and payments JSONB plus webhook idempotency.

    Entities

    See-also: product-facing entity profiles on the same collection pattern.

    Admin Wiki

    Same-workflow: wiki_pages / wiki_links / wiki_events use id + data JSONB like other collections.

    1. Docs
    2. /Architecture
    3. /Data Model

    Updated Jul 7, 20264 min listen

    1. Docs
    2. /Architecture
    3. /Data Model

    Updated Jul 7, 20264 min listen

    1. Docs
    2. /Architecture
    3. /Data Model

    Updated Jul 7, 20264 min listen