Koovira Dev Docs
00-architecture/overview.md

Platform Architecture Overview

Validated against code + live DB on 2026-09-06.

Koovira is a modular local-commerce + social super-platform for India: one account and one wallet across ~20 verticals (commerce, food, hotels, rides, real estate, jobs, services, classifieds, events, social, dating, and more), plus cross-cutting engines (trust, credit score, endorsements, negotiation, comparison, universal-entry/radar) and a merchant business suite (CRM, POS, marketing, website builder, developer APIs).

This page is the map. Each subsystem links to its detailed page.


Technical architecture (validated)

  • Stack: PHP 8.3 on nginx (prod) / Laragon (local); MariaDB 10.11 (koovira_newmasterdb_opt,

1,797 tables); Redis 7. No CDN by house rule — assets are served locally/bundled.

  • Not a framework app. There is no Laravel/Symfony router or ORM. It is a large PHP codebase

organized by convention:

  • Front-end pages = root *.php (733 files) — e.g. mycart.php, ecomproductlist.php.

Each includes config/common_includes.php and renders server-side.

  • Business logic = classs/ (461 class files) — e.g. CommerceOrdersModule.php,

WalletModule.php, CommissionEngineModule.php. These hold the real logic and DB writes.

  • Write dispatch = forms/doaction_*.php — most state-changing actions POST to a

doaction_<area>.php dispatcher which validates and calls a classs/ module.

  • JSON/AJAX APIs = api/ (internal, session-based) and api/developer/ + api/v1/

(external, token-based via the developer platform / OIDC).

  • Admin = padmin/ (super-admin back office); Merchant = merchant/ (business suite).
  • Background = cron/ scripts (see the Cron/Background section — to be documented).
  • DB access = a single guarded $conn (KVGuardedPDO) everywhere; DDL is blocked on the web

tier. Details: bootstrap-and-config.md.

  • Identity of a row = rowId (not id) on most tables; relationships are convention-based

(few declared FK constraints). Details: database.md.


The core domains and where they live

DomainWhat it isPrimary codePrimary tablesDoc
Identity / authsignup, login, OTP, social login, sessionsclasss/KvIdentityProvisioner.php, login.php, api/otp-verification.phpcustomer_master10-actors + auth (to add)
Users & rolescustomer vs merchant vs staff vs admin; sub-profilesclasss/AdminUserManagerModule.phpcustomer_master, company_master../10-actors/README.md
Module controlwhich verticals are on/visible; enrollment types—kv_module_control (22), kv_module_registry (23)module-registry.md
Membershipplans, gating, renewalclasss/Membership, kv_membership_plans (77)kv_membership_plans, wallet_user_membershipscore (to add)
KYC / trustverification, trust scoreclasss/ClaimKycModule.php, KooviraTrustScoreEngine.phpkyc_submissions, ai_trust_scorescore (to add)
Walletone wallet per user; store credit (KCredits)classs/WalletModule.phpwallet_accounts (6), wallet_transactions (161)../40-financial/
Money ledgercentral double-entry order financeclasss/CommerceOrdersModule.php finance methodskv_order_finance_master (63), kv_order_finance_entries (488)central-finance-ledger.md
Commissionplatform take per moduleclasss/CommissionEngineModule.phpplatform_commission_settings (11), commission_transactions (92)../40-financial/
Accountingdouble-entry booksclasss/AccountingEngine.phpaccounting_journaladmin (to add)
Notificationsin-app/push/email/SMS/WhatsAppclasss/PushNotificationModule.php, KvMailService.php, KvWhatsAppCloud.phpfp_notify, email_queuenotifications (to add)
Modules (verticals)commerce, food, hotels, …classs/<X>Module.php<x>_* tables../20-modules/README.md
Search / locationsearch, radar, geoclasss/KooviraLocation.php, forms/doaction_radar.phppostal_code_master (158,141), kv_ue_supplysearch (to add)
AI / BramhaAI assistant + servicesclasss/KvAiPlatform.phpkv_ai_servicesai (to add)
Developer platformexternal REST APIs, OAuthclasss/DeveloperApiModule.php, api/developer/kv_api_endpoints, kv_api_scopes, kv_api_clientsdevportal/index.php

Row counts are 2026-09-06 snapshots. Tables marked "(to add)" are validated targets for the next documentation passes — see ../STATUS.md.

Corrected 2026-09-06 (re-audit, later same day): wallet_accounts/wallet_transactions/ kv_order_finance_master/kv_order_finance_entries were re-counted against the live DB (this is an actively-written dev DB — concurrent QA/test-harness runs move these numbers within the same day, per ../METHODOLOGY.md's "date every count" rule); the earlier snapshot read 7 / 142 / 62 / 484, the numbers above are the live recount. Also corrected: postal_code_master was cited here as "153k" (an imprecise rounding, wrong even at write time) — the exact, live-verified count is 158,141, matching search-location-radar.md.

The three cross-cutting invariants

Everything in this platform obeys these. Violate them and money or isolation breaks.

  1. One wallet, wallet-first money. No module integrates a payment gateway directly. Money

flows Gateway → Koovira Wallet → module. Store credit is KCredits (1₹ = 1 KCredit, closed-loop).

  1. One order-finance ledger, polymorphic key. Every module's order money is recorded in

kv_order_finance_master/_entries keyed by (module_key, order_table, order_id) — because **order IDs are only unique within a module's own *_orders table** and collide across modules. Always match module + id, never id alone.

  1. Schema changes only through the migration system. The web/cron/deploy tiers cannot run DDL

(KVGuardedPDO). All DDL is padmin-gated.


How to read this documentation for a task

  • "How does feature X work end-to-end?" → the module's overview.md + its flow file + code-map.md.
  • "What does table T store and who writes it?" → 90-database/tables/T.md (generated) + the owning

module's data-model.md.