Email Service & Communication
Relevant source files
The following files were used as context for generating this wiki page:
The Email Service & Communication infrastructure within the Tuturuuu platform encompasses transactional messaging, automated notifications, and AI-driven conversational interfaces. It serves as a core utility for workspace collaboration, user authentication, and system-wide alerts. The system is designed to be highly integrated with the platform's AI ecosystem, particularly through "Mira," the conversational AI partner that facilitates user interaction across various modules.
Sources: README.md:144-150, apps/web/src/data/legal/acceptable-use-sections.tsx:43-52
Architectural Overview
The communication architecture is decentralized across specialized packages and applications. Transactional emails are handled via a dedicated package that utilizes React Email for template management, while real-time communication and AI-driven interactions are processed through edge API routes.
Communication Components
| Component | Responsibility | Relevant Files |
|---|---|---|
| Transactional Package | Manages email templates and sending logic using React Email. | README.md:118-119 |
| AI Communication (Mira) | Provides empathetic conversational interfaces across the platform. | README.md:144-146 |
| Acceptable Use Policy | Defines rules for messaging, spam prevention, and API usage. | apps/web/src/data/legal/acceptable-use-sections.tsx:103-115 |
| Notification Triggers | Background jobs for calendar sync and event-based alerts. | README.md:112-113 |
Sources: README.md:112-150, apps/web/src/data/legal/acceptable-use-sections.tsx:103-115
AI-Driven Communication
The platform utilizes a multi-provider AI strategy to power its communication features. These features are implemented as edge functions that process user messages, manage chat history in Supabase, and stream responses back to the user.
Message Processing Flow
The following diagram illustrates how the platform handles a communication request through the AI edge routes (Google Gemini, OpenAI, or Anthropic):
The system enforces a MAX_CHAT_MESSAGE_LENGTH constant to prevent resource abuse during communication sessions.
Sources: packages/ai/src/chat/google/route.ts:167-330, packages/ai/src/chat/openai/route.ts:32-130
Multi-Model Integration
The communication layer supports various AI providers, each configured with specific system instructions to maintain the "Mira" persona.
- Google Vertex/Gemini: Supports file attachments and high-performance streaming.
- OpenAI/Anthropic: Integrated via a gateway for standardized message formatting.
Sources: packages/ai/src/chat/google/route.ts:12-25, packages/ai/src/chat/anthropic/route.ts:1-20
Communication Safety and Compliance
To maintain service integrity, the platform implements several protection layers for its communication services, including rate limiting and content filtering.
Prohibited Communication Activities
The Acceptable Use Policy (AUP) strictly forbids certain communication-related activities:
- Abuse & Harassment: Stalking, threats, or doxing.
- Deceptive Practices: Phishing, social engineering, and impersonation.
- Spamming: Using automation to scrape data or manipulate platform features.
Sources: apps/web/src/data/legal/acceptable-use-sections.tsx:64-90
Rate Limiting and Monitoring
The platform imposes a default rate limit of 100 requests per minute for API-based communication. Automated systems monitor for policy violations such as spam or malware distribution patterns.
Implementation Details
Message Validation logic
The platform ensures that all communication payloads adhere to size constraints before processing. This is critical for both security and performance.
// Example from message validation logic
for (const message of modelMessages) {
if (
typeof message.content === 'string' &&
message.content.length > MAX_CHAT_MESSAGE_LENGTH
) {
return new Response(
`Message too long (max ${MAX_CHAT_MESSAGE_LENGTH} characters)`,
{ status: 400 }
);
}
}
Sources: packages/ai/src/chat/google-vertex/route.ts:74-84, packages/ai/src/chat/google/route.ts:222-232
Emergency Communication Procedures
The project defines strict protocols for critical failures in communication infrastructure, such as data loss or security breaches.
| Incident | Action Plan |
|---|---|
| Critical Bug | Create hotfix, implement minimal fix, and deploy immediately. |
| Security Breach | Rotate all secrets immediately, review logs, and notify affected users. |
Sources: conductor/workflow.md:231-250
Summary
Email Service & Communication in the Tuturuuu platform is a multifaceted system combining traditional transactional messaging with advanced AI-driven interaction. By leveraging shared packages for templates and robust edge routes for AI communication, the platform maintains high availability and security while adhering to strict acceptable use policies.
Sources: README.md:144-150, apps/web/src/data/legal/acceptable-use-sections.tsx:210-220