A small demo Media Asset Management service built with Flask, featuring assets, files, transcode, and search microservices and a react frontend.
This project was created using Cursor
- Frontend: React application served from root path
- API Gateway: Central entry point for all API requests
- Assets Service: Manages digital assets and metadata
- Files Service: Handles file uploads, storage, and retrieval
- Transcode Service: Processes and converts media files
- Search Service: Provides search functionality across all services
- Route requests to appropriate microservices
- Handle authentication and authorization
- Rate limiting and request validation
- Load balancing
- Asset metadata management
- Asset categorization and tagging
- Asset lifecycle management
- Asset versioning
- File upload and download
- S3-based file storage (AWS S3 or MinIO)
- File format validation
- File access control
- Cloud storage integration
- Media file conversion
- Video/audio processing
- Format optimization
- Batch processing
- Full-text search across assets
- Advanced filtering and sorting
- Search result ranking
- Search analytics
- Build the docker images
make docker-build- Set up environment variables:
cp .env.example .env
# Edit .env with your configuration:
# S3_BUCKET=your-bucket-name
# S3_REGION=us-east-1
# S3_ACCESS_KEY=your-access-key
# S3_SECRET_KEY=your-secret-key
# S3_ENDPOINT_URL=https://s3.amazonaws.com # For AWS S3
# JWT_SECRET_KEY=your-super-secret-jwt-key-change-in-production
# ADMIN_PASSWORD=your-admin-password
# USER_PASSWORD=your-user-password- Start the services
# Start all services
make docker-up- Access the service Go to http://localhost:80
Note: The frontend uses host-relative URLs by default, so API calls will automatically use the same host as the frontend.
The API and frontend require authentication. Use the following credentials to get started:
- Username:
admin - Password: Set via
ADMIN_PASSWORDenvironment variable (default:admin123) - Username:
user - Password: Set via
USER_PASSWORDenvironment variable (default:user123)
The React frontend includes a complete authentication system:
- Login Page: Modern, responsive login interface
- Demo Buttons: Quick login with predefined credentials
- User Display: Shows current user and role in header
- Auto-login: Persistent sessions using localStorage
- Protected Routes: All features require authentication
See AUTHENTICATION.md for detailed backend authentication instructions. See src/frontend/AUTHENTICATION.md for frontend authentication details.
For local development without Docker, use the provided startup script:
- Install dependencies:
pip install -r requirements.txt- Start services locally:
# Start all services
python start_local.py
# Or start specific services
python start_local.py api-gateway assets-service- Access services:
- API Gateway: http://localhost:8000
- Assets Service: http://localhost:8001
- Files Service: http://localhost:8002
- Transcode Service: http://localhost:8003
- Search Service: http://localhost:8004 (requires authentication)
- Frontend: http://localhost:3000 (run separately with
npm start)
- Access metrics:
- API Gateway Metrics: http://localhost:9090/metrics
- Assets Service Metrics: http://localhost:9091/metrics
- Files Service Metrics: http://localhost:9092/metrics
- Search Service Metrics: http://localhost:9093/metrics
- Transcode Service Metrics: http://localhost:9094/metrics
The project includes GitHub Actions that automatically build and push Docker images to Docker Hub under the iconikio account.
-
Clone the repository:
git clone <repository-url> cd mini-mam
-
Set up environment variables:
cp env.example .env # Edit .env with your configuration -
Run with pre-built images:
docker-compose -f docker-compose.prod.yml up -d
The following images are available on Docker Hub:
iconikio/mini-mam-api-gatewayiconikio/mini-mam-assets-serviceiconikio/mini-mam-files-serviceiconikio/mini-mam-transcode-serviceiconikio/mini-mam-search-serviceiconikio/mini-mam-frontend
main: Latest from main branchv1.0.0: Semantic version tagssha-abc123: Commit-specific tags
To build images locally:
# Build all services
docker-compose build
# Or build individual services
docker build -f docker/api-gateway.Dockerfile -t mini-mam-api-gateway .
docker build -f docker/assets-service.Dockerfile -t mini-mam-assets-service .
# ... etcFor development it is also possible to run all services locally
# Start individual services
python src/api-gateway/app.py
python src/assets-service/app.py
python src/files-service/app.py
python src/transcode-service/app.py
python src/search-service/app.py
# Or use the startup script
python start.py- Frontend:
http://localhost:80/ - API Gateway:
http://localhost:80/api/
- Assets Service:
http://localhost:80/api/assets/ - Files Service:
http://localhost:80/api/files/ - Transcode Service:
http://localhost:80/api/transcode/ - Search Service:
http://localhost:80/api/search/
- S3 Storage: Configured via environment variables (AWS S3 or other S3-compatible services)
Each service exposes RESTful APIs with comprehensive documentation available at:
- API Gateway:
http://localhost:80/api/docs - Assets Service:
http://localhost:80/assets/docs - Files Service:
http://localhost:80/files/docs - Transcode Service:
http://localhost:80/transcode/docs - Search Service:
http://localhost:80/search/docs
- Python 3.8+
- Docker and Docker Compose
- PostgreSQL (for data persistence)
- AWS S3 bucket (or other S3-compatible storage service)
mini-mam/
├── src/ # Source code directory
│ ├── frontend/ # React application
│ ├── api-gateway/ # API Gateway service
│ ├── assets-service/ # Assets management service
│ ├── files-service/ # File handling service
│ ├── transcode-service/ # Media transcoding service
│ ├── search-service/ # Search functionality service
│ └── shared/ # Shared utilities and models
├── config/ # Configuration files
├── docker/ # Docker configurations
├── requirements.txt # Python dependencies
├── docker-compose.yml # Service orchestration
└── README.md # This file
- Frontend:
http://localhost:80/(main application) - API Gateway:
http://localhost:80/api/(all API endpoints) - Assets API:
http://localhost:80/api/assets/ - Files API:
http://localhost:80/api/files/ - Search API:
http://localhost:80/api/search/ - Transcode API:
http://localhost:80/api/transcode/
Run tests for all services:
python test_framework.py- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request