Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/hwanheejung/spotify-lq-client

[CLIENT] A Spotify-inspired app featuring Lyrics Quizzes, real-time lyrics sync, and personalized music playback, built with Next.js.
https://github.com/hwanheejung/spotify-lq-client

apollo apollo-client graphql graphql-client nextjs spotify spotify-playback-sdk tailwindcss typescript zustand

Last synced: about 1 month ago
JSON representation

[CLIENT] A Spotify-inspired app featuring Lyrics Quizzes, real-time lyrics sync, and personalized music playback, built with Next.js.

Awesome Lists containing this project

README

        

Spotify Badge
Next Badge
Typescript Badge
ApolloGraphql Badge
tailwindcss Badge

# ๐ŸŽง Spotify

> [!IMPORTANT]
> Both **Spotify Playback** and **Spotify Web API** require users to authenticate with a valid Spotify **Premium** subscription.


## ๐Ÿ“ธ Screenshots

Real-time lyrics sync

![แ„’แ…ชแ„†แ…งแ†ซ แ„€แ…ตแ„…แ…ฉแ†จ 2024-12-02 แ„‹แ…ฉแ„’แ…ฎ 4 40 29](https://github.com/user-attachments/assets/9e26b864-1774-4381-90f4-797513120321)


## ๐ŸŽน Features

โ™ช **Real-Time Music Playback**: Play songs using the Spotify Playback SDK.
โ™ช **Playback Controls**: Full playback functionality including play, pause, next, previous, shuffle, and repeat.
โ™ช **Personalized Access**: View and play your saved playlists, albums, and liked songs.
โ™ช **Playback Devices**: Switch between different playback devices (desktop, mobile, smart speakers).
โ™ช **Lyrics Sync**: Follow along with synced lyrics for a karaoke-like experience.
โ™ช **Custom Playlists**: Create and manage your own playlists within the app.


## ๐ŸŽธ Technologies Used

โ™ช **Next.js**: Frontend framework for building user interface.
โ™ช **Apollo Client**: GraphQL client for fetching data from Apollo Server.
โ™ช **Zustand**: Client state management.
โ™ช **Node.js(Express)**: Backend server handling Spotify Web API requests and managing authentication.
โ™ช **Apollo Server**: GraphQL server for securely delivering Spotify data to the frontend.
โ™ช [**Spotify Web API**](https://developer.spotify.com/documentation/web-api): Used exclusively by the backend server for fetching Spotify data like playlists, albums, and playback status.
โ™ช [**Spotify Playback SDK**](https://developer.spotify.com/documentation/web-playback-sdk): Enables real-time music playback on the frontend.


## ๐Ÿฅ Architecture Overview

This project follows a client-server architecture that integrates the Spotify Web Playback SDK for real-time music playback and the Spotify Web API for data fetching.

### 1. Backend (Express + Apollo Server) ๐Ÿ‘‰ [repo](https://github.com/hwanheejung/Spotify-LT-Server)

- Handles authentication with `Spotify API` (OAuth flow). ๐Ÿ‘‰ [blog post](https://hwanheejung.tistory.com/65)
- Fetches Spotify data (e.g., playlists, albums, playback state) via the `Spotify Web API`.
- Acts as a `GraphQL server` (using Apollo Server) to securely expose Spotify data to the frontend.
- Manages sensitive credentials (e.g., Spotify client ID and secret) and ensures they are never exposed to the client.

### 2. Frontend (Next.js + Apollo Client)

- Connects to the backend's `Apollo Server` to retrieve and display Spotify data using GraphQL.
- Manages playback controls (play, pause, skip) and state updates via the `Spotify Web Playback SDK`.
- Directly interacts with `Spotify's playback server` for real-time track streaming and control.
- Does not directly communicate with the `Spotify Web API`, ensuring API credentials are securely managed by the backend.

### 3. Communication Flow

```mermaid
graph LR
A[Frontend] -->|GraphQL Queries| B[Apollo Client]
B -->|Fetch Data| C[Apollo Server]
C -->|API Requests| D[Spotify Web API]
D -->|API Responses| C
C -->|GraphQL Responses| B
B -->|Update UI| A
A -->|Playback Controls| E[Spotify Web Playback SDK]
E -->|Manage Playback| A
```


## ๐Ÿ› ๏ธ Troubleshooting

- **Playback Not Starting**: Ensure you have a Spotify **Premium** account and the app is connected to an active device.

- **Authentication Errors**: Verify your environment variables and Spotify Developer Dashboard settings.

- **API Rate Limits**: Avoid exceeding Spotify Web APIโ€™s rate limits. Use caching to optimize requests.