Epic 3 - Admin login and Manual Audio Upload
Epic 3 implements admin login functionality and manual audio upload, allowing authenticated users to upload pre-recorded audio files instead of generating them via AI.
Objective
Implement admin login authentication and add manual audio upload feature to allow authenticated users to upload their own pre-recorded audio files (MP3, WAV, etc.) and get a shareable URL.
User Flow:
Admin Login → Upload Audio File → Store in S3 → Generate Slug → Shareable URL
What You Get:
- Upload pre-recorded audio files
- Support for multiple audio formats (MP3, WAV, M4A)
- Automatic slug generation
- Shareable URL for uploaded audio
Epic 3 complements the AI generation from Epic 1 by allowing manual uploads. Users can choose between AI generation or manual upload.
Priorities Covered
- Admin Login Authentication (New)
- Manual Upload Feature (New)
Prerequisites from Epic 1:
- AWS S3 storage configured (P3)
- Slug generation working
- User interface operational (P4)
What Changes
Admin Login (Microsoft Identity)
Authentication Required:
- Admins must login with Microsoft Identity before accessing upload features
- JWT token contains userId and userName
- Token required for all upload API requests
- createdBy/updatedBy fields auto-populated from token
Login Flow:
- Admin navigates to upload page
- Redirected to Microsoft Identity login if not authenticated
- After successful login, JWT token stored
- Token included in Authorization header for API requests
New Upload Option
Homepage Updates:
- Add "Upload Audio" button/tab alongside "Generate Audio"
- File upload interface with drag-and-drop
- Format validation (MP3, WAV, M4A, OGG)
- File size limit (max 10MB per file)
- Preview uploaded audio before confirming
Result Page
Same Result Page as AI Generation:
- Shows uploaded audio player
- Displays shareable URL with slug
- Copy link button
- Download original file option
Technical Details
Data Storage Updates
Add new fields to generation records:
- Upload Type:
ai_generatedormanual_upload - Original Filename: Original name of uploaded file
- File Format: MP3, WAV, M4A, OGG, etc.
- File Size: Size in bytes
Example Storage:
- Upload Type:
manual_upload - Original Filename:
welcome-message.mp3 - File Format:
mp3 - File Size: 2,456,789 bytes
API Flow
Upload API Endpoint
Endpoint: POST /api/v1/upload
Request (Multipart Form Data):
POST /api/v1/upload
Authorization: Bearer {access-token}
Content-Type: multipart/form-data
audioFile: [binary audio file]
Response:
{
"success": true,
"data": {
"id": "550e8400-e29b-41d4-a716-446655440000",
"slug": "welcome-message",
"audioUrl": "https://s3.amazonaws.com/micdots/audio/550e8400.mp3",
"playbackUrl": "https://micdots.com/play/welcome-message",
"uploadType": "manual_upload",
"originalFilename": "welcome-message.mp3",
"fileFormat": "mp3",
"fileSize": 2456789,
"createdAt": "2024-11-02T12:00:00Z"
}
}
Success Criteria
Epic 3 is complete when:
- ✅ Admin login with Microsoft Identity works
- ✅ JWT token authentication is enforced for upload API
- ✅ createdBy/updatedBy auto-populated from JWT token
- ✅ Users can upload audio files
- ✅ Multiple formats are supported (MP3, WAV, M4A, OGG)
- ✅ File validation works (format, size)
- ✅ Audio is stored on AWS S3
- ✅ Unique slug is generated
- ✅ Shareable URL is created
- ✅ Audio playback works for uploaded files
- ✅ Upload type is tracked (ai_generated vs manual_upload)
- ✅ Manual testing completed and verified
- ✅ Deployed to production
Timeline
Duration: 3 weeks
| Weeks | Focus | Deliverables |
|---|---|---|
| Week 14 | Admin Login & Auth | Microsoft Identity integration, JWT auth |
| Week 15 | Upload API & Validation | File upload endpoint, format validation |
| Week 16 | Testing & Deployment | Validation, testing, deployment |
File Upload Specifications
Supported Formats
- MP3: MPEG-1 Audio Layer 3 (.mp3)
- WAV: Waveform Audio File Format (.wav)
- M4A: MPEG-4 Audio (.m4a)
- OGG: Ogg Vorbis (.ogg)
File Size Limits
- Maximum: 10MB per file
- Recommended: Under 5MB for optimal performance
- Duration: No limit, but recommend under 5 minutes
Validation Rules
Format Validation:
- Check file extension
- Validate MIME type
- Verify audio codec
Size Validation:
- Reject files over 10MB
- Show clear error message
Content Validation:
- Ensure file is valid audio
- Check for corruption
- Verify playability
UI Mockup
Homepage with Upload Option
Two Options:
- Generate Audio (AI) - Text input → ElevenLabs generation
- Upload Audio (Manual) - File upload → Direct storage
Upload Interface:
- Drag-and-drop zone
- "Browse Files" button
- Format requirements shown
- File size limit displayed
- Preview audio after selection
- "Upload" button
Example:
┌─────────────────────────────────────────┐
│ [ Generate Audio ] [ Upload Audio ] │
├─────────────────────────────────────────┤
│ │
│ 📁 Drag & drop your audio file here │
│ or click to browse │
│ │
│ Supported: MP3, WAV, M4A, OGG │
│ Max size: 10MB │
│ │
│ [ Upload ] │
└─────────────────────────────────────────┘
Use Cases
When to Use Manual Upload:
- Pre-recorded professional voiceovers
- Multilingual content not supported by AI
- Custom music or sound effects
- Client-provided audio content
- Legacy audio files from old system
- Audio edited externally (noise reduction, effects, etc.)
When to Use AI Generation:
- Quick content creation
- Consistent voice across content
- No recording equipment available
- Last-minute changes to text
- Multiple language variations
Related Documentation
- Epic 1 Overview - Audio generation and slug system
- Epic 2 Overview - QR code generation (applies to uploads too)
- MVP Priorities - Complete priorities list
- System Architecture - Complete architecture