Social Network Services
Relevant source files
The following files were used as context for generating this wiki page:
Social Network Services within the TAMV ecosystem constitute a sophisticated distributed infrastructure designed for digital autonomy and interactive communication. This system moves beyond traditional extractive models by prioritizing transparent algorithms and fair value distribution, redistributing 70% of revenue to creators. The scope of these services includes high-definition media sharing, interactive XR/4D elements, and cryptographically secured private communication.
The technical architecture is built upon a production-ready REST API featuring 18 endpoints that manage user interactions, content lifecycle, and personalized feeds. It integrates core social functionalities—posts, likes, comments, and thematic groups—with advanced technologies like WebXR, real-time WebSockets, and the Isabella AI framework for ethical content moderation.
Sources: TAMV-MASTER-DOCUMENTATION.md:120-135, ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:10-25
System Architecture and Data Flow
The social services are organized into a decoupled architecture consisting of models, services, and controllers. The data flow follows a standard Service Layer pattern where business logic is isolated from HTTP handling and database schemas.
Core Service Logic
The system utilizes specialized services for different social entities:
- Post Service: Manages the lifecycle of content, including creation, retrieval, and soft deletion.
- Comment Service: Handles threaded interactions and parent-child relationships for nested discussions.
- Like Service: Manages atomic interactions and unique constraints to prevent duplicate engagements.
The following sequence diagram illustrates the typical flow for creating and interacting with content:
The diagram above shows the synchronous execution flow from user request to database persistence via the service layer.
Sources: ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:35-55, backend/src/services/post.service.ts
Data Models and Schema
The data layer is built on PostgreSQL with strict typing and relational constraints. It supports "soft deletes" to maintain data retention while removing content from active feeds.
Entity Relationships
ER Diagram showing the cardinality between users, posts, comments, and likes.
Database Schema Details
| Table | Field | Type | Description |
|---|---|---|---|
| Posts | id | UUID | Primary Key |
user_id | UUID | Foreign Key to Users | |
content | Text | The main post body | |
visibility | Enum | public/followers/private | |
like_count | Integer | Auto-updated via triggers | |
| Comments | id | UUID | Primary Key |
post_id | UUID | Foreign Key to Posts | |
parent_id | UUID | Self-referencing FK for nesting | |
| Likes | post_id | UUID | Composite unique with user_id |
Sources: ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:175-215, backend/src/models/Post.ts, backend/src/models/Comment.ts
API Endpoints and Interaction
The system exposes a comprehensive set of RESTful endpoints. These are protected by JWT authentication and subject to tiered rate limiting to prevent abuse.
Endpoint Summary
| Category | Endpoint | Method | Description |
|---|---|---|---|
| Posts | /api/v1/posts | GET | List paginated posts |
/api/v1/posts | POST | Create new content | |
/api/v1/posts/:id | DELETE | Soft delete post | |
| Interactions | /api/v1/posts/:id/like | POST | Toggle like status |
/api/v1/posts/:id/comments | POST | Add comment/reply | |
| Feed | /api/v1/feed | GET | Personalized paginated feed |
Code Implementation Example (Post Creation)
// backend/src/services/post.service.ts
export class PostService {
async createPost(userId: string, data: CreatePostDto) {
const query = `
INSERT INTO posts (user_id, content, visibility, media_urls)
VALUES ($1, $2, $3, $4)
RETURNING *
`;
const values = [userId, data.content, data.visibility, data.mediaUrls];
return await db.query(query, values);
}
}
Sources: ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:95-115, backend/src/services/post.service.ts:10-25
Security and Moderation
The social infrastructure incorporates the TENOCHTITLAN Security System and Isabella AI for ethical oversight.
- Rate Limiting: Tiered constraints (e.g., 10 posts per hour, 100 API requests per 15 minutes) prevent spam.
- Input Sanitization: Uses
isomorphic-dompurifyto prevent XSS in user-generated content. - Ownership Verification: Services validate that only the content creator can modify or delete posts and comments.
- Isabella AI: Non-executive AI that audits content intentions against ethical guidelines before processing.
Sources: TAMV-MASTER-DOCUMENTATION.md:275-285, ARCHIVE/remaining-docs-consolidated-2026-02-13/TAMV-BACKEND-COMPLETE.md:145-170
Conclusion
The Social Network Services in TAMV represent a production-ready, security-hardened infrastructure. By combining traditional social interaction patterns with advanced decentralized principles and AI-assisted moderation, the system provides a robust platform for digital sovereignty and fair creator economies. Its service-oriented architecture ensures scalability while maintaining strict data integrity and ethical compliance.