This is a web application developed in Spring Boot for movie management and streaming. The application includes features like JWT-based authentication, Spring MVC for handling HTTP requests, and an access control system based on user permissions. Additionally, it supports movie streaming using HLS (HTTP Live Streaming).
- Movie and user management.
- User login and registration with JWT authentication.
- Movie reviews with the ability to add ratings and comments.
- Video streaming in HLS format.
- Access control based on user permissions.
- Secure endpoints using JWT authentication.
- User interaction pages rendered using Thymeleaf.
- Application monitoring with Grafana and Prometheus running in Docker containers.
- Redis for caching to enhance system performance.
- RabbitMQ for messaging, aiding in high-scale processing.
- Java: Main programming language.
- Spring Boot: Framework used for developing the application.
- Spring Security: For authentication and authorization using JWT.
- JWT (JSON Web Token): For secure API authentication.
- Spring MVC: For managing HTTP requests and routing.
- HLS (HTTP Live Streaming): For video streaming.
- Thymeleaf: Template engine to render HTML pages.
- ModelMapper: For entity-to-DTO conversion.
- Docker: For containerizing the application and monitoring services.
- MySQL: Relational database used for storing movies and users data.
- Redis: Caching system for optimizing queries.
- RabbitMQ: Messaging system for inter-service communication.
- Grafana: Monitoring and analytics platform.
- Prometheus: Monitoring and alerting toolkit.
- JDK 17 or later
- Maven 3.6+
- MySQL or any other relational database
- Redis (optional, but recommended for caching)
- Docker (to run RabbitMQ, Grafana, and Prometheus)
- Postman (to test the API endpoints)
- FFmpeg (To convert videos into .m3u8 and .ts segments)
-
Clone the repository:
git clone https://github.com/ismael221/OpenStreamify
-
Configure the database in the
application.properties
file:spring.datasource.url=jdbc:mysql://localhost:3306/database_name spring.datasource.username=your_username spring.datasource.password=your_password spring.jpa.hibernate.ddl-auto=update spring.jpa.show-sql=true
-
Start Redis (if using Docker):
docker run -d --name redis -p 6379:6379 redis
-
Start RabbitMQ with the following command:
docker run -it --rm --name rabbitmq -p 5672:5672 -p 15672:15672 rabbitmq:3.13-management
-
Run the project with the following command in the root directory:
mvn spring-boot:run
-
Start Grafana and Prometheus in Docker containers by running:
docker-compose up -d
-
Access the application in your browser:
http://localhost:8080
-
Access Grafana for monitoring:
http://localhost:3000
- Username:
admin
- Password:
admin
- Username:
-
Access Prometheus to view collected data:
http://localhost:9090
- POST
/auth/register
: User registration. - POST
/auth/login
: User authentication and JWT generation.
- GET
/api/v1/movies
: Lists all movies. - POST
/api/v1/movies
: Adds a new movie. - GET
/api/v1/movies/{rid_movie}
: Retrieves details of a specific movie. - POST
/api/v1/ratings
: Adds a review for a movie.
- GET
/api/v1/media/hls/{filename}.m3u8
: Streams the video using HLS based on the file name.
All routes, except login and registration, require a JWT token for authentication. To access protected routes, pass the token in the request header:
Authorization: Bearer <your-jwt-token>
To see all available endpoints and their descriptions, access Swagger UI:
http://localhost:8080/swagger-ui.html
src/main/java/com/ismael/movies
: Contains the Java classes, including controllers, services, models, and repositories.src/main/resources/templates
: Contains HTML pages rendered by Thymeleaf.src/main/resources/static
: Contains static files like CSS and JavaScript.src/main/resources/application.properties
: Application configuration.
The application uses JWT tokens for authentication and authorization. After logging in, the user receives a token that must be included in the header of all subsequent requests to protected routes.
- Integration with messaging services for high-scale processing using RabbitMQ.
- Implementation of a CDN to enhance streaming performance at scale.
- Support for multiple video qualities in HLS.
- Implementation of Redis cache to optimize system performance.
Contributions are welcome! Feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.