Platform Architecture & Multi-Tenant Stack
Comprehensive architectural guide to Cora’s high-performance PHP framework backend runtime, Next.js 16 SSG edge layer, and isolated MySQL schemas.
Cora is engineered as an enterprise-grade autonomous operating system for Indian creative studios and agencies. It operates on a hybrid decoupled architecture where a high-performance Next.js marketing and documentation layer is paired with a resilient, high-performance PHP 8.2 framework backend runtime.
1. System Overview
The Cora platform consists of four primary decoupled layers:
- Next.js Static/SSG Front-End (`heycora.in`):
- Built on Next.js 16 (App Router) with Turbopack.
- Deployed on LiteSpeed Web Server as pre-rendered static HTML/CSS/JS.
- Sub-50ms Time-To-First-Byte (TTFB) globally with zero server compute overhead.
- Houses the public website, interactive comparison benchmarks, calculator tools, and Developer Documentation Hub (/docs).
- Enterprise PHP Application Engine (`app.heycora.in` & `cora.local`):
- Single, consolidated backend workspace engine (cora-workspace) containing all 20+ operational modules.
- Custom Single Page Application (SPA) shell rendered at /workspace/dashboard.
- Zero dependency on external bloated third-party plugins.
- Autonomous AI & RAG Engine:
- Google Gemini 3.5 Flash and Claude 3.5 Sonnet integrations.
- Vector-less SQLite/MySQL keyword-dense semantic chunking database.
- Bidirectional Model Context Protocol (MCP) JSON-RPC 2.0 gateway.
- PWA Mobile Shell & Push Layer (v3.2.46):
- Dynamic cora-manifest.json generated with agency white-label assets.
- Root-scoped Service Worker (cora-service-worker.js) with Network-First navigation and Cache-First static asset caching.
- VAPID ES256 self-signed Web Push protocol without external messaging servers.
┌─────────────────────────────────────────────────────────────┐
│ EDGE LAYER (CLOUDFLARE) │
└──────────────┬──────────────────────────────┬───────────────┘
│ │
[heycora.in/*] [app.heycora.in/*]
▼ ▼
┌─────────────────────────────┐ ┌─────────────────────────────┐
│ Next.js 16 SSG Frontend │ │ PHP Framework / LiteSpeed │
│ - Marketing Site │ │ - Single 'cora-workspace' │
│ - Interactive Benchmarks │ │ - 20+ Modular Views (SPA) │
│ - Developer Docs (/docs) │ │ - REST API & VAPID Push │
└─────────────────────────────┘ └──────────────┬──────────────┘
│
[Agency-Scoped SQL]
▼
┌─────────────────────────────┐
│ MySQL Database (cora_*) │
└─────────────────────────────┘2. Hybrid Routing & Subdomains
Inbound requests are handled via strict virtual host separation:
| Host / Subdomain | Target Layer | Handler File | Purpose |
|---|---|---|---|
heycora.in | Next.js Frontend | out/index.html, out/docs/* | Marketing, Docs, Tools |
app.heycora.in | PHP Framework Backend | cora-workspace.php | Production SaaS Tenant SPA |
staging.heycora.in | Staging Instance | cora-workspace.php | QA & Feature Release Previews |
cora.local | Local Docker Environment | admin-dashboard.php | Local Development & Tests |
3. Multi-Tenant Database Isolation
All business data is strictly isolated by agency_id (Tenant Workspace Identifier). Every query executed by the workspace engine explicitly enforces:
SELECT * FROM wp_cora_leads
WHERE agency_id = %d AND status = 'active'
ORDER BY created_at DESC;Cross-tenant leakage is prevented at both the database abstraction layer and the REST authentication middleware.
4. LiteSpeed & PWA Caching
- Static Cache: CSS and JS bundles are stamped with dynamic version parameters (
?v=CORA_WORKSPACE_VERSION) to guarantee immediate browser updates without stale cache collisions. - Cache Invalidation: On deployment (
python3 scripts/deploy_frontend.py), LiteSpeed cache tags are flushed instantly. - Service Worker Lifecycle: On new version release,
cora-service-worker.jsautomatically callsself.skipWaiting()and purges outdated cache buckets within 300ms.
5. Zero-Trust Security Model
- No Browser Defaults: The system uses monochromatic custom toast banners (
window.coraShowToast) and sliding drawers instead of native popup overlays. - Role Capability Checks: Every AJAX and REST handler verifies
current_user_can()against a granular 30-point security matrix. - SHA-256 Hashes: Document vault agreements and audit log records include cryptographically verifiable integrity checksums.
6. Marketing Reform & Discovery Layer
Cora bridges client-facing website generation and private agency management into a seamless experience:
- Homepage Positioning: *"Build websites. Run your business, with an AI co-founder."*
- Dual Conversion Engine: Primary "Sign in with Google" OAuth for rapid workspace creation, and secondary "Explore free templates" routing directly into the 16+ turnkey pre-seeded schemas at
/industries. - Tools & Templates Architecture: The marketing navigation elevates free business calculators (18% GST calculator, retainer margin tool, proposal generator) alongside production website and workspace templates with instant lead capture bridge into
wp_cora_leads.
7. Sticky AI SDR Sales Assistant
Mounted via React Portal (createPortal) directly into the document root:
- True Viewport Docking: Floats centered at the bottom viewport edge with zero backdrop overlay, avoiding parent container clipping or scroll interference.
- Objection Handling Vectors: Addresses platform switching concerns (e.g. HoneyBook/Notion vs Cora, free white-glove site migrations, annual discount codes, and multi-plugin elimination).
- Dynamic Conversion Coupons: Automatically generates actionable coupon cards (
MIGRATEFREE,CORA10) with direct checkout links pre-populating discount parameters into/pricing.
8. 4-Tier Template & Asset Ecosystem
The /templates directory provides 16+ production-grade frontend assets across 4 distinct formats:
- Native Landing Pages (`native_page`): Pure Tailwind CSS and Next.js 15 pages featuring sub-50ms paint times and accessible components.
- AI Section Prompts (`section_prompts`): Token-engineered prompts for Claude 3.5 Sonnet and Cursor Composer.
- Elementor Template Kits (`elementor_kit`): Standardized Elementor JSON blueprints for instant page builder import.
- Lovable & React Projects (`lovable_project`): Rapid full-stack scaffolding configurations for Lovable.dev and v0.dev.
9. Forms Architect & Universal All Entries Registry (v4.9.372)
- Ergonomic Form Cards: Overhauled card padding (
p-5 sm:p-6), clickable card surface navigating to form editor, and unlocked mobile form editing. - In-App Live Preview Modal: Sandboxed viewport simulator (
Desktop,Mobile) with direct embed URL launcher. - Universal 5th Tab (`#all-entries`): Unified submissions repository with real-time KPI counter cards, Notion-style multi-form filter toolbar, fixed column width table preventing layout blowout, and multi-form dynamic CSV exports.
10. Edge-Docked Inspector & Timezone Engine (v4.9.374)
- Edge Docking: Slides smoothly from right edge on desktop (
w-[480px] max-w-[90vw]) and bottom sheet on mobile (h-[85vh]) with zero backdrop blur, keeping background records completely visible. - Data Rendering: Renders inline digital signatures and image thumbnails (
<img src="...">) rather than dumping 50,000-character raw text blobs. - Client Timezone Engine: Automatically evaluates browser timezone using
Intl.DateTimeFormat().resolvedOptions().timeZoneto render human-readable relative and absolute timestamps.
11. Dynamic Referral Tracking & Checkout Discounts (v4.9.374)
- Attribution API: Dedicated REST endpoint
POST /wp-json/cora/v1/referrals/trackwith frontend proxy route. - Multi-Parameter Capture: Ingests referral codes (
cora_ref,ref,via,partner) and stores 30-day secure cookies. - Automatic Checkout Discounts: Automatically applies 10%–20% coupon discount deductions across pricing checkout sheets with dual conversion attribution to Endorsely and Cora backends.
12. Canonical Industry Solutions & 301 Redirects (v4.9.380)
- Directory Migration: Migrated primary industry hub from
/use-casesto canonical/industries. - Backward-Compatible 301 Redirects: Configured in
.htaccessand Next.js routing, guaranteeing all legacy/use-caseslinks permanently redirect with 100% SEO link equity. - 10+ Verified Vertical Schemas: Complete plain-English active-voice directories across Real Estate, Photography, Architecture, Creative Agency, Consulting, Salons, Fitness, Events, Hospitality, and DTC E-Commerce.
- Desktop Mega-Menu: Multi-column dropdown in
Navbar.tsxwith dedicated icon tiles and subtle colored pill indicators.
13. Autonomous AI Workforce & Infinite Skills Marquee (v4.9.379)
- Dedicated AI Agent Hub (`/ai-agent`): Visualizes Cora's multi-agent autonomous workforce.
- Neural Portrait Blended Cutout: Seamless high-DPI portrait cutout (
cora_hero_agent_cutout.png) blended into the canvas container with responsive gradient lighting. - 4-Row Infinite Skills Marquee: Hardware-accelerated CSS marquee (
InfiniteSkillsSection.tsx) highlighting verified capabilities across Operations, Sales, Finance, and Creative Delivery.
14. Features Catalog & Lenis Scroll Boundary Isolation (v4.9.378)
- Directory Overhaul (`/features`): High-density directory presenting 40+ operational modules.
- Lenis Smooth-Scroll Boundary Isolation (`data-lenis-prevent`): Encapsulates the features sidebar to isolate inner wheel and touch scroll from global Lenis page scrolling, eliminating scroll trapping.
- High-Density Sidebar Navigation: Single-line items with segmented status filters (*All*, *Released*, *Beta*, *Upcoming*) and zero-overlap search input icons.
15. Enterprise Brand Registry & Turnkey SVG Kit (v4.9.377)
- Brand Asset Center (`/brand`): Complete brand guidelines, typographic hierarchy, and neutral zinc color tokens.
- 1-Click Turnkey SVG Download Kit: Raw inline SVG clipboard copy and instant
.svgfile downloads for Primary, Inverted, and Symbol wordmarks.
Have questions about this module?
Our founding engineering team answers developer inquiries directly.