How cs222-uiuc/spotify-booster works
Project Type & Purpose
• Spotify Booster is a full-stack web application. The user logs in with Spotify and can generate mashups by analyzing track attributes (key, tempo, mode, etc.) from Spotify content.
• The project is divided between a frontend and a backend. The frontend is responsible for user interactions (login, search, display of mashups, playback, etc.), while the backend handles API endpoints, mashup generation, Spotify authentication, database operations using SQLite, and logging.
Main Architectural Components
• Frontend Component:
• Contains React code (in the /frontend directory) with components for login, input panels (finder and mashup tool), player controls, and splash screens.
• Has configuration files (e.g., spotify_config.js and backend_config.js) to connect with Spotify services and the backend.
• Backend Component:
• Houses multiple modules under /backend/src that can be grouped as follows:
▪ API Endpoints (mashup_api): Exposes endpoints to handle mashup and track-related requests.
▪ Mashup Generation (generate_mashup): Contains logic for finding optimal mashups and processing track data.
▪ Spotify Authentication (spotify_authentication): Handles login, token exchanges, and Spotify API integrations.
▪ Database Interfaces (database_interface and sqlite_interface): Abstracts and performs operations against the SQLite database.
▪ Logging (logger): Creates and manages application logs and profiling.
▪ Webserver (webserver): Sets up the server endpoints, requests routing, and middleware configurations.
• Also includes configuration files, environment file templates (template.env), and testing directories to ensure quality.
• External Integrations:
• Spotify API: Both frontend and backend interact with Spotify’s API for track data, authentication, search, and playback.
• SQLite Database: Managed by the backend for persistent storage of mashups and track data.
• Optional external services such as authentication flows and user data via Spotify.
Relationships and Data Flow
• The Frontend makes HTTP calls (REST API requests) to the Backend:
• User login, searches for tracks/albums/playlists, initiating mashup generation, and playback actions.
• The Backend processes these requests by:
• Validating user sessions via Spotify authentication.
• Calling internal modules in generate_mashup to actually process track sections.
• Interacting with the database through database_interface and sqlite_interface modules to save or retrieve mashup data.
• Logging significant events and errors using the logger infrastructure.
• Interaction with Spotify API:
• During login and for retrieving track info needed for generating the mashup.
• The backend’s spotify_authentication module handles token management and API requests as needed.
Architectural Patterns and Design Principles
• Separation of Concerns: Clearly delineate responsibilities between frontend (presentation layer) and backend (business logic and persistence layer).
• Modularity: The backend is organized into specific modules (configuration, API endpoints, mashup generation, logging, etc.) which promote reusability and easier testing.
• API-Driven Communication: A RESTful API design facilitates clear contracts between the frontend and backend.
• Environment-Based Configurations: Use of environment variables (via .env) for setting up different deployment scenarios (Development vs. Production).
Relevant Technologies/Frameworks
• Frontend: React, TypeScript, SCSS, Jest for testing.
• Backend: Node.js, TypeScript, Express or similar web server framework, ESLint, Prettier for code formatting, Winston for logging, and SQLite for persistence.
• Additional Tools: Testing frameworks (likely Mocha/Jest for backend tests), configuration files for tool integration.