Supabase Edge Functions (Microservices)
Relevant source files
The following files were used as context for generating this wiki page:
Supabase Edge Functions serve as the serverless microservices layer within the TAMV Atlas ecosystem. These functions handle critical backend logic, including identity verification (ID-NVIDA), governance (CITEMESH), economic transactions (TCEP), and cross-repository synchronization. They operate as part of the MD-X4/X5 architectural framework, providing an antifragile and zero-trust backend infrastructure.
Sources: README.md:14-22, src/pages/wiki/implementacion/CicdPipelines.tsx:112-120, federation/tamv-digital-nexus/supabase/functions/tamv-unified-api/index.ts:1-5
Architectural Overview
The microservices architecture is decentralized across multiple specialized edge functions. These functions interact with Supabase PostgreSQL databases and external APIs (like GitHub) to maintain the "Civilizatory Operating System." The tamv-unified-api acts as an entry point for core modules, while tamv-fusion-core manages health checks and content synchronization across the federated network.
The diagram above illustrates the routing of requests through the edge function layer to specific modules.
Sources: federation/tamv-digital-nexus/supabase/functions/tamv-unified-api/index.ts:31-40, federation/tamv-digital-nexus/supabase/functions/tamv-fusion-core/index.ts:121-135
Key Microservices and Modules
The project maintains a catalog of over 30 edge functions for various specialized tasks.
TAMV Unified API
This function serves as the "Omni-Modus Civilizatory Operating System" backend, implementing several critical modules via distinct path routing.
| Module | Paths | Key Responsibilities |
|---|---|---|
| Identity (ID-NVIDA) | /id/me, /id/dignity | Dignity score calculation, user identity retrieval. |
| Governance | /governance/roles, /dao/proposals | Role management, DAO proposal creation and voting. |
| Economy (TCEP) | /economy/wallet, /economy/transfer | Wallet balance management and peer-to-peer transfers. |
| MSR Ledger | /msr/events, /msr/log | Immutable logging of civilizatory actions with SHA-256 hashes. |
| Sentinel | /sentinel/status | Monitoring threat levels and PQC (Post-Quantum Cryptography) shields. |
Sources: federation/tamv-digital-nexus/supabase/functions/tamv-unified-api/index.ts:41-175, public/federation-manifest.json:198-232
TAMV Fusion Core
The Fusion Core acts as an orchestrator for MD-X4 v2026. It performs automated health checks on critical routes and database tables, ensuring the system remains operational.
The sequence shows the periodic lifecycle of a Fusion Cycle.
Sources: federation/tamv-digital-nexus/supabase/functions/tamv-fusion-core/index.ts:51-119
Implementation Details
Security and Headers
Functions utilize standard CORS headers to allow cross-origin requests from the TAMV frontend and other federated nodes. Authentication is handled via Supabase Auth headers, specifically utilizing the SUPABASE_ANON_KEY or SUPABASE_SERVICE_ROLE_KEY.
const corsHeaders = {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Headers":
"authorization, x-client-info, apikey, content-type, x-supabase-client-platform, x-supabase-client-platform-version, x-supabase-client-runtime, x-supabase-client-runtime-version",
};
Sources: federation/tamv-digital-nexus/supabase/functions/tamv-fusion-core/index.ts:8-12, federation/tamv-digital-nexus/supabase/functions/tamv-unified-api/index.ts:5-8
MSR Event Logging
A core feature of the edge functions is the registration of actions into the Master Sequence Record (MSR). Every critical action (transfers, proposals, sync cycles) generates an evidence hash.
async function registerMsrEvent(report: FusionReport): Promise<string | undefined> {
const evidenceHash = await crypto.subtle
.digest("SHA-256", new TextEncoder().encode(JSON.stringify(report)))
.then((buf) =>
Array.from(new Uint8Array(buf))
.map((b) => b.toString(16).padStart(2, "0"))
.join("")
);
const { data, error } = await supabase
.from("msr_events")
.insert({
action: "TAMV_FUSION_CYCLE",
domain: "GENERAL",
payload: report as any,
evidence_hash: evidenceHash,
severity: report.health.warnings.length > 3 ? "warn" : "info",
});
}
Sources: federation/tamv-digital-nexus/supabase/functions/tamv-fusion-core/index.ts:89-114, federation/tamv-digital-nexus/supabase/functions/tamv-unified-api/index.ts:162-171
Deployment and CI/CD Pipeline
Edge functions are subject to the MD-X5 (Deca-V) pipeline, which enforces a 10-cycle validation process before deployment to production. This includes linting, typechecking, security scanning via DEKATEOTL gates, and artifact signing.
| Cycle | Action | Description |
|---|---|---|
| 1-2 | Static Analysis | ESLint (plugin-tamv) and TypeScript check. |
| 5 | Contract Test | Verification of contracts between modules. |
| 6 | Security Scan | DEKATEOTL security gates. |
| 10 | Post-Deploy | Automatic verification and rollback gate. |
Sources: src/pages/wiki/implementacion/CicdPipelines.tsx:48-61
Conclusion
Supabase Edge Functions in the TAMV project are more than simple endpoints; they are the functional enforcement of the "Civilizatory Operating System." By integrating health monitoring, identity management, and immutable logging (MSR) into serverless microservices, the project ensures high availability and technical traceability across its federated infrastructure.