This microservice is used for converting MP4 video files to MP3 audio files and consists of the following services:
- Auth Service
- Converter Service
- Notification Service
- API Gateway
This service manages user authentication, which includes registration, login, and token validation.
The purpose of this service is to convert MP4 video files to MP3 audio files, utilizing the FFmpeg library.
This service sends an email notification to the user after a file has been successfully converted.
This service serves as a connection point between the client and other services, acting as an intermediary.
This service architecture employs RABBITMQ
as a message broker for internal communication between services.
Here is an overview of the microservices architecture:
- After registering, users must log in to obtain an authentication token.
- This token is required to access the upload video endpoint.
- When a user hits the upload endpoint, the API gateway verifies the validity and expiration status of the token.
- If the token is valid, the video is uploaded to MongoDB GridFS, and a message is sent to the videos queue.
- The converter services then receive the message from the videos queue, convert the video to audio, and upload the audio to MongoDB GridFS.
- Next, the converter services send a message to the audios queue.
- Finally, the notification services receive the message from the audios queue and notify the user with a download link for the audio file.
-
Prerequisites
Make sure you have the following installed on your machine- nodejs
- kubectl
- minikube
- docker
- mongodb
- mysql
-
Clone the repo
git clone https://github.com/devwalex/converter-microservices
-
Set up environment variables for each service
cp .env.example .env
-
Run migration for auth service
cd auth npm run migrate
-
Start minikube and minikube tunnel
minikube start minikube tunnel
-
Start all the services
kubectl apply -f ./auth/manifests kubectl apply -f ./gateway/manifests kubectl apply -f ./converter/manifests kubectl apply -f ./notificaton/manifests kubectl apply -f ./rabbitmq/manifests
-
Add the gateway and rabbitmq manager domain to your etc/hosts file
127.0.0.1 videotoaudio.com 127.0.0.1 rabbitmq-manager.com
Add these 👆 lines of code to your /etc/hosts file.
nano /etc/hosts
This will enable you to access the domain locally on your browser.
-
Check if all the service is created
kubectl get services
-
Access the gateway and rabbitmq manager URL from your machine
http://rabbitmq-manager.com (username - guest, password - guest)
-
API documentation
Usman Salami
MIT