Developing New TAMV Modules
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
Developing new modules within the TAMV (Territorio de Alta Movilidad Virtual) ecosystem involves integrating into a "Heptafederated Kernel" (MD-X4), which coordinates seven distinct operational domains: Educational, Cultural, Economic, Technological, Health, Communication, and Governmental. The platform is built on a React + Vite + Supabase stack, utilizing Edge Functions for critical logic and a domain-driven store architecture.
New modules must adhere to the project's mission of building a sovereign digital infrastructure for "Smart Territories." This requires aligning with the defined federation structures, persisting data through Supabase migrations, and connecting to the central command dashboard through standard routing and state management patterns.
Sources: README.md:4-18, README.md:104-108
Core Architecture and Federation Integration
Every new feature must be classified into one of the seven federations. This classification governs the module's domain, icon, and operational logic within the public.federations table.
The 7 Federations Model
The following table outlines the existing federations that a new module must target:
| Federation | Domain | Key Modules / Responsibilities |
|---|---|---|
| Educativa | edu.rdm.tamv | UTAMV, Aulas vivas, Masterclass |
| Cultural | cul.rdm.tamv | Manuscrito, Archivo oral, Patrimonio |
| Económica | eco.rdm.tamv | Mercado, Stripe Integration, Cooperativas |
| Tecnológica | tec.rdm.tamv | Kernel, Isabella AI, GitHub Sync |
| Salud | sal.rdm.tamv | Bienestar, Herbolaria, Rutas seguras |
| Comunicación | com.rdm.tamv | Blog, Radio, Prensa |
| Gubernamental | gob.rdm.tamv | Consejo, MSR (Multi-State Record), BookPI |
Sources: supabase/migrations/202605080001_lovable_federated_kernel.sql:107-115, src/App.tsx:50-57
Module Registration Flow
The system uses a standardized flow for registering and executing module logic, primarily through Supabase Edge Functions and centralized routing.
The diagram above shows how a new module's frontend interacts with domain-specific stores and Edge Functions to persist data and update the global federation state.
Sources: README.md:73-81, src/stores/network.ts:89-114
Implementation Guidelines
1. Data Modeling and Migrations
New modules requiring persistence must define their schema in supabase/migrations. Standardized tables like digital_twins or protocol_executions should be used if the module relates to territorial modeling or governed actions.
- Security: Every table must enable Row Level Security (RLS).
- Auditability: Significant operations should be recorded in
public.audit_signaturesorpublic.protocol_executionswith SHA-256 hashing.
Sources: supabase/migrations/202605080001_lovable_federated_kernel.sql:13-75, supabase/migrations/202605080001_lovable_federated_kernel.sql:95-98
2. State Management (TAMV Stores)
Modules should utilize the createTamvStore utility to maintain domain state. For example, a module involving network interactions would implement a store similar to the networkStore.
// Example from network store
export const networkStore = createTamvStore<NetworkState>((set, get) => ({
status: "online",
nodes: initialNodes,
// ... methods to update state
getHealth: () => calculateHealth(get()),
}));
Sources: src/stores/network.ts:89-91, src/stores/network.ts:114
3. Frontend Integration and Routing
New modules are integrated into the main application via src/App.tsx. They are typically wrapped in an AppShell and may use ModulePlaceholder for initial development.
- Route Path: Modules should be nested under
/app/. - Lazy Loading: Use
React.lazyfor page components to optimize performance. - Icons: Use
lucide-reacticons consistent with the federation's theme.
Sources: src/App.tsx:9-19, src/App.tsx:43-60
4. Edge Function Development
Business logic that requires elevated privileges or external integrations (like GitHub Sync or Stripe) must be implemented as Deno-based Supabase Edge Functions.
| Function | Purpose |
|---|---|
federation-state | Aggregates stats across federations, repos, and executions. |
protocols-execute | Validates and logs protocol-based actions. |
github-sync | Synchronizes repository data for the evolutionary repository. |
Sources: supabase/functions/federation-state/index.ts:30-38, README.md:43-46
Operational Visualization (ECG and Dashboards)
New modules should contribute data to the "Operational ECG" (Electrocardiogram). This is achieved by logging events to tamvcrums_logs, which are then aggregated to show real-time "rhythm" and "impact scores" in the Command Center.
The sequence shows how module activity is translated into visual operational signals.
Sources: src/components/tamv/tamvcrums-ecg.tsx:12-25
Conclusion
Developing new TAMV modules requires a disciplined approach to federation alignment, technical auditability, and sovereign architectural principles. By leveraging the existing React/Supabase framework and adhering to the "Kernel MD-X4" specifications, developers can ensure their contributions are interoperable with the broader Real del Monte digital twin ecosystem.
Sources: README.md:88-102, src/components/rdm/tomos.tsx:50-56