System Architecture
Architecture Overview
The MicDots platform is built on a cloud-native architecture leveraging AWS services and external APIs for voice generation and QR code creation.
Technology Stack Summary
| Layer | Technology | Purpose |
|---|---|---|
| Frontoffice | Next.js (React + TypeScript) - Docker | Landing page, client area |
| Backoffice | Next.js (React + TypeScript) - Docker | Admin operations, management |
| Backend | C# + ASP.NET Core 9.0 - Docker | REST API, Business Logic |
| Hosting | Single EC2 Instance (all containers) | Application hosting |
| Database | SQL Server (Amazon RDS) | Relational data storage |
| File Storage | AWS S3 | Audio files and QR images |
| CDN | CloudFront (enhances S3) | Global content delivery (optional) |
| Voice API | ElevenLabs (via RageAgainstThePixel SDK) (On Hold) | Text-to-speech conversion |
| QR API | QR Tiger | QR code generation |
| ORM | Entity Framework Core | Database access layer |
| Authentication | JWT Tokens | Secure API authentication |
| Testing | xUnit/NUnit (Backend), Jest/Cypress (Frontend) | Unit & E2E tests (Epic 2 - Low Priority) |
High-Level Architecture
Deployment Model
Single EC2 Instance Setup
Frontoffice, Backoffice, and Backend run as Docker containers on the same EC2 instance for the MVP phase.
Key Characteristics:
- Docker Compose manages all three containers
- Shared internal network for communication
- Frontoffice serves landing page and client area
- Backoffice serves admin operations interface
- Simple deployment and management
- Lower infrastructure costs
- Easy to scale to separate instances later
Component Details
1. Client Layer
Frontoffice Container (Next.js)
Purpose: Public-facing web interface for end-users
Technology Stack:
- Framework: Next.js (React)
- Language: TypeScript
- Styling: TODO - Ask Cristian about Tailwind + shadcn
- Deployment: Docker container
Responsibilities:
- Landing page rendering
- Client registration and authentication
- Client area dashboard
- Voice generation interface (text input)
- Audio player controls
- QR code display and download
- Client profile management
- Server-side rendering (SSR)
- Static site generation (SSG)
Key Pages:
- Landing page (homepage)
- Client registration/login
- Client dashboard
- Voice generation form
- Profile settings
Backoffice Container (Next.js)
Purpose: Administrative interface for platform management
Technology Stack:
- Framework: Next.js (React)
- Language: TypeScript
- Styling: TODO - Ask Cristian about Tailwind + shadcn
- Deployment: Docker container
Responsibilities:
- Admin authentication and authorization
- Client management (view, edit, suspend clients)
- Request management (view all generations)
- Analytics and reporting dashboards
- System configuration
- User quota management
- Email notification management
- Server-side rendering (SSR)
Key Pages:
- Admin login
- Client list and management
- Request list and details
- Analytics dashboard
- System settings
S3 Upload Strategy:
The Backoffice uses pre-signed URLs for direct file uploads to S3:
- User requests pre-signed upload URL from Backend API
- Backend generates temporary S3 upload URL with expiration
- User uploads file directly to S3 using pre-signed URL
- No file data passes through Backend, reducing server load
- Secure, time-limited access to S3 bucket
See S3 Pre-signed Upload Approach for detailed flow and API documentation.
2. Application Layer
Backend Container (C# / ASP.NET Core)
Purpose: Core application server hosting all business logic
Technology Stack:
- Language: C# with ASP.NET Core 9.0 Framewoork
- Deployment: Docker container
- Authentication: JWT tokens
- ElevenLabs Integration: RageAgainstThePixel SDK
- ORM: Entity Framework Core
Responsibilities:
- REST API endpoints
- Text validation and processing
- User quota management
- Integration with external services (ElevenLabs, QR Tiger)
- Database operations
- Authentication and authorization
3. Services Layer
Database: SQL Server (Amazon RDS)
Purpose: Persistent data storage for all platform data
Technology:
- Amazon RDS for SQL Server
- Multi-AZ deployment for production (optional)
- Automated backups and point-in-time recovery
Data Models:
- Users: Authentication, token balance
- Generations: Text input, audio URLs, QR code URLs, metadata
- Analytics Events: Scans, plays, user engagement (Stage 2)
File Storage: AWS S3 (with CloudFront CDN)
Purpose: Secure storage and global delivery for audio files and QR code images
Storage Features:
- Private bucket with signed URLs for access
- Server-side encryption (AES-256)
- Versioning enabled for file protection
- Lifecycle policies for cost optimization
- Automated cleanup for temporary files
Content Delivery Enhancement (CloudFront):
- Optional CDN layer that enhances S3 delivery
- Provides global content distribution with low latency
- Caches audio files and QR images at edge locations
- Reduces S3 bandwidth costs
- Transparent to users - they simply get faster access
- Can be enabled/disabled without changing application logic
Stored Content:
- Generated audio files (MP3 format)
- QR code images (PNG format)
- Temporary processing files
External Service: ElevenLabs (Text-to-Speech)
Purpose: AI-powered text-to-speech conversion service
Integration:
- Backend uses RageAgainstThePixel SDK (C# library)
- Converts text input to high-quality audio
- Multiple voice models available
- API key authentication
Features:
- Natural-sounding AI voices
- Multiple voice options (male, female, various accents)
- High-quality audio output (MP3 format)
- Adjustable voice parameters