A REST API for video catalog management built with Clean Architecture and Domain-Driven Design (DDD). The project implements a complete catalog system with videos, categories, genres, and cast members, including media upload and video processing.
Flixer Catalog API is a video catalog management system that allows:
- Video Management: Create, update, list, and delete videos with detailed information
- Category Organization: Categorize videos for better organization
- Genre Classification: Classify content using multiple genres
- Cast Management: Register and associate directors and actors with videos
- Media Upload: Upload videos, trailers, thumbnails, and banners
- Video Processing: Asynchronous encoding system using messaging
- Authentication and Authorization: Role-based access control using Keycloak
The project follows Clean Architecture and Domain-Driven Design (DDD) principles, organizing code into well-defined layers:
βββββββββββββββββββββββββββββββββββββββββββ
β Flixer.Catalog.Api β β Controllers, Middlewares
β (Presentation Layer) β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββββββ
β Flixer.Catalog.Application β β Use Cases, DTOs, Queries
β (Application Layer) β
ββββββββββββββββ¬βββββββββββββββββββββββββββ
β
ββββββββββββββββΌβββββββββββββββββββββββββββ
β Flixer.Catalog.Domain β β Entities, Value Objects
β (Domain Layer) β Business Rules
ββββββββββββββββ²βββββββββββββββββββββββββββ
β
ββββββββββββββββ΄βββββββββββββββββββββββββββ
β Flixer.Catalog.Infra.* β β Repositories, Persistence
β (Infrastructure Layer) β Storage, Messaging
ββββββββββββββββββββββββββββββββββββββββββββ
- API: Controllers, configurations, filters, and middlewares
- Application: Use cases (Commands/Queries), validations, service interfaces
- Domain: Entities, aggregates, value objects, domain events, and business rules
- Infrastructure: Repository implementations, data access (Entity Framework), storage (Google Cloud Storage), and messaging (RabbitMQ)
- Create video with metadata (title, description, year, duration, rating)
- Update video information
- Upload media files (video, trailer)
- Upload images (thumbnail, thumbnail half, banner)
- List videos with pagination and filters
- Get video by ID
- Delete video
- Update video encoding status
- Create categories
- Update categories
- Activate/Deactivate categories
- List categories with pagination and search
- Get category by ID
- Delete category
- Create genres
- Update genres
- Associate categories with genres
- Activate/Deactivate genres
- List genres with pagination and search
- Get genre by ID
- Delete genre
- Create cast members (actor/director)
- Update cast members
- List members with pagination and search
- Get member by ID
- Delete cast member
- JWT Authentication via Keycloak
- Role-based authorization (admin, catalog-admin)
- File Upload to Google Cloud Storage
- Asynchronous processing of videos via RabbitMQ
- Health Checks for MySQL, RabbitMQ, and Entity Framework
- Structured logging with Serilog
- OpenAPI/Swagger documentation
- .NET 6: Main framework
- C#: Programming language
- Entity Framework Core 6: ORM for data access
- Pomelo.EntityFrameworkCore.MySql: MySQL provider for EF Core
- MySQL 8: Relational database
- Keycloak 20.0.3: Identity and access management system
- Keycloak.AuthServices: Keycloak integration with .NET
- IdentityModel.AspNetCore: OAuth2/OpenID Connect support
- RabbitMQ 3: Message broker for asynchronous communication
- RabbitMQ.Client: .NET client for RabbitMQ
- Google Cloud Storage: Video and image storage
- MediatR: CQRS and mediator pattern implementation
- FluentValidation: Entity and DTO validation
- Serilog: Structured logging
- xUnit: Testing framework
- Fluent Assertions: Fluent assertions for tests
- Moq: Mocking framework
- Bogus: Fake data generation for tests
- Docker: Containerization
- Docker Compose: Container orchestration
- GitHub Actions: CI/CD pipeline
- AspNetCore.HealthChecks: Health checks for MySQL, RabbitMQ, and EF Core
- Serilog.AspNetCore: HTTP request logging
- Docker and Docker Compose installed
- .NET 6 SDK (for local development)
- IDE/Editor: Visual Studio, Visual Studio Code, or JetBrains Rider
-
Clone the repository
git clone https://github.com/jaugustodev/flixer.git cd flixer -
Verify Docker is installed
docker --version
-
Start the containers
docker compose -f docker-compose.yml up -d
-
Check container status
docker compose ps
-
Access the application
- API Swagger: http://localhost:5000/swagger/index.html
- RabbitMQ Management: http://localhost:15672
- Username:
adm_videos - Password:
123456
- Username:
- Keycloak Admin: http://localhost:8443
- Username:
admin - Password:
admin
- Username:
-
To stop and remove containers
docker compose -f docker-compose.yml down
-
Start only dependencies (MySQL, RabbitMQ, Keycloak)
docker compose up flixer_db rabbitmq keycloak -d
-
Restore dependencies
dotnet restore
-
Run database migrations
dotnet ef database update --project src/Flixer.Catalog.Infra.Data.EF
-
Run the application
dotnet run --project src/Flixer.Catalog.Api
The project includes a complete test suite:
dotnet test tests/Flixer.Catalog.UnitTest-
Start test containers
docker compose -f docker-compose-integration.yml up -d
-
Run tests
dotnet test tests/Flixer.Catalog.IntegrationTests -
Stop test containers
docker compose -f docker-compose-integration.yml down
dotnet test tests/Flixer.Catalog.EndToEndTestsdotnet testflixer/
βββ src/
β βββ Flixer.Catalog.Api/ # Presentation layer (Controllers, Middlewares)
β βββ Flixer.Catalog.Application/ # Use cases and application logic
β βββ Flixer.Catalog.Domain/ # Entities, Value Objects, business rules
β βββ Flixer.Catalog.Infra.Data.EF/ # Repositories and data access (EF Core)
β βββ Flixer.Catalog.Infra.Storage/ # Google Cloud Storage integration
β βββ Flixer.Catalog.Infra.Messaging/ # RabbitMQ integration
βββ tests/
β βββ Flixer.Catalog.UnitTest/ # Unit tests
β βββ Flixer.Catalog.IntegrationTests/ # Integration tests
β βββ Flixer.Catalog.EndToEndTests/ # End-to-end tests
β βββ Flixer.Catalog.Tests.Shared/ # Shared code between tests
βββ docker-compose.yml # Docker configuration for production
βββ docker-compose-integration.yml # Docker configuration for tests
βββ Flixer.Catalog.sln # Project solution
- Video: Main aggregate representing a video with all its metadata
- Category: Categories for video organization
- Genre: Genres that can be associated with videos
- CastMember: Cast members (actors/directors)
- Media: Value object representing media files (video/trailer)
- Image: Value object representing images (thumb/banner)
POST /api/videos- Create new videoGET /api/videos- List videos (with pagination)GET /api/videos/{id}- Get video by IDPUT /api/videos/{id}- Update videoDELETE /api/videos/{id}- Delete videoPOST /api/videos/{id}/upload-media- Upload media
POST /api/categories- Create categoryGET /api/categories- List categories (with pagination)GET /api/categories/{id}- Get category by IDPUT /api/categories/{id}- Update categoryDELETE /api/categories/{id}- Delete category
POST /api/genres- Create genreGET /api/genres- List genres (with pagination)GET /api/genres/{id}- Get genre by IDPUT /api/genres/{id}- Update genreDELETE /api/genres/{id}- Delete genre
POST /api/cast-members- Create cast memberGET /api/cast-members- List members (with pagination)GET /api/cast-members/{id}- Get member by IDPUT /api/cast-members/{id}- Update memberDELETE /api/cast-members/{id}- Delete member
GET /health- Check application and dependencies health
The project uses GitHub Actions for automated CI/CD.
Triggered on:
- Push to
mainbranch - Pull requests to
mainbranch
- Repository Checkout: Clone source code
- .NET Core Setup: Prepare environment with .NET 6.x
- Start Containers: Bring up test containers via
docker-compose-integration.yml - Restore Dependencies: Execute
dotnet restore - Build Project: Compile the code
- Run Tests: Execute entire test suite and generate reports
- DockerHub Login: Authenticate to DockerHub
- Build and Push Docker Image: Build and push image to DockerHub
| Name | Type | Download |
|---|---|---|
| Visual Studio Code | Editor | Download |
| Visual Studio Community | IDE | Download |
| JetBrains Rider | IDE | Download |
- C# Dev Kit: Complete support for C# and .NET
- Docker: Container management
- SonarLint: Real-time bug and code smell detection
- GitLens: Advanced Git features
- REST Client: Test APIs directly from VS Code
- SonarLint: Flags potential bugs and code smells - More info
Contributions are welcome! Please follow these guidelines:
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- Follow SOLID principles
- Write tests for new features
- Maintain high test coverage
- Use descriptive names for variables and methods
- Document complex code