Edge Functions
Relevant source files
The following files were used as context for generating this wiki page:
Edge Functions in the TAMV MD-X4 ecosystem serve as the serverless backend layer, providing scalable, low-latency execution for critical system logic. These functions are deployed via Lovable Cloud and Supabase, handling diverse responsibilities including identity management, economic transactions, content synchronization, and system health orchestration.
The architecture follows a modular approach where each function encapsulates a specific domain of the "Omni-Modus Civilizatory Operating System." Key modules include the Unified API for cross-domain operations, Fusion Core for health monitoring, and specialized security functions like Dekateotl Security for post-quantum protection.
Sources: README_TAMV_COMPLETO.md:14-22, supabase/functions/tamv-unified-api/index.ts:1-2
Core Orchestration: TAMV Fusion Core
The tamv-fusion-core acts as the primary orchestrator for the MD-X4 ecosystem. It is responsible for executing health checks across system routes, verifying database integrity, and triggering content synchronization cycles.
Functional Components
- Health Check: Validates the availability of critical frontend routes (e.g.,
/dashboard,/isabella,/economy) and ensures critical database tables are accessible. - MSR Registry: Every fusion cycle generates a report that is hashed and stored in the
msr_eventstable for auditability. - Service Integration: It programmatically calls other edge functions, such as
tamv-content-sync, to maintain ecosystem state.
The diagram shows the sequential phases of the TAMV Fusion Core cycle.
Sources: supabase/functions/tamv-fusion-core/index.ts:1-125
TAMV Unified API (Omni-Modus)
The Unified API is the central gateway for the Civilizatory Operating System. it handles requests across multiple domains using a path-based routing system.
Domain Modules
The API is divided into several high-level modules:
- Identity (ID-NVIDA): Manages user dignity scores and reputation levels.
- Governance (CITEMESH): Handles DAO proposals, voting mechanisms, and role assignments.
- Economy (TCEP): Processes transfers, calculates membership-based commissions, and manages the Fenix Fund.
- Sentinel (Anubis): Provides status reports on threat levels and post-quantum cryptographic shields.
| Module | Endpoint | Method | Description |
|---|---|---|---|
| Identity | /id/me | GET | Retrieves current user's identity data. |
| Economy | /economy/transfer | POST | Executes TCEP credit transfers between users. |
| Governance | /dao/vote | POST | Casts a vote on a specific proposal with logic for incrementing counts. |
| Sentinel | /sentinel/status | GET | Returns the status of active monitors (HORUS, QUETZALCOATL). |
Sources: supabase/functions/tamv-unified-api/index.ts:43-200
Content Sync and DigyTAMV
The tamv-content-sync function is responsible for indexing and classifying technical documentation from GitHub repositories and external blogs into the Supabase content_index.
Data Flow
- GitHub Ingestion: Fetches repository data from configured sources like
tamv-universe-onlineandweb-4-genesis. - Blog Extraction: Scrapes post titles and snippets from the TAMV Online Network blog.
- Classification: Assigns metadata such as
module_target(core, ia, security, etc.) and maturity status (draft, validated, canon).
This sequence diagram illustrates the parallel fetching and subsequent storage of ecosystem documentation.
Sources: supabase/functions/tamv-content-sync/index.ts:10-100, 02_MODULOS/M06_CONTENT/INTERNO/CONTENT-SYNC-SPEC.md:40-65
Security and Authentication
Edge Functions utilize a multi-layered security approach. Every function includes CORS headers to restrict access and utilizes Supabase Auth for identity verification.
Key Security Implementations
- ID-NVIDA Validation: Functions check for a valid
Authorizationheader and retrieve theuserIdviasupabase.auth.getUser(). - Evidence Hashing: Significant actions (like transfers or DAO proposals) generate a SHA-256 hash of the payload, which is stored in the
msr_eventstable to prevent tampering. - CORS Configuration:
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
};
Sources: supabase/functions/tamv-unified-api/index.ts:5-25, supabase/functions/tamv-fusion-core/index.ts:8-12, DEPLOYMENT_GUIDE.md:162-167
Summary
Edge Functions constitute the operational backbone of the TAMV MD-X4 ecosystem. By centralizing logic for identity, economy, and system health into serverless environments, the project ensures high availability and consistency. The integration with MSR (Modular Sovereign Registry) through evidence hashing ensures that every server-side operation is traceable and compliant with the system's constitutional quality controls.
Sources: README_TAMV_COMPLETO.md:10-25, supabase/functions/tamv-fusion-core/index.ts:1-5