A full-stack music player web application built with React.js frontend and Node.js/Express backend, featuring user authentication and music streaming capabilities.
-
User Authentication System
- User registration (SignUp)
- User login (SignIn)
- Password validation and user verification
- Secure user session management
-
Music Player Interface
- Clean and intuitive user interface
- Responsive design for all devices
- Modern React-based frontend
- Interactive music player controls
-
Backend API
- RESTful API endpoints
- MongoDB database integration
- User data management
- CORS enabled for cross-origin requests
- React.js - UI framework
- Vite - Build tool and development server
- CSS3 - Styling and responsive design
- JavaScript (ES6+) - Core functionality
- Node.js - Runtime environment
- Express.js - Web framework
- MongoDB - Database
- Mongoose - MongoDB object modeling
- Body-parser - Request parsing middleware
- CORS - Cross-origin resource sharing
dtunes/
βββ backend/
β βββ db.js # Database connection and models
β βββ server.js # Express server and API routes
β βββ package.json # Backend dependencies
βββ frontend/
β βββ public/
β β βββ index.html # HTML template
β βββ src/
β β βββ components/
β β β βββ App.jsx # Main application component
β β β βββ Home.jsx # Home page component
β β β βββ SignIn.jsx # Login component
β β β βββ SignUp.jsx # Registration component
β β β βββ Footer.jsx # Footer component
β β βββ assets/ # Static assets (images, icons)
β β βββ index.css # Global styles
β β βββ main.jsx # React entry point
β β βββ package.json # Frontend dependencies
βββ README.md # This file
- Node.js (v14 or higher)
- npm or yarn
- MongoDB Atlas account or local MongoDB installation
- Clone the repository:
git clone https://github.com/yourusername/dtunes.git
cd dtunes/backend
- Install backend dependencies:
npm install express mongoose body-parser cors
- Set up MongoDB:
- Create a MongoDB Atlas cluster or use local MongoDB
- Update the connection string in
db.js
:
mongoose.connect('your-mongodb-connection-string')
- Start the backend server:
node server.js
The server will run on http://localhost:3000
- Navigate to frontend directory:
cd ../frontend
- Install frontend dependencies:
npm install
- Start the development server:
npm run dev
The frontend will run on http://localhost:5173
(Vite default)
Register a new user
{
"username": "string (3-30 characters)",
"password": "string (minimum 6 characters)"
}
Response:
{
"msg": "User created successfully!!!",
"name": "username"
}
Authenticate existing user
{
"username": "string",
"password": "string"
}
Response:
{
"msg": "signed in sucessfully!!!",
"name": "username"
}
{
username: {
type: String,
required: true,
minlength: 3,
maxlength: 30
},
password: {
type: String,
required: true,
minlength: 6
}
}
- Registration: New users can create an account using the SignUp component
- Login: Existing users can log in using the SignIn component
- Home Page: After authentication, users can access the main music player interface
- Music Player: Browse and play music tracks (implementation depends on additional features)
- Password Hashing: Currently, passwords are stored in plain text. For production, implement password hashing using bcrypt:
const bcrypt = require('bcrypt');
const hashedPassword = await bcrypt.hash(password, 10);
- JWT Tokens: Consider implementing JWT tokens for secure session management
- Environment Variables: Store sensitive data like MongoDB connection strings in environment variables
- Input Validation: Add comprehensive input validation and sanitization
-
Security Improvements
- Password hashing with bcrypt
- JWT token authentication
- Input validation and sanitization
- Rate limiting for API endpoints
-
Music Features
- Music file upload and storage
- Playlist creation and management
- Search functionality
- Music streaming capabilities
- Favorite songs feature
-
UI/UX Improvements
- Loading states and error handling
- Dark/light theme toggle
- Mobile-responsive design
- Audio visualizations
- Progress bars and time display
-
Additional Features
- User profiles and avatars
- Social features (sharing, following)
- Music recommendations
- Offline playback support
- Admin panel for content management
MongoDB Connection Error:
- Verify your MongoDB connection string
- Ensure your IP is whitelisted in MongoDB Atlas
- Check if MongoDB service is running (for local installations)
CORS Errors:
- Ensure CORS middleware is properly configured
- Check if frontend and backend URLs match
Port Conflicts:
- Backend runs on port 3000, frontend on 5173
- Change ports if conflicts occur
npm start # Start the server
node server.js # Direct server start
npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build
- Fork the project
- Create your feature branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Built with β€οΈ for music lovers everywhere! πΆ
Start your musical journey with DTunes today!