A modern music streaming application built with Flutter (client) and FastAPI (server). This app allows users to discover, play, and manage their favorite music with a beautiful, responsive interface.
- Frontend: Flutter (Dart) - Cross-platform mobile and web application
- Backend: FastAPI (Python) - RESTful API with PostgreSQL database
- State Management: Riverpod for Flutter
- Database: PostgreSQL with SQLAlchemy ORM
- Authentication: JWT-based authentication
- File Storage: Cloudinary for media storage
- User authentication (login, signup, password reset)
- Music discovery and browsing
- Audio playback with background support
- Favorites management
- Responsive design for mobile and web
- Dark theme support
- Offline music storage with Hive
Before you begin, ensure you have the following installed:
- Flutter SDK (3.5.4 or higher)
- Dart SDK (included with Flutter)
- Android Studio or VS Code with Flutter extensions
- Xcode (for iOS development on macOS)
- Android SDK (for Android development)
- Python (3.8 or higher)
- PostgreSQL (12 or higher)
- pip (Python package manager)
git clone <repository-url>
cd MusicAppNavigate to the server directory and set up the backend:
cd server
# Create a virtual environment
python -m venv .venv
# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Set up environment variables
cp .env.example .env
# Edit .env with your database credentials and other settingsMake sure PostgreSQL is running and create a database:
CREATE DATABASE musicapp;Update your .env file with database credentials:
DATABASE_URL=postgresql://username:password@localhost:5432/musicapp
JWT_SECRET_KEY=your-secret-key-here
CLOUDINARY_CLOUD_NAME=your-cloudinary-name
CLOUDINARY_API_KEY=your-cloudinary-key
CLOUDINARY_API_SECRET=your-cloudinary-secretRun database migrations:
# Generate migration (if needed)
alembic revision --autogenerate -m "Initial migration"
# Apply migrations
alembic upgrade headNavigate to the client directory and set up the Flutter app:
cd ../client
# Install Flutter dependencies
flutter pub get
# Generate code (for Riverpod)
flutter packages pub run build_runner buildcd server
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000The API will be available at http://localhost:8000
API documentation: http://localhost:8000/docs
cd client
# For development
flutter run
# For web
flutter run -d chrome
# For specific platform
flutter run -d android
flutter run -d iosMusicApp/
βββ client/ # Flutter frontend
β βββ lib/
β β βββ core/ # Core utilities, themes, providers
β β βββ features/ # Feature modules (auth, home)
β βββ assets/ # Images and other assets
β βββ pubspec.yaml # Flutter dependencies
βββ server/ # FastAPI backend
β βββ app/
β β βββ api/ # API routes and endpoints
β β βββ models/ # Database models
β β βββ schemas/ # Pydantic schemas
β β βββ utils/ # Utility functions
β βββ migrations/ # Database migrations
β βββ requirements.txt # Python dependencies
βββ README.md
The backend uses FastAPI with the following key components:
- Models: SQLAlchemy models for database entities
- Schemas: Pydantic models for request/response validation
- API Routes: RESTful endpoints for authentication and music management
- Database: PostgreSQL with Alembic for migrations
The Flutter app uses:
- Riverpod: State management and dependency injection
- Hive: Local database for offline storage
- Just Audio: Audio playback functionality
- HTTP: API communication
For Riverpod providers, run:
cd client
flutter packages pub run build_runner build --delete-conflicting-outputscd server
source .venv/bin/activate
pytestcd client
flutter testcd client
flutter build apk --releasecd client
flutter build ios --releasecd client
flutter build web --releaseCreate a .env file in the server directory with the following variables:
DATABASE_URL=postgresql://username:password@localhost:5432/musicapp
JWT_SECRET_KEY=your-jwt-secret-key
JWT_ALGORITHM=HS256
ACCESS_TOKEN_EXPIRE_MINUTES=30
CLOUDINARY_CLOUD_NAME=your-cloudinary-name
CLOUDINARY_API_KEY=your-cloudinary-key
CLOUDINARY_API_SECRET=your-cloudinary-secret- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- Flutter dependencies issues: Run
flutter clean && flutter pub get - Database connection issues: Check PostgreSQL is running and credentials are correct
- Build issues: Ensure all prerequisites are installed and up to date
- Check the Flutter documentation
- Check the FastAPI documentation
- Open an issue in this repository
For support, email support@musicapp.com or join our Discord community.
Made with β€οΈ by the MusicApp team