How rdmm404/smoodi works
Main components
• Frontend: Built in React (with Vite and Tailwind CSS), it is responsible for displaying the UI and handling client-side routing (pages like HomePage, AfterLoginPage, BlendifyPage, etc.). It lives chiefly in the src/frontend directory.
• Backend: A Flask web server that handles API endpoints, authentication (OAuth 2.0), and the main business logic (e.g., playlist blending). Look into src/backend (with dedicated files for the API such as blender.py and users.py, along with error handlers and commands).
• Redis Database: Acts as a temporary data store for user tokens and session information. Its configuration and Docker setup can be found under build/dev/redis.
• Spotify API Integration: The backend calls the Spotify API using a custom client found in src/core/client/spotify (which includes models and the spotify_client). This part is responsible for interacting with Spotify’s endpoints.
• Docker and Deployment: The project uses Docker (with Dockerfiles in build/dev/ and build/prd directories) and docker-compose (docker-compose.yml) to orchestrate the containers (frontend, backend, and Redis).
• Testing components: Located in src/tests, these files ensure backend (and to some extent core functions, e.g., the Blender logic) behave as expected.
Relationships and interactions
• The User’s Browser communicates with the frontend React app.
• The React app sends HTTP requests (or API calls) to the Flask backend server.
• The Flask backend handles authentication with Spotify using OAuth 2.0. It then uses the custom Spotify client to invoke Spotify’s API for retrieving top tracks and other data.
• The backend also interacts with Redis to store user session tokens/data temporarily (with expiry, as mentioned in the README).
• The entire setup is containerized – with separate containers for the frontend, backend, and Redis managed by Docker Compose.
• There’s a clear data flow: User → Frontend → Backend → [Redis and Spotify API].
Architectural patterns and frameworks
• Separation of Concerns: The project cleanly separates frontend responsibilities (UI, routing, state management) from backend responsibilities (API endpoints, authentication, business logic).
• Microservice-like Dockerization: Each core component (frontend, backend, Redis) is containerized.
• Use of industry-standard frameworks and patterns – React (component-based architecture) and Flask (modular API design).
• OAuth 2.0 is used for secure authentication and token management.
• Testing is done using pytest for the backend.
Relevant technologies to incorporate
• Frontend: React, Vite, Tailwind CSS, and TypeScript (see tsconfig.json and .tsx files).
• Backend: Python (Flask), Redis (for caching session data), and associated Python modules.
• Deployment: Docker (Dockerfiles, docker-compose.yml) specifying development and production builds.
• External Integration: Spotify API and OAuth 2.0 flows.
• Use clear labels for each component and service.
• Incorporate annotations where extra clarity is needed (e.g., “OAuth 2.0 Authentication”, “Ephemeral token storage”, “Containerized via Docker”).
• Separation between development and production aspects if necessary (e.g., slow debugging mode vs. production configuration in Docker Compose and build directories).