An open API service indexing awesome lists of open source software.

https://github.com/aritrac1/lyrixtube

LyrixTube is a full-stack application that extracts song information from YouTube music links and retrieves accurate lyrics using the Genius Lyrics API. Built with Flutter for a beautiful UI and Node.js/Express for a robust backend.
https://github.com/aritrac1/lyrixtube

android dart dio docker docker-compose expressjs flutter full-stack-app-development genius-api ios javascript lyrics-generator mobile-app nodejs provider provider-state-management youtube-music-lyrics-generator

Last synced: about 20 hours ago
JSON representation

LyrixTube is a full-stack application that extracts song information from YouTube music links and retrieves accurate lyrics using the Genius Lyrics API. Built with Flutter for a beautiful UI and Node.js/Express for a robust backend.

Awesome Lists containing this project

README

          

# 🎡 LyrixTube

> A full-stack lyrics lookup app that generates song lyrics from YouTube music links.

LyrixTube combines a Flutter mobile frontend with a Node.js/Express backend. The backend extracts metadata from YouTube URLs, searches Genius for lyrics, formats them, and caches results in MongoDB.

## ✨ What’s Included

- 🎬 YouTube song metadata extraction using `play-dl`
- πŸ“ Lyrics lookup with `genius-lyrics`
- 🧠 MongoDB caching layer for repeated searches
- πŸ“± Flutter UI with Provider state management and Dio HTTP client
- 🐳 Docker Compose setup for backend + MongoDB
- πŸ§ͺ Jest backend tests with Supertest

## πŸ› οΈ Tech Stack

### Frontend
- Flutter
- Dart
- Provider
- Dio
- Shimmer

### Backend
- Node.js
- Express
- MongoDB / Mongoose
- Genius Lyrics API
- play-dl
- CORS
- dotenv

## Demo

| Home | Lyrics |
| -------------------------------------------------- | --------------------------------------------------- |
| Home screen | Lyrics screen |

## πŸ“‹ Project Structure

```
LyrixTube/
β”œβ”€β”€ lyrix_tube_app/ # Flutter frontend
β”‚ β”œβ”€β”€ lib/
β”‚ β”‚ β”œβ”€β”€ main.dart
β”‚ β”‚ β”œβ”€β”€ provider/ # app state
β”‚ β”‚ └── screen/ # UI screens
β”‚ β”œβ”€β”€ android/
β”‚ β”œβ”€β”€ ios/
β”‚ └── pubspec.yaml
β”œβ”€β”€ server/ # Node.js backend
β”‚ β”œβ”€β”€ Dockerfile
β”‚ β”œβ”€β”€ .env.example
β”‚ β”œβ”€β”€ index.js
β”‚ β”œβ”€β”€ app.js
β”‚ β”œβ”€β”€ config/db.js
β”‚ β”œβ”€β”€ controllers/
β”‚ β”œβ”€β”€ routes/
β”‚ β”œβ”€β”€ services/
β”‚ β”œβ”€β”€ models/
β”‚ └── utils/
β”œβ”€β”€ docker-compose.yml # backend + MongoDB orchestration
└── README.md # this file
```

## πŸš€ Getting Started

### Prerequisites

- Flutter 3.6.0+
- Node.js 14+
- npm or yarn
- Docker & Docker Compose (optional, recommended for backend)

### 1. Clone the repository

```bash
git clone https://github.com/AritraC1/LyrixTube.git
cd LyrixTube
```

### 2. Backend setup

```bash
cd server
npm install
cp .env.example .env
```

Edit `server/.env` and set:

```env
PORT=3000
GENIUS_TOKEN=your_genius_api_key
MONGO_INITDB_ROOT_USERNAME=admin
MONGO_INITDB_ROOT_PASSWORD=your_mongo_super_secret_password
MONGO_INITDB_DATABASE=lyrixtube
MONGO_URI=mongodb://admin:your_mongo_super_secret_password@mongo:27017/your_database_name?authSource=admin
```

Start the backend locally:

```bash
npm start
```

The backend will run on `http://localhost:3000`.

### 3. Frontend setup

```bash
cd ../lyrix_tube_app
flutter pub get
flutter run
```

## 🐳 Docker Setup

The backend and MongoDB are orchestrated with Docker Compose.

### Start services

```bash
docker compose up --build -d
```

### Verify services

```bash
docker compose ps
curl http://localhost:3001/health
curl http://localhost:3001/db-health
```

### Stop services

```bash
docker compose down
```

## πŸ”Œ API Endpoints

### Health

- `GET /health` β€” service health status
- `GET /db-health` β€” MongoDB connection status

### Lyrics

- `POST /api/generate-lyrics`

Request body:

```json
{
"link": "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
}
```

Success response:

```json
{
"status": "success",
"data": {
"song": "Never Gonna Give You Up",
"artist": "Rick Astley",
"lyrics": "[Chorus]\nNever gonna give you up..."
}
}
```

Error response:

```json
{
"status": "error",
"message": "..."
}
```

## 🧠 Backend behavior

- Validates YouTube video URLs using `play-dl`
- Extracts artist and song names from video titles
- Searches Genius for the best lyrics match
- Filters out junk or translation results
- Formats lyrics and caches them in MongoDB
- Increments `search_count` for repeated lookups

## πŸ§ͺ Testing

Run backend tests:

```bash
cd server
npm test
```

## πŸ” Environment variables

Copy `server/.env.example` to `server/.env` and configure values.

- `PORT` β€” backend port
- `GENIUS_TOKEN` β€” Genius API token
- `MONGO_URI` β€” MongoDB URI
- `MONGO_INITDB_ROOT_USERNAME` β€” MongoDB root user
- `MONGO_INITDB_ROOT_PASSWORD` β€” MongoDB root password
- `MONGO_INITDB_DATABASE` β€” database name

## πŸ“ Notes

- The Flutter app is not containerized in this repository.
- MongoDB is used for caching lyrics and improving repeated requests.
- Docker Compose maps host port `3001` to the backend container port `3000`.

---