Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
cc5c53c
chore(dev): remove pre-commit hook and dependency; stop auto-install …
asyau Sep 30, 2025
a37a244
chore: ignore env and key files repo-wide
asyau Oct 7, 2025
54e7798
docs: add sanitized .env.example
asyau Oct 7, 2025
4c210f4
chore: add pre-commit hook to block secrets
asyau Oct 7, 2025
0f2161a
fix: Update Pydantic v2 compatibility issues in route handlers
claude Nov 18, 2025
a6ee55b
feat: Add LangChain/LangGraph debugging support and comprehensive RFC…
claude Nov 18, 2025
572d499
feat: Implement WebSocket real-time communication infrastructure
claude Nov 18, 2025
3d46e57
feat: Add Organizational Hierarchy Graph API endpoints
claude Nov 18, 2025
7010256
docs: Add comprehensive implementation summary and next steps
claude Nov 18, 2025
d7f0ea7
feat: Implement Smart Search API with semantic vector search
claude Nov 18, 2025
68094b9
feat: Implement WebSocket frontend with real-time messaging
claude Nov 18, 2025
8bdb672
docs: Add WebSocket frontend implementation session summary
claude Nov 18, 2025
f8089a0
feat: Implement Smart Search UI and Org Hierarchy Graph frontend
claude Nov 18, 2025
b0f569a
feat: Implement medium priority backend features
claude Nov 18, 2025
ed7110a
feat: Complete all remaining medium priority backend features
claude Nov 18, 2025
a8d8cf6
feat: Implement all low priority features
claude Nov 18, 2025
5101512
fix: Register voice routes and update documentation
claude Nov 18, 2025
7d4499c
docs: Add comprehensive setup and development guides
claude Nov 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified .DS_Store
Binary file not shown.
30 changes: 30 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Required environment variables (no secrets)
# Fill these locally or in your secrets manager

# Backend API
API_BASE_URL=http://localhost:8000

# Database
DATABASE_URL=postgresql://postgres.aphnekdbxvzcofzzxghu:Virastartupsok@aws-0-eu-central-1.pooler.supabase.com:5432/postgres

# OpenAI
OPENAI_API_KEY=sk-proj-your-key-here
OPENAI_MODEL=gpt-4o

# LangChain/LangGraph Debugging (LangSmith)
# Sign up at https://smith.langchain.com to get your API key
LANGCHAIN_TRACING_V2=true
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com
LANGCHAIN_API_KEY=your-langsmith-api-key-here
LANGCHAIN_PROJECT=vira-development
LANGCHAIN_VERBOSE=true
LANGCHAIN_DEBUG=true

# Supabase
SUPABASE_URL=https://aphnekdbxvzcofzzxghu.supabase.co
SUPABASE_KEY=your-supabase-anon-key-here

# Frontend (for integration callbacks)
VITE_API_BASE_URL=http://localhost:8000
VITE_SUPABASE_URL=https://aphnekdbxvzcofzzxghu.supabase.co
VITE_SUPABASE_ANON_KEY=your-supabase-anon-key-here
29 changes: 29 additions & 0 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh
set -euo pipefail

# Block committing files that look like secrets
check_paths='(\.env($|\.|/))|(\.(pem|key|p12|pfx|der|crt|cer|jks|keystore)$)|((^|/)id_rsa$)|((^|/)id_dsa$)|((^|/)\.ssh(/|$))|(serviceAccount.*\.json$)|(credentials.*\.json$)'

STAGED=$(git diff --cached --name-only)

if echo "$STAGED" | grep -E "$check_paths" >/dev/null; then
echo "Error: Attempting to commit files that look like secrets:" >&2
echo "$STAGED" | grep -E "$check_paths" >&2
echo "Aborting commit. Add to .gitignore or remove from index (git rm --cached)." >&2
exit 1
fi

# Optional: block obvious secrets in content
if command -v grep >/dev/null 2>&1; then
for f in $STAGED; do
if [ -f "$f" ]; then
if git show :"$f" | grep -E '(AKIA[0-9A-Z]{16}|-----BEGIN [A-Z ]+PRIVATE KEY-----|api[_-]?key|secret|token|password)' >/dev/null; then
echo "Warning: Potential secret-like content in $f" >&2
echo "If this is intentional and safe, commit with --no-verify." >&2
exit 1
fi
fi
done
fi

exit 0
26 changes: 26 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Secrets and environment files (repo-wide)
.env
.env.*
.envrc
.secrets*
secrets/

# Private keys and credentials
*.pem
*.key
*.p12
*.pfx
*.der
*.crt
*.cer
*.jks
*.keystore
id_rsa
id_dsa
.ssh/
*serviceAccount*.json
*credentials*.json

# OS junk
.DS_Store

8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.pythonPath": "./vera_backend/venv/bin/python",
"python.defaultInterpreterPath": "./vera_backend/venv/bin/python",
"python.terminal.activateEnvironment": true,
"python.linting.enabled": false,
"python.analysis.typeCheckingMode": "off",
"kiroAgent.configureMCP": "Disabled"
}
279 changes: 279 additions & 0 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,279 @@
# Vira System Architecture Implementation

## Overview

This document describes the comprehensive system architecture implementation for Vira, an AI-powered assistant platform for teams. The architecture follows microservices principles with proper separation of concerns, scalability, and maintainability.

## Architecture Layers

### 1. Frontend Layer (React + TypeScript)

**Technology Stack:**
- React 18 with TypeScript
- TailwindCSS + Shadcn UI components
- Zustand for state management (MVP pattern)
- React Query for data fetching
- React Router for navigation

**Key Components:**
- **State Management**: Zustand stores implementing MVP pattern
- `authStore.ts` - Authentication state
- `taskStore.ts` - Task management state
- `chatStore.ts` - Chat/conversation state
- `notificationStore.ts` - Notification state
- `uiStore.ts` - UI state management
- `teamStore.ts` - Team management state

- **Services**: API service layer with axios interceptors
- **Components**: Reusable UI components following atomic design
- **Pages**: Route-based page components

### 2. API Gateway Layer

**Implementation**: `app/core/api_gateway.py`

**Features:**
- **Request Routing**: Routes requests to appropriate microservices
- **Authentication**: JWT token validation and user context
- **Load Balancing**: Round-robin distribution across service instances
- **Error Handling**: Centralized error handling and response formatting
- **CORS Management**: Cross-origin request handling
- **Health Checks**: Service health monitoring

**Key Classes:**
- `APIGateway` - Main gateway implementation
- `AuthenticationMiddleware` - JWT handling and role-based access
- `ServiceRouter` - Request routing logic
- `LoadBalancer` - Service instance management

### 3. Microservices Layer

**Service Architecture:**
Each service follows the same pattern with:
- FastAPI router for HTTP endpoints
- Service layer for business logic
- Repository layer for data access
- Proper error handling and validation

**Implemented Services:**

#### User Management Service
- **File**: `app/services/user_service.py`
- **Repository**: `app/repositories/user_repository.py`
- **Features**: User CRUD, authentication, role management, team assignment

#### Task Management Service
- **File**: `app/services/task_service.py`
- **Repository**: `app/repositories/task_repository.py`
- **Features**: Task lifecycle management, assignment, analytics, search

#### Communication Service
- **File**: `app/services/communication_service.py`
- **Features**: Conversation management, messaging, real-time chat, TriChat support

#### Notification Service
- **File**: `app/services/notification_service.py`
- **Features**: Multi-channel notifications (in-app, email, Slack, Teams), preferences

#### AI Orchestration Service
- **File**: `app/services/ai_orchestration_service.py`
- **Features**: OpenAI integration, task extraction, memory management, TTS/STT

### 4. Design Patterns Implementation

#### Repository Pattern
**Base Class**: `app/repositories/base.py`

```python
class BaseRepository(Generic[T], ABC):
def get(self, id: UUID) -> Optional[T]
def create(self, obj_data: Dict[str, Any]) -> T
def update(self, id: UUID, obj_data: Dict[str, Any]) -> T
def delete(self, id: UUID) -> bool
# ... additional CRUD methods
```

**Benefits:**
- Decouples business logic from data access
- Consistent data access patterns
- Easy to test and mock
- Database technology agnostic

#### Service Layer Pattern
**Base Class**: `app/services/base.py`

```python
class BaseService(Generic[T], ABC):
def _validate_business_rules(self, *args, **kwargs) -> None
def _handle_transaction(self, operation, *args, **kwargs)
def _log_operation(self, operation: str, entity_id: str, details: dict = None)
```

**Benefits:**
- Encapsulates business logic
- Provides transaction management
- Enables business rule validation
- Supports operation logging

#### Factory Pattern
**Implementation**: `app/factories/ai_factory.py`

```python
class AIRequestFactoryProvider:
@classmethod
def create_chat_request(cls, **kwargs) -> Dict[str, Any]
@classmethod
def create_embedding_request(cls, **kwargs) -> Dict[str, Any]
@classmethod
def create_tts_request(cls, **kwargs) -> Dict[str, Any]
```

**Benefits:**
- Flexible object creation
- Easy to extend with new AI models
- Encapsulates configuration logic

#### Model-Context-Protocol (MCP)
**Implementation**: AI Orchestration Service

**Features:**
- Context-aware AI responses
- User and company personalization
- Multi-user conversation handling
- Memory integration for context retention

### 5. Data Layer

**Primary Database**: PostgreSQL with pgvector extension
- **Tables**: Users, Companies, Projects, Teams, Tasks, Conversations, Messages
- **Vector Storage**: Memory embeddings for AI context
- **Relationships**: Proper foreign key constraints and indexes

**Caching Layer**: Redis (configured, ready for implementation)
- Session storage
- Frequently accessed data caching
- Real-time feature support

### 6. External Integrations

**AI Services:**
- **OpenAI GPT-4o**: Chat completions, embeddings
- **TTS**: ElevenLabs, Google Cloud TTS
- **STT**: Whisper, Web Speech API

**Communication Integrations:**
- **Slack API**: Notification delivery
- **Microsoft Teams API**: Notification delivery
- **Email Service**: SMTP integration

**File Storage**: Ready for integration with Google Drive, Dropbox

## Key Features Implemented

### 1. Enhanced Authentication & Authorization
- JWT-based authentication with role-based access control
- Middleware for automatic token validation
- User context injection for all requests

### 2. Comprehensive Task Management
- Full CRUD operations with business logic validation
- Task assignment and completion workflows
- Analytics and reporting
- Search and filtering capabilities

### 3. AI-Powered Features
- Contextual chat responses with MCP
- Task extraction from conversations
- Memory-based context retention
- Multi-modal input support (text, voice)

### 4. Real-time Communication
- Conversation management
- Message handling with read status
- TriChat support for multi-user conversations
- WebSocket ready infrastructure

### 5. Multi-channel Notifications
- Configurable notification preferences
- Support for in-app, email, Slack, Teams notifications
- Priority-based notification handling

### 6. Scalable Frontend Architecture
- Zustand stores for predictable state management
- Type-safe API integration
- Responsive design with mobile support
- Error handling and loading states

## Configuration

### Backend Configuration
**File**: `app/core/config.py`

Key settings:
- Database connections
- OpenAI API configuration
- External service API keys
- JWT settings
- File upload limits

### Frontend Configuration
**Environment Variables**:
- `VITE_API_URL` - Backend API endpoint
- Additional service endpoints as needed

## Deployment Architecture

The system is designed for containerized deployment:

1. **Frontend**: Static files served by CDN
2. **API Gateway**: Single entry point (Port 8000)
3. **Microservices**: Independent deployment and scaling
4. **Database**: PostgreSQL with pgvector
5. **Cache**: Redis cluster
6. **External Services**: API integrations

## Security Considerations

1. **Authentication**: JWT tokens with proper expiration
2. **Authorization**: Role-based access control at service level
3. **Input Validation**: Pydantic models for request validation
4. **Error Handling**: Secure error responses without sensitive data
5. **CORS**: Properly configured cross-origin policies

## Monitoring and Observability

1. **Health Checks**: Service health monitoring endpoints
2. **Logging**: Structured logging with operation tracking
3. **Error Tracking**: Sentry integration for error monitoring
4. **Performance**: Request timing and service metrics

## Future Enhancements

1. **File Management Service**: Complete implementation with third-party storage
2. **Real-time Features**: WebSocket implementation for live updates
3. **Advanced Analytics**: Enhanced reporting and dashboard features
4. **Mobile App**: React Native implementation using same backend
5. **AI Improvements**: Additional AI models and capabilities

## Getting Started

### Backend Setup
```bash
cd vera_backend
pip install -r requirements.txt
uvicorn app.main:app --reload
```

### Frontend Setup
```bash
cd vera_frontend
npm install
npm run dev
```

The system will be available at:
- Frontend: http://localhost:5173
- API Gateway: http://localhost:8000
- API Documentation: http://localhost:8000/docs

This architecture provides a solid foundation for scaling Vira as an enterprise-grade AI assistant platform while maintaining code quality, security, and performance standards.
Loading