An advanced music player application with dynamic audio visualization, cloud storage integration, and a responsive design for an engaging user experience.
Link to project: https://wpfs.netlify.app/
Tech used:
- Frontend: HTML, CSS, JavaScript
- Backend: Node.js, Express
- Database: MongoDB
- Cloud Storage: AWS S3
- Development: Nodemon
WIPlayer has evolved from a simple frontend concept into a full-stack application. The player features real-time audio visualization that responds to the music's frequency data, creating an immersive experience. The application now includes:
- Cloud-exclusive audio storage using AWS S3 with pre-signed URLs for secure access
- Database integration with MongoDB to store song metadata and user preferences
- Dynamic color schemes that adapt based on the artist/song
- Responsive design that works across different devices
- Audio Visualization: Real-time frequency analysis with customizable visual effects
- Cloud Integration: Secure audio streaming from AWS S3
- Seek Bar: Interactive timeline with visual progress indication
- Volume Control: Intuitive volume adjustment with visual feedback
- Artist-based Theming: Dynamic color schemes based on the current artist
- Responsive Design: Adapts to different screen sizes for optimal viewing
The application continues to evolve with planned enhancements:
- User Authentication: Secure login and personalized experiences
- Playlist Management: Create, edit, and share playlists
- Enhanced UI/UX: More intuitive controls and visual feedback
- Media Management: Upload and organize your music library
- Search Functionality: Find songs quickly with powerful search
- Real-time Features: Collaborative listening sessions and social features
The WIPlayer application follows a modular architecture designed for maintainability and scalability:
/config
- Centralized configuration modulesindex.js
- Main configuration exportsaws-config.js
- AWS S3 configurationmongodb-config.js
- MongoDB connection settings
/models
- MongoDB schema definitions/netlify/functions
- Serverless functions for production deploymentsongs.js
- Fetch song metadata from MongoDBstream.js
- Generate pre-signed URLs for S3 audio streamingrefresh-url.js
- Refresh expired S3 pre-signed URLs/models
- MongoDB schemas for Netlify functions/utils
- Utility functions for Netlify functions
/scripts
- Utility scripts for testing and deploymenttest-netlify-functions.js
- Test script for Netlify functionsverify-credentials.js
- Verify AWS credentials and S3 access
/utils
- Shared utility functionss3.js
- AWS S3 utility functionsresponse-helpers.js
- Standardized HTTP response helpers
/public
- Frontend assets and client-side codeapp.js
- Core application logicdata.js
- Data managementmain.js
- UI initialization and event handlingparticlesystem.js
- Visualization effectsstyle.css
- Application styling
The application is deployed on Netlify using serverless functions:
- Install dependencies:
npm install
- Set up environment variables in a
.env
file (see Environment Variables section) - Run the Express server:
npm run dev
- For Netlify Functions development:
npm run netlify-dev
- Test Netlify functions:
npm run test-functions
- Verify AWS credentials:
node scripts/verify-credentials.js
- Configure environment variables in the Netlify dashboard:
MONGODB_URI
- MongoDB connection stringS3_BUCKET_NAME
- "wiplayer"WIPLAYER_AWS_KEY_ID
- AWS access key with S3 permissionsWIPLAYER_AWS_SECRET
- AWS secret keyWIPLAYER_AWS_REGION
- "us-west-2"
- Run pre-deployment checks:
npm run predeploy
- Deploy to Netlify:
npm run deploy
The application requires the following environment variables:
PORT=3000
MONGODB_URI=your_mongodb_connection_string
WIPLAYER_AWS_KEY_ID=your_aws_access_key
WIPLAYER_AWS_SECRET=your_aws_secret_key
WIPLAYER_AWS_REGION=us-west-2
S3_BUCKET_NAME=wiplayer
Configure the same variables in the Netlify dashboard under Site Settings > Environment variables.
The application uses the following serverless functions:
songs.js
- Fetches song data from MongoDBstream.js
- Handles streaming audio files from AWS S3refresh-url.js
- Refreshes S3 pre-signed URLs
- Clone the repository
- Install dependencies:
npm install
- Configure environment variables:
- Create a
.env
file with the following:PORT=3000 MONGODB_URI=your_mongodb_connection_string AWS_ACCESS_KEY_ID=your_aws_access_key AWS_SECRET_ACCESS_KEY=your_aws_secret_key AWS_REGION=us-west-2 S3_BUCKET_NAME=wiplayer
- Create a
- Upload your audio files to the AWS S3 bucket
- Start the development server:
npm run dev
- Access the application at
http://localhost:3000
The application requires proper AWS S3 setup:
- Create an S3 bucket named "wiplayer" in the us-west-2 region
- Create a dedicated IAM user with the following permissions:
- s3:GetObject
- s3:ListBucket
- s3:HeadBucket
- s3:HeadObject
- Ensure these permissions are scoped to the "wiplayer" bucket
- Configure CORS settings on your S3 bucket using the provided
s3-cors-config.json
file:aws s3api put-bucket-cors --bucket wiplayer --cors-configuration file://s3-cors-config.json
- The CORS configuration should allow origins including localhost:8888 and wpfs.netlify.app
The application includes test scripts to verify functionality:
-
Test Netlify functions:
npm run test-functions
- This tests the songs, stream, and refresh-url functions
- Verifies MongoDB connection and AWS S3 access
- Confirms that pre-signed URLs are generated correctly
-
Verify AWS credentials:
node scripts/verify-credentials.js
- Checks AWS credentials validity
- Verifies S3 bucket access
- Lists objects in the S3 bucket
This project has evolved from a simple frontend experiment to a comprehensive full-stack application. Key learnings include:
- Implementing cloud-exclusive media streaming with AWS S3
- Building responsive audio visualization with the Web Audio API
- Implementing secure access patterns for cloud resources
- Creating a seamless user experience with proper error handling
- Designing a modular architecture that allows for future expansion