Database & Storage Strategy
Relevant source files
The following files were used as context for generating this wiki page:
- TAMV-MASTER-DOCUMENTATION.md
- ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md
- ARCHIVE/remaining-docs-consolidated-2026-02-13/IMPLEMENTATION-PROGRESS-REPORT.md
- ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-COMPLETE-IMPLEMENTATION-PLAN.md
- ARCHIVE/tamv-docs-consolidated-2026-02-02/TAMV-OFFICIAL-SYSTEM-DESCRIPTION.md
- ARCHIVE/remaining-docs-consolidated-2026-02-13/REPORTE-AVANCE-TECNICO-COMPLETO.md
The Database & Storage Strategy of the TAMV ecosystem is designed to support a distributed socio-technical infrastructure focused on digital autonomy and data sovereignty. It utilizes a multi-layered storage architecture to handle diverse data types, ranging from relational user data to immersive 3D/4D assets and immutable blockchain records. The strategy ensures that users maintain absolute control over their data while providing the high-performance throughput required for real-time XR experiences and AI applications.
Sources: TAMV-MASTER-DOCUMENTATION.md:78-83, ARCHIVE/tamv-docs-consolidated-2026-02-02/TAMV-OFFICIAL-SYSTEM-DESCRIPTION.md:14-18
Multi-Layer Storage Architecture
TAMV employs a federated technology stack to manage data across various persistence layers. This approach separates structured relational data, high-speed caching, distributed assets, and AI-specific vector memory.
Core Storage Components
| Component | Technology | Purpose |
|---|---|---|
| Primary Database | PostgreSQL 15+ | Relational data, user profiles, and social interactions. |
| Cache & Sessions | Redis | Real-time state management and session persistence. |
| Distributed Storage | IPFS | Immutable storage for decentralized assets and media. |
| Vector Database | pgvector | Storage for AI embeddings used by Isabella AI. |
| Blockchain Registry | Custom MSR Chain | Immutable civilizational and historical records. |
Sources: TAMV-MASTER-DOCUMENTATION.md:86-91, ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:161-164
Data Flow Diagram
The following diagram illustrates how data moves between the application layer and the specialized storage engines within the TAMV ecosystem.
Relational Schema Design
The primary relational database is built on PostgreSQL, utilizing a microservices-aligned schema to manage users, social interactions, and economic transactions.
Entity Relationship Model
Key Table Definitions
- Users: Stores sovereign identities, roles (user, moderator, admin), and wallet addresses for blockchain integration.
- Posts: Manages content, visibility (public, followers, private), and auto-updated metrics via triggers.
- Sessions: Tracks JWT tokens and refresh tokens with metadata like IP addresses and user agents.
- BookPI Registry: An immutable ledger within the MSR blockchain used for registering civilizational evidence and audit trails.
Sources: ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:118-140, ARCHIVE/remaining-docs-consolidated-2026-02-13/REPORTE-AVANCE-TECNICO-COMPLETO.md:197-202
Storage Implementation Details
Data Integrity and Security
The storage strategy implements several technical safeguards to ensure data protection and availability:
- Soft Deletes: Implemented on critical tables (Posts, Comments) to allow data retention and recovery.
- Database Triggers: Used for automatic updates of interaction counts (likes, comments) to ensure denormalized data consistency.
- Parameterized Queries: Utilized throughout the
database.tsutility to prevent SQL injection. - Indexed Queries: Proper indexing on unique fields like
emailandusernameto optimize lookup performance.
Sources: ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:15-18, ARCHIVE/remaining-docs-consolidated-2026-02-13/IMPLEMENTATION-PROGRESS-REPORT.md:26-31
AI Memory & Vector Storage
The Isabella AI framework utilizes pgvector for semantic memory. This allows the system to process photorealistic scenes and handwriting data by converting them into embeddings stored in PostgreSQL.
// Example of how Isabella AI interacts with the vector layer
const audit = await IsabellaAI.audit(req.body.action, citizen);
// Logic feeds from the vector memory in pgvector
Sources: TAMV-MASTER-DOCUMENTATION.md:214-220, ARCHIVE/remaining-docs-consolidated-2026-02-13/REPORTE-AVANCE-TECNICO-COMPLETO.md:224-230
Deployment and Configuration
The storage layer is configured via environment variables to support flexible deployment across development and production (AWS ECS/RDS) environments.
| Variable | Description | Default/Example |
|---|---|---|
POSTGRES_HOST | Database endpoint | tamv-prod.cluster... |
REDIS_HOST | Cache endpoint | tamv-prod.cache... |
REDIS_TLS_ENABLED | Enables secure cache connection | true |
ENCRYPTION_KEY | Key for sensitive data at rest | 32-byte hex string |
Sources: TAMV-MASTER-DOCUMENTATION.md:255-275, ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:82-96
Summary
The Database & Storage Strategy for TAMV balances the need for high-performance relational management with decentralized, immutable principles. By integrating PostgreSQL for structured data, IPFS for assets, and the MSR blockchain for historical memory, TAMV provides a resilient infrastructure that prioritizes user sovereignty and system integrity. This multi-layered approach ensures the system remains "impossible to capture" while scaling to meet the demands of a global creator economy.
Sources: TAMV-MASTER-DOCUMENTATION.md:231-235, ARCHIVE/tamv-docs-consolidated-2026-02-02/TAMV-OFFICIAL-SYSTEM-DESCRIPTION.md:175-179