A clean architecture Music Library Management application built with Golang (Gin) and MongoDB.
It supports:
- CRUD operations for tracks and playlists
- MP3 uploads using GridFS
- Image uploads using Cloudinary
- Search functionality
- Simple MP3 streaming
cd music-library-api⚠ Important: Make sure you are in the root folder of the project where
docker-compose.ymlexists before running anydocker-composecommands.
docker-compose up -dThis will automatically:
-
Start MongoDB
-
Build and run the Backend API
-
🌐 Expose your API at: http://localhost:8080
-
📘 API Documentation (Swagger UI): http://localhost:8080/swagger/index.html
⚠ Important: Ensure the
backups/folder exists and is correctly mounted in the MongoDB container before running any backup or restore commands.
docker exec music_mongo_prod sh -c "mongodump --db music_library --username root --password Admin@123 --authenticationDatabase admin --archive=/dump/music_library_$(date +%Y%m%d_%H%M%S).gz --gzip"./backups/music_library_20251130_123456.gz⚠ Important: Replace the
backup_file_namebelow with the actual backup file you want to restore.
💡 Example Backup File Name (you can repalce):
music_library_20251130_114415.gz
docker exec -i music_mongo_prod sh -c "mongorestore --username root --password Admin@123 --authenticationDatabase admin --archive=/dump/<backup_file_name>.gz --gzip --db music_library --drop"GET /api/tracks/{id}/stream├── backups/
│ └── *.gz
├── cmd/
│ └── main.go
├── configs/
├── docs/
├── internal/
│ ├── dto/
│ ├── handlers/
│ ├── mappers/
│ ├── models/
│ ├── repositories/
│ ├── routers/
│ └── services/
├── pkg/
│ ├── databases
│ └── utils
├── uploads/
│ ├── *.mp3
├── Dockerfile
├── Dockerfile.local
├── docker-compose.yaml
├── docker-compose-local.yaml
└── run.sh
docker-compose downdocker-compose down -vdocker compose down -v --rmi all --remove-orphansJust run docker-compose and everything works out of the box.
- Golang 1.25.1 🟦
- Gin ⚡ (HTTP web framework)
- MongoDB 🗄 (
mgm v3,GridFS) - Cloudinary ☁️ (Image upload)
- Swagger 📑 (API docs)
- Docker & Docker compose 🐳 (Containerization)
- Audio Processing 🎵 (
tag,go-mp3)