Adds the original NestJS backends (backend, audio-backend), Expo mobile app, and Astro landing page as-is from the standalone memoro repo. These are not yet migrated to monorepo standards (migration tracked in memory/CLAUDE.md). Also adds eslint.config.mjs ignore for apps/*/apps/audio-backend/** and .prettierignore entries for legacy memoro dirs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| docs | ||
| scripts | ||
| src | ||
| supabase | ||
| test | ||
| .dockerignore | ||
| .env.backup | ||
| .gitignore | ||
| BRANDING_INFO.md | ||
| CLAUDE.md | ||
| cloud-run-deploy.md | ||
| cloudbuild-memoro.yaml | ||
| DEPLOY_MANUAL.md | ||
| Dockerfile | ||
| Dockerfile.debug | ||
| env.example | ||
| jest.config.js | ||
| package.json | ||
| README.md | ||
| SIGNUP_BRANDING.md | ||
| TECHNICAL_DOCUMENTATION.md | ||
| tsconfig.build.json | ||
| tsconfig.json | ||
| verify-build.sh | ||
Memoro Microservice
This is a standalone microservice for the Memoro component of the Mana Core system. It was extracted from the monolithic mana-core-middleware to enable independent scaling and deployment.
Architecture
This microservice:
- Handles all Memoro-specific functionality
- Communicates with Auth service for authentication/authorization
- Communicates with Spaces service for space management
- Connects directly to the Memoro Supabase instance
- Implements mana cost validation for AI operations
Mana Cost System
The service implements a backend-driven credit validation system:
- Transcription: 120 credits per hour / 2 credits per minute (base cost: 10 credits minimum)
- Question Processing: 5 mana per question asked to memos
- Memo Combination: 5 mana per memo when combining multiple memos
- Headline Generation: 10 credits for title/summary generation
- Memory Creation: 10 credits for AI-generated memories
- Blueprint Processing: 5 credits for blueprint application
- Memo Sharing: 1 credit for sharing operations
- Space Operations: 2 credits for space-related operations
- Early Validation: Credits are checked before expensive AI operations
- Real-time Updates: Frontend mana counter updates immediately after operations
All AI processing endpoints validate sufficient mana credits before processing and consume credits upon successful completion.
API Endpoints
Core Memoro Endpoints
GET /memoro/spaces- Get all Memoro spaces for the authenticated userPOST /memoro/spaces- Create a new Memoro spaceGET /memoro/spaces/:id- Get details for a specific Memoro spaceDELETE /memoro/spaces/:id- Delete a Memoro spacePOST /memoro/link-memo- Link a memo to a spacePOST /memoro/unlink-memo- Unlink a memo from a spaceGET /memoro/spaces/:id/memos- Get all memos for a specific spacePOST /memoro/spaces/:id/leave- Leave a space
Space Invitation Management
GET /memoro/spaces/:id/invites- Get space invitationsPOST /memoro/spaces/:id/invite- Invite user to spacePOST /memoro/spaces/invites/:inviteId/resend- Resend invitationDELETE /memoro/spaces/invites/:inviteId- Cancel invitationGET /memoro/invites/pending- Get user's pending invitesPOST /memoro/spaces/invites/accept- Accept invitationPOST /memoro/spaces/invites/decline- Decline invitation
Audio Processing
POST /memoro/process-uploaded-audio- Process uploaded audio with intelligent fallback strategy and credit validationPOST /memoro/update-batch-metadata- Update batch transcription metadata for recovery tracking (improved with memo ID lookup, 2025-06-08)POST /memoro/retry-transcription- Retry failed transcriptionPOST /memoro/retry-headline- Retry failed headline generation
Enhanced Audio Processing System
The service implements a sophisticated dual-path transcription system with comprehensive fallback strategies:
Transcription Paths:
- Fast Transcription (<115 minutes) - Real-time processing via Supabase Edge Function
- Batch Transcription (≥115 minutes) - Azure Speech Service batch processing with webhook callbacks
Enhanced Fallback Strategy:
- Fast Transcribe - Attempts fast transcription via edge function
- Format Conversion + Retry - If audio format error detected, converts file via audio-microservice and retries
- Batch Processing Fallback - Falls back to batch processing if conversion fails
- Intelligent Error Detection - Automatically detects Azure Speech Service format compatibility issues
Batch Transcription Enhancements:
- Advanced Diarization: Supports up to 10 speakers (vs 2 in basic mode)
- Multi-language Detection: Automatic language identification from user preferences
- Complete Data Consistency: Same speaker data structure as fast transcription
- Recovery Tracking: Stores Azure jobId for webhook failure recovery
- Graceful Degradation: Falls back to text-only if speaker processing fails
Supported Processing Routes:
fast_transcribe- Direct fast transcription successfast_transcribe_converted- Success after format conversionbatch_transcribe- Regular batch processing for long filesbatch_transcribe_fallback- Success via batch processing fallback
Data Structure Consistency: Both fast and batch transcription now save identical data:
transcript- Transcribed textprimary_language- Detected primary languagelanguages- All detected languagesutterances- Speaker segments with timestampsspeakers- Speaker labelsspeakerMap- Speaker-grouped utterances
AI Processing Endpoints (with Credit Validation)
POST /memoro/question-memo- Ask questions about memos (5 mana cost)POST /memoro/combine-memos- Combine multiple memos with AI processing (5 mana per memo)
Credit Management
POST /memoro/credits/check-transcription- Check credits before transcriptionPOST /memoro/credits/consume-transcription- Consume transcription creditsPOST /memoro/credits/consume-operation- Consume operation credits
User Settings Management
GET /settings- Get all user settingsGET /settings/memoro- Get Memoro-specific settingsPATCH /settings/memoro- Update Memoro settingsPATCH /settings/memoro/data-usage- Update data usage acceptancePATCH /settings/memoro/email-newsletter- Update email newsletter opt-inPATCH /settings/profile- Update user profile (firstName, lastName, avatarUrl)
Environment Variables
Required environment variables:
# Server Configuration
PORT=3001
# Service URLs
MANA_SERVICE_URL=http://localhost:3000
AUDIO_MICROSERVICE_URL=https://audio-microservice-111768794939.europe-west3.run.app
# Supabase Configuration
MEMORO_SUPABASE_URL=https://your-memoro-project.supabase.co
MEMORO_SUPABASE_ANON_KEY=your-memoro-anon-key
MEMORO_SUPABASE_SERVICE_KEY=your-memoro-service-key
# App Configuration
MEMORO_APP_ID=973da0c1-b479-4dac-a1b0-ed09c72caca8
Development
# Install dependencies
npm install
# Run in development mode
npm run start:dev
# Build for production
npm run build
# Run in production mode
npm run start:prod
Deployment
For Cloud Run deployment instructions, see cloud-run-deploy.md.
testing prod deployment 30.juli 2025 03:30