A robust and scalable RESTful API service for managing song lyrics, translations records. Built with Kotlin, Spring Boot, MongoDB database and Meilisearch for searching, featuring advanced duplicate detection and clean architecture patterns.
SimpMusic Lyrics is focusing on YouTube Music, providing data from videoId
of the track. The database is populated by
the community, SimpMusic app users, and through automated crawling of other web services.
The app is in alpha phase, the APIs will be changed
https://api-lyrics.simpmusic.org/v1
- Lyrics Management: Create, read, search, and manage song lyrics
- Super Fast Search: Powered by Meilisearch for quick full-text search
- Multi-language Support: Handle translated lyrics in multiple languages
- Advanced Search: Search by song title, artist name, or full-text content
- Duplicate Detection: SHA256-based content deduplication
- Real-time Processing: Asynchronous operations with Kotlin Coroutines
- Standardized API Responses: Consistent response format with type-safe handling of success, error, and processing states
git clone https://github.com/your-username/lyrics-api.git
cd lyrics-api
- If you want to use Sentry for error tracking, create a Sentry account and get your DSN.
- Note your Meilisearch URL and Master Key
- Using Meilisearch for super fast search capabilities
- Note your MongoDB connection string and database name
Create .env
following the .env.example
# Clean and build
./gradlew clean build
# Run tests
./gradlew test
# Generate JAR
./gradlew bootJar
# Development mode
./gradlew bootRun
# Production mode
java -jar build/libs/lyrics-<version>.jar
The application automatically creates required collections:
lyrics
- Main lyrics collectiontranslated_lyrics
- Translated lyrics collection
http://localhost:8080/v1
http://localhost:8080/swagger-ui/index.html
# All endpoints now return ApiResult<T> wrapper with standardized response format
GET /v1/{videoId} # Get lyrics by video ID
GET /v1/{videoId}?limit=10&offset=0 # Get paginated lyrics by video ID
GET /v1/search/title?title= # Search by song title
GET /v1/search/title?title=&limit=10&offset=0 # Paginated search by song title
GET /v1/search?q= # Full-text search
GET /v1/search?q=&limit=10&offset=0 # Paginated full-text search
POST /v1 # Create new lyrics
GET /v1/translated/{videoId} # Get translations
GET /v1/translated/{videoId}?limit=10&offset=0 # Get paginated translations
GET /v1/translated/{videoId}/{language} # Get specific translation
POST /v1/translated # Create translation
POST /v1/vote # Vote for lyrics -> ApiResult<LyricResponseDTO>
POST /v1/translated/vote # Vote for translated lyrics -> ApiResult<TranslatedLyricResponseDTO>
All API endpoints now return responses with a standardized structure using ApiResult<T>
wrapper:
{
"data": [
...
],
"success": true
}
{
"error": {
"error": true,
"code": 404,
"reason": "Lyrics not found for videoId: abc123"
},
"success": false
}
{
"processing": {
"code": 102,
"message": "Processing request to get lyrics for videoId: abc123"
},
"success": false
}
This standardized format makes it easier to handle API responses consistently across clients. The success
field
provides a quick way to determine the response type.
The API is protected with rate limiting to prevent abuse:
- 15 requests per minute per IP address
- Applies to all API endpoints
- When limit is exceeded, returns HTTP 429 (Too Many Requests)
All non-GET requests (POST, PUT, DELETE, PATCH) require HMAC authentication:
- Generate a timestamp (current time in milliseconds)
- Create data string:
timestamp + request_uri
- Generate HMAC using the shared secret key, checkout
generateHmac
function inHmacService.kt
for full algorithm. - Add headers to your request:
X-Timestamp
: Your timestampX-HMAC
: Your generated HMAC token
- Your HMAC token is available in 5 minutes
Example using curl:
# Headers required
X-Timestamp: 1630000000000
X-HMAC: base64EncodedHmacToken
# Example command
curl -X POST "http://localhost:8080/v1" \
-H "Content-Type: application/json" \
-H "X-Timestamp: 1630000000000" \
-H "X-HMAC: base64EncodedHmacToken" \
-d '{"videoId":"dQw4w9WgXcQ", ...}'
- Basic CRUD operations for lyrics
- Security for non-GET requests
- Rate limiting
- Paginated search
- Standardized API response format
- Input data
- Public server
- Frontend integration
- Automated remove negative votes lyrics
This project is licensed under the MIT License - see the LICENSE file for details.
Check out the Vercel open-source program:
Get free $200 credit over 60 days on DigitalOcean: GET NOW
Crowdin and Sentry both have a free enterprise plan for Open-source projects. Follow the URLs:
This project is a part of SimpMusic.org Open-source project by me maxrave-dev