A retro-styled web application that analyzes your Spotify listening habits through the lens of music critic culture. Connect your Spotify account to get your music taste "reviewed" with a custom scoring algorithm that judges your musical choices across multiple factors.
Built with Flask, PostgreSQL, and Docker for a production-ready, scalable architecture.
Note: This demo is hosted on Render's free tier. The first request may take 30-50 seconds as the service spins up from idle. The free PostgreSQL database expires after 30 days (currently until December 23, 2025), after which the app will no longer be accessible at this URL.
- Spotify OAuth Integration: Secure authentication with Spotify Web API
- Advanced Music Analysis: Multi-factor scoring algorithm analyzing:
- Genre diversity and "coolness" factor (70+ genres classified)
- Artist and track popularity metrics
- Follower count tiers
- Content explicitness
- Persistent Data Storage: PostgreSQL database with full data persistence
- Containerized Architecture: Docker and Docker Compose for consistent environments
- RESTful API: JSON endpoints for programmatic access to user data
- Retro Gaming Interface: Pixel-art inspired UI with interactive dialogue system
- Three-Page User Flow: Landing page → Track-by-track reviews → Comprehensive results
- Suspenseful Experience: Individual track scores revealed during review, final score saved for dramatic results page
- Session Management: Database-backed sessions with user history
- Custom Visual Elements: Themed scrollbars, glowing titles, and hover effects
- Responsive Design: Works on desktop and mobile devices
- Backend: Python 3.9+, Flask, SQLAlchemy
- Database: PostgreSQL 15 with array and UUID support
- Containerization: Docker, Docker Compose
- Frontend: HTML5, CSS3, JavaScript
- API: Spotify Web API (OAuth 2.0)
- Configuration: Environment variables with python-dotenv
- Styling: Custom CSS with Google Fonts (Press Start 2P)
- Development: Hot reload, health checks, persistent volumes
- Authentication: Users authenticate via Spotify OAuth 2.0
- Data Collection: App fetches user's top 20 tracks and detailed artist information
- Database Storage: All user data, tracks, and artist information cached in PostgreSQL
- Track-by-Track Review: Users cycle through individual tracks with personalized scoring
- Scoring Algorithm: Each track receives a "cool score" based on:
- Genre Bonus: +50 points for "cool" genres (metal, experimental, underground hip-hop, etc.)
- Popularity Scaling: Lower popularity = higher score (rewards discovering underground music)
- Artist Followers: Fewer followers = bonus points (supports smaller artists)
- Track Popularity: Less mainstream tracks score higher
- Explicit Content: +5 point bonus
- Results Revelation: Final page reveals overall score with commentary and complete track breakdown
- Persistent Storage: All analysis sessions saved with ability to view history
- Docker and Docker Compose
- Spotify account (free or premium)
- Spotify Developer App credentials
-
Clone the repository
git clone https://github.com/larsssmoatsss/spotijudge.git cd spotijudge -
Set up Spotify Developer App
- Go to Spotify Developer Dashboard
- Create a new app
- Add
http://localhost:5000/callbackto Redirect URIs - Note your Client ID and Client Secret
-
Configure environment variables
- Copy
.env.exampleto.env - Fill in your Spotify API credentials:
cp .env.example .env # Edit .env with your actual credentials - Copy
-
Run with Docker
docker-compose up --build
-
Open your browser Navigate to
http://localhost:5000
The application runs in development mode with:
- Hot reload for code changes
- Debug mode enabled
- PostgreSQL with persistent data volumes
- Redis for future session enhancements
The application provides RESTful API endpoints for programmatic access:
GET /api/sessions/{session_id}- Get detailed session dataGET /api/users/{user_id}/sessions- Get all sessions for a user
{
"id": 1,
"session_uuid": "550e8400-e29b-41d4-a716-446655440000",
"final_score": 87.5,
"total_tracks": 20,
"scored_tracks": 18,
"unscored_tracks": 2,
"created_at": "2025-09-22T17:10:08.000Z",
"completed_at": "2025-09-22T17:15:30.000Z"
}- users: Spotify user profiles and metadata
- analysis_sessions: Individual analysis runs with scores and statistics
- artists: Cached artist data with genres, popularity, and follower counts
- tracks: Track information linked to artists
- track_analyses: Individual track scores for each session
- Data persistence: All user sessions and scores saved permanently
- Artist caching: Reduces Spotify API calls by storing artist metadata
- Session tracking: Users can review their analysis history
- Referential integrity: Proper foreign key relationships and cascading deletes
The "cool score" algorithm evaluates tracks on multiple criteria:
70+ "cool" genres including:
- Metal variants: deathcore, black metal, doom metal, mathcore
- Electronic: IDM, breakcore, dark ambient, industrial
- Hip-hop: experimental hip hop, underground rap, horrorcore
- Rock/Punk: post-hardcore, shoegaze, noise rock, math rock
- Jazz/Soul: jazz fusion, alternative R&B
- And many more underground/experimental genres
- Genre Bonus: 50 points for tracks in "cool" genres
- Artist Popularity: 2-18 points (inverse scale - less popular = more points)
- Follower Count: 6-16 points (supports smaller artists)
- Track Popularity: 1-11 points (underground tracks favored)
- Explicit Content: 5 point bonus
- Maximum Score: 100 points per track
- web: Flask application with SQLAlchemy ORM
- db: PostgreSQL 15 with custom initialization
- redis: Redis for session storage and caching (optional)
- Volume mounting: Live code reloading during development
- Health checks: Automatic service dependency management
- Environment isolation: Consistent development environments
- Database persistence: Data survives container restarts
Render provides free hosting for both the web application and PostgreSQL database.
-
Push your code to GitHub (if not already done)
git push origin master
-
Create a Render Account
- Sign up at render.com
- Connect your GitHub account
-
Set Up Spotify Developer App for Production
- Go to Spotify Developer Dashboard
- Select your app or create a new one
- Add your Render URL to Redirect URIs:
https://your-app-name.onrender.com/callback - Note your Client ID and Client Secret
-
Deploy Using Render Blueprint
- In Render Dashboard, click "New" → "Blueprint"
- Connect your GitHub repository
- Render will automatically detect
render.yamland set up:- PostgreSQL database
- Web service with Python runtime
-
Configure Environment Variables After deployment is created, add these environment variables in the Render dashboard:
SPOTIFY_CLIENT_ID: Your Spotify Client IDSPOTIFY_CLIENT_SECRET: Your Spotify Client SecretSPOTIFY_REDIRECT_URI:https://your-app-name.onrender.com/callbackPYTHON_VERSION:3.11.0(important for compatibility)- (DATABASE_URL and SECRET_KEY are auto-configured by Render)
-
Wait for Build & Deploy
- Initial build takes 2-3 minutes
- Your app will be live at
https://your-app-name.onrender.com
If you prefer manual setup:
-
Create PostgreSQL Database
- In Render: New → PostgreSQL
- Name:
spotijudge-db - Free tier is sufficient
- Save the connection details
-
Create Web Service
- In Render: New → Web Service
- Connect your GitHub repository
- Configure:
- Name:
spotijudge - Runtime: Python 3
- Build Command:
pip install -r requirements.txt - Start Command:
gunicorn app:app
- Name:
-
Set Environment Variables (same as above)
The application is designed for easy deployment to cloud platforms:
- Railway: Automatic Docker deployment with PostgreSQL addon
- Heroku: Container deployment with Heroku Postgres
- DigitalOcean App Platform: Docker-based deployment
- AWS ECS/Fargate: Container orchestration at scale
All configuration via environment variables for 12-factor app compliance.
spotijudge/
│
├── app.py # Main Flask application
├── models.py # SQLAlchemy database models
├── requirements.txt # Python dependencies
├── Dockerfile # Container build instructions
├── docker-compose.yml # Multi-service orchestration
├── .env.example # Environment variable template
│
├── database/
│ └── init.sql # PostgreSQL initialization
│
├── static/
│ ├── styles.css # Complete UI styling
│ ├── script.js # Frontend interactivity
│ └── images/ # Screenshots and assets
│
└── templates/
├── landing.html # Landing page
├── index.html # Review interface
└── results.html # Results page
- Complete Spotify OAuth 2.0 flow with secure token exchange
- Proper scope handling for user data access
- Environment-based credential management
- PostgreSQL with advanced features (arrays, UUIDs, triggers)
- Efficient artist metadata caching to reduce API calls
- Proper indexing for query performance
- Data integrity with foreign key constraints
- Multi-stage Docker builds for optimized images
- Docker Compose orchestration with health checks
- Development and production configurations
- Persistent data volumes
- RESTful endpoints following standard conventions
- JSON responses with proper HTTP status codes
- Structured error handling and validation
This is a personal learning project showcasing full-stack development skills. The codebase demonstrates:
- Backend Development: Flask, SQLAlchemy, PostgreSQL
- Frontend Development: Responsive design, interactive UI
- DevOps: Docker containerization, environment management
- API Development: RESTful design, OAuth integration
- Database Design: Relational modeling, performance optimization
This project is open source and available under the MIT License.
Built by Lars Moats | Demonstrating production-ready full-stack development with modern DevOps practices
Connect with me on LinkedIn


