Your one-stop solution for amazing music experiences.
Swar is a music streaming platform that provides users with a wide range of music from different genres. Users can create playlists, like songs, and view their play history. The platform is designed to provide a seamless music experience to users.
| Feature | Summary | |
|---|---|---|
| 🔑 | User Authentication |
|
| 🎶 | Playlist Management |
|
| ❤️ | Song Management |
|
| 🕒 | Play History |
|
| 🔍 | Search |
|
| 📱 | Responsive UI |
|
| 🐳 | Docker Support |
|
└── Swar/
├── .github
│ └── workflows
│ ├── SongServiceAPI.yml
│ └── SwarAPI.yml
├── LICENSE
├── README.md
├── SongService.API
│ ├── Controllers
│ │ └── SongsDataController.cs
│ ├── Dockerfile
│ ├── Exceptions
│ │ ├── EntityNotFoundException.cs
│ │ ├── InvalidQueryException.cs
│ │ └── InvalidSongIdException.cs
│ ├── Interfaces
│ │ ├── ISongDataService.cs
│ │ └── ISongProcessingService.cs
│ ├── Models
│ │ └── ErrorModel.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Services
│ │ ├── SongDataService.cs
│ │ └── SongProcessingService.cs
│ ├── SongService.API.csproj
│ ├── SongService.API.xml
│ ├── appsettings.Development.json
│ └── appsettings.json
├── Swar.API
│ ├── Contexts
│ │ └── SwarContext.cs
│ ├── Controllers
│ │ ├── LikedSongsController.cs
│ │ ├── PlayHistoryController.cs
│ │ ├── PlaylistController.cs
│ │ ├── PlaylistSongsController.cs
│ │ └── UserController.cs
│ ├── Dockerfile
│ ├── Exceptions
│ │ ├── EntityAlreadyExistsException.cs
│ │ ├── EntityNotFoundException.cs
│ │ ├── ExternalServiceLoginException.cs
│ │ ├── InactiveAccountException.cs
│ │ ├── InvalidCredentialsException.cs
│ │ ├── InvalidRefreshTokenException.cs
│ │ ├── UnableToAddException.cs
│ │ └── WeakPasswordException.cs
│ ├── Interfaces
│ │ ├── Repositories
│ │ │ ├── IPlaylistRepository.cs
│ │ │ ├── IPlaylistSongsRepository.cs
│ │ │ ├── IRepository.cs
│ │ │ └── IUserRepository.cs
│ │ └── Services
│ │ ├── ILikedSongsService.cs
│ │ ├── IPlayHistoryService.cs
│ │ ├── IPlaylistService.cs
│ │ ├── IPlaylistSongsService.cs
│ │ ├── ITokenService.cs
│ │ └── IUserService.cs
│ ├── Migrations
│ │ ├── 20240823131712_initial.Designer.cs
│ │ ├── 20240823131712_initial.cs
│ │ └── SwarContextModelSnapshot.cs
│ ├── Models
│ │ ├── DBModels
│ │ │ ├── LikedSong.cs
│ │ │ ├── PlayHistory.cs
│ │ │ ├── Playlist.cs
│ │ │ ├── PlaylistSong.cs
│ │ │ └── User.cs
│ │ ├── DTOs
│ │ │ ├── AccessTokenDTO.cs
│ │ │ ├── AddPlaylistDTO.cs
│ │ │ ├── AddSongToPlaylistDTO.cs
│ │ │ ├── LikedSongsReturnDTO.cs
│ │ │ ├── LoginResultDTO.cs
│ │ │ ├── PlaylistInfoDTO.cs
│ │ │ ├── PlaylistSongsDTO.cs
│ │ │ ├── PlaylistSongsReturnDTO.cs
│ │ │ ├── RegisteredUserDTO.cs
│ │ │ ├── ReturnPlaylistDTO.cs
│ │ │ ├── SongsListDTO.cs
│ │ │ ├── UpdatePlaylistDTO.cs
│ │ │ ├── UpdatePlaylistPrivacyDTO.cs
│ │ │ ├── UserLoginDTO.cs
│ │ │ ├── UserPasswordUpdateDTO.cs
│ │ │ ├── UserRegisterDTO.cs
│ │ │ └── UserUpdateDTO.cs
│ │ ├── ENUMs
│ │ │ ├── UserRoleEnum.cs
│ │ │ └── UserStatusEnum.cs
│ │ └── ErrorModel.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Repositories
│ │ ├── AbstractRepository.cs
│ │ ├── LikedSongsRepository.cs
│ │ ├── PlayHistoryRepository.cs
│ │ ├── PlaylistRepository.cs
│ │ ├── PlaylistSongsRepository.cs
│ │ └── UserRepository.cs
│ ├── Services
│ │ ├── LikedSongsService.cs
│ │ ├── PlayHistoryService.cs
│ │ ├── PlaylistService.cs
│ │ ├── PlaylistSongsService.cs
│ │ ├── TokenService.cs
│ │ └── UserService.cs
│ ├── Swar.API.csproj
│ ├── Swar.API.xml
│ ├── appsettings.Development.json
│ ├── appsettings.json
│ └── log4net.config
├── Swar.API.sln
├── Swar.UI
│ ├── assets
│ │ └── img
│ │ ├── female_avatar.svg
│ │ ├── lib-btn.svg
│ │ ├── likedSong.png
│ │ ├── logo.png
│ │ ├── male_avatar.svg
│ │ ├── neutral_avatar.png
│ │ ├── playlist.png
│ │ ├── profile.svg
│ │ └── songLogo.avif
│ ├── index.html
│ ├── library.html
│ ├── login.html
│ ├── playlist.html
│ ├── profile.html
│ ├── public
│ │ ├── Screenshot1.png
│ │ ├── Screenshot2.png
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon-180x180.png
│ │ ├── apple-touch-icon.png
│ │ ├── browserconfig.xml
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon.ico
│ │ ├── icons-vector.svg
│ │ ├── manifest.json
│ │ ├── mstile-150x150.png
│ │ └── robots.txt
│ ├── register.html
│ ├── search.html
│ ├── songPlayer.html
│ └── static
│ ├── css
│ │ ├── SongPlayer.css
│ │ ├── alert.css
│ │ ├── home.css
│ │ ├── library.css
│ │ ├── login.css
│ │ ├── navbar.css
│ │ └── validation.css
│ └── js
│ ├── SongPlayer.js
│ ├── auth.js
│ ├── common.js
│ ├── crudService.js
│ ├── home.js
│ ├── installer.js
│ ├── library.js
│ ├── login.js
│ ├── messages.js
│ ├── navabar.js
│ ├── playlist.js
│ ├── profile.js
│ ├── register.js
│ ├── search.js
│ ├── searchBox.js
│ └── validation.js
├── Swar.UI.React
│ ├── .gitignore
│ ├── eslint.config.js
│ ├── index.html
│ ├── package-lock.json
│ ├── package.json
│ ├── postcss.config.cjs
│ ├── public
│ │ ├── android-chrome-192x192.png
│ │ ├── android-chrome-512x512.png
│ │ ├── apple-touch-icon-180x180.png
│ │ ├── apple-touch-icon.png
│ │ ├── bg.png
│ │ ├── browserconfig.xml
│ │ ├── favicon-16x16.png
│ │ ├── favicon-32x32.png
│ │ ├── favicon.ico
│ │ ├── icons-vector.svg
│ │ ├── mockup-dark.png
│ │ ├── mockup-light.png
│ │ ├── mstile-150x150.png
│ │ └── robots.txt
│ ├── src
│ │ ├── App.jsx
│ │ ├── api
│ │ │ └── axios.js
│ │ ├── assets
│ │ │ └── img
│ │ │ ├── error-bad-request.svg
│ │ │ ├── female-avatar.svg
│ │ │ ├── heart.svg
│ │ │ ├── lib-btn.svg
│ │ │ ├── likedSong.png
│ │ │ ├── logo.png
│ │ │ ├── male-avatar.svg
│ │ │ ├── neutral-avatar.svg
│ │ │ ├── no-results.svg
│ │ │ ├── playlist.svg
│ │ │ ├── profile.svg
│ │ │ └── songLogo.avif
│ │ ├── components
│ │ │ ├── ArtistButton.jsx
│ │ │ ├── ArtistSkeleton.jsx
│ │ │ ├── Error
│ │ │ │ ├── BadRequestError.jsx
│ │ │ │ ├── ErrorMessage.jsx
│ │ │ │ └── NotResultError.jsx
│ │ │ ├── Footer.jsx
│ │ │ ├── Icons.jsx
│ │ │ ├── InstallPWA.jsx
│ │ │ ├── Layout.jsx
│ │ │ ├── LikeButton
│ │ │ │ ├── LikeButton.jsx
│ │ │ │ └── likebutton.css
│ │ │ ├── MiniPlayer.jsx
│ │ │ ├── MobileNav.jsx
│ │ │ ├── Navbar.jsx
│ │ │ ├── PlayerSkeleton.jsx
│ │ │ ├── PlaylistCard.jsx
│ │ │ ├── PlaylistsSkeleton.jsx
│ │ │ ├── ProfileSkeleton.jsx
│ │ │ ├── SearchBar.jsx
│ │ │ ├── SongCard.jsx
│ │ │ ├── SongSkeleton.jsx
│ │ │ └── modals
│ │ │ ├── PlaylistInfoModal.jsx
│ │ │ └── PlaylistModal.jsx
│ │ ├── contexts
│ │ │ └── PlayerContext.jsx
│ │ ├── hooks
│ │ │ ├── useApiClient.js
│ │ │ ├── usePlayer.js
│ │ │ ├── usePlaylistActions.js
│ │ │ ├── usePlaylistActionsBase.js
│ │ │ ├── usePlaylistInfo.js
│ │ │ ├── usePlaylistSongs.js
│ │ │ ├── useRecentlyPlayedSongs.js
│ │ │ ├── useSearchData.js
│ │ │ └── useUserPlaylistSongs.js
│ │ ├── index.css
│ │ ├── main.jsx
│ │ ├── pages
│ │ │ ├── Home.jsx
│ │ │ ├── Landing.jsx
│ │ │ ├── Library.jsx
│ │ │ ├── Player.jsx
│ │ │ ├── Playlist.jsx
│ │ │ ├── Profile.jsx
│ │ │ └── Search.jsx
│ │ └── routes
│ │ └── ProtectedRoute.jsx
│ ├── tailwind.config.js
│ ├── vercel.json
│ └── vite.config.js
├── Swar.UnitTest
│ ├── RepositoryUnitTest
│ │ ├── LikedSongsRepositoryTests.cs
│ │ ├── PlayHistoryRepositoryTests.cs
│ │ ├── PlaylistRepositoryTests.cs
│ │ ├── PlaylistSongsRepositoryTests.cs
│ │ └── UserRepositoryTests.cs
│ ├── ServiceUnitTest
│ │ ├── LikedSongsServiceTests.cs
│ │ ├── PlayHistoryServiceTests.cs
│ │ ├── PlaylistServiceTests.cs
│ │ ├── PlaylistSongsServiceTests.cs
│ │ ├── TokenServiceTests.cs
│ │ └── UserServiceTests.cs
│ └── Swar.UnitTest.csproj
└── docs
├── ERD.png
└── RequirementsDoc.mdSWAR/
__root__
Swar.API.sln - Serves as the configuration backbone for a multi-project Visual Studio solution, orchestrating the build and deployment settings for the Swar.API, Swar.UnitTest, and SongService.API projects
- It defines the solution's structure and manages the configurations across different environments, ensuring seamless integration and testing capabilities.
.github
workflows
SwarAPI.yml - Automates the continuous integration and deployment of a .NET Core application named SwarAPI to an Azure Web App upon updates to the main branch
- It includes steps for setting up the environment, building, testing, publishing, and deploying the application, ensuring streamlined updates and maintenance of the production environment.SongServiceAPI.yml - Build and deploy .NET Core application workflow automates the continuous integration and deployment of the SongServiceAPI to an Azure Web App
- Triggered by pushes to the main branch, it includes steps for setting up the environment, building, testing, publishing, and deploying the application, ensuring streamlined updates and maintenance of the service.
SongService.API
appsettings.Development.json - Configures development-specific settings for the SongService API, managing logging levels to optimize information visibility and error tracking
- It also secures communication and data access through a specified token key, ensuring that interactions with the API remain authenticated and authorized, thereby maintaining the integrity and security of the service in a development environment.appsettings.json - Configures logging levels and specifies allowed hosts for the SongService.API, ensuring broad accessibility
- It also defines base URLs for various music-related APIs, including search, station creation, song suggestions, song details, album details, playlist information, and lyrics retrieval, centralizing external music data interactions for the application.Program.cs - Program.cs serves as the entry point for the SongService.API, configuring services, middleware, and the application's startup routine
- It sets up JWT authentication, Swagger documentation, CORS policies, and dependency injections for song data and processing services, facilitating secure and efficient API operations.SongService.API.csproj - Defines the configuration for the SongService.API project, specifying it as a web application targeting the .NET 6.0 framework
- It enables nullable reference types and implicit usings for streamlined code
- The project is prepared for Docker deployment on Linux and includes essential packages for JWT authentication, Azure integration, JSON processing, and API documentation with Swagger.Dockerfile - Serves as the Docker configuration for the SongService.API, detailing the environment setup, dependencies management, and build processes for deployment
- It establishes a containerized application environment using .NET, optimizing the service for efficient debugging and deployment within a microservices architecture
- This setup ensures the API's scalability and maintainability across different development stages.Exceptions
InvalidSongIdException.cs - Defines a custom exception, InvalidSongIdException, within the SongService.API's exception handling framework
- It specifically addresses scenarios where an invalid song identifier is used, enhancing error management and debugging capabilities by providing a clear, specific error message for such cases
- This exception aids in maintaining robustness and clarity in the service's operational flow.InvalidQueryException.cs - InvalidQueryException, defined within the SongService.API's Exceptions directory, serves as a custom exception class for handling errors related to invalid queries in the API
- It enhances error management by providing a specific exception type that can be caught and handled distinctly, improving the robustness and clarity of error reporting in the service layer.EntityNotFoundException.cs - EntityNotFoundException within the SongService.API.Exceptions namespace defines a custom exception for handling scenarios where a requested entity is not found in the system
- It enhances error management by providing a clear, specific error message, either default or as specified, facilitating easier debugging and user feedback within the service architecture.Controllers
SongsDataController.cs Serves as the central interface for song-related data operations within the SongService API, handling tasks such as searching for songs, retrieving song suggestions, albums, playlists, and lyrics based on various identifiers and parameters, all while ensuring proper authorization and error handling. Models
ErrorModel.cs - ErrorModel in the SongService.API.Models namespace defines a model for error handling across the API
- It encapsulates error details, specifically the HTTP status code and a message, facilitating standardized error responses throughout the service
- This model ensures that all error communications are clear and consistent to API consumers.Services
SongProcessingService.cs - SongProcessingService in the SongService.API module manages the formatting and processing of song, playlist, and album data
- It adjusts media URLs based on quality, decrypts URLs, and standardizes song information for consistency across the application, enhancing data presentation and accessibility.SongDataService.cs - SongDataService in the SongService.API module interfaces with various music APIs to fetch, process, and return detailed song, album, and playlist data
- It handles tasks such as searching for songs, retrieving song suggestions, and extracting lyrics, ensuring robust error handling and data extraction from external music service responses.Properties
launchSettings.json - Configures the launch settings for the SongService.API, specifying different profiles for project execution, including direct project launch, IIS Express, and Docker containerization
- Each profile sets up the environment, specifies URLs, and determines browser launch behavior, focusing on ease of development and testing with an emphasis on using Swagger UI for API interaction.Interfaces
ISongProcessingService.cs - The ISongProcessingService interface in the SongService.API module defines methods for formatting song, album, and playlist data
- It ensures that these media types are processed into a consistent JSON format, facilitating their integration and manipulation across the broader system architecture, thereby enhancing data uniformity and accessibility.ISongDataService.cs - Defines an interface for interacting with song-related data within the SongService.API
- It specifies methods for searching songs, retrieving song suggestions, fetching detailed song, album, and playlist information, obtaining unique identifiers from URLs, and accessing lyrics, enhancing the service's ability to provide comprehensive music data management.
Swar.API
Swar.API.csproj - Swar.API.csproj configures the foundational settings for a .NET 6.0 web application, enabling nullable reference types and implicit usings for streamlined coding
- It integrates essential packages for logging, authentication, database management, and API documentation, while also setting up a Docker environment for Linux deployment and organizing log storage.log4net.config - Configures logging for the Swar.API, utilizing log4net to manage output to both a debug environment and a rolling file system
- It specifies formats for log messages and controls file size and backup behavior, ensuring comprehensive logging across different levels for effective debugging and monitoring of the application's operations.appsettings.Development.json - Configures development-specific settings for the Swar.API, managing logging levels, database connections, and security tokens
- It sets informational logging as default, restricts Microsoft.AspNetCore logs to warnings, and defines SQL server connection parameters
- Additionally, it secures API access with unique keys for authentication and allows requests from all hosts.appsettings.json - Configures logging levels within the Swar.API application, setting a general information threshold for default logs and a higher warning level for Microsoft.AspNetCore specific logs
- This setup aids in filtering log output, enhancing the clarity and manageability of diagnostic data across the application's operational environment.Program.cs - Swar.API/Program.cs serves as the entry point for the Swar API, configuring services, middleware, and the application's startup routine
- It sets up JWT authentication, Swagger documentation, database contexts, and dependency injections for repositories and services, ensuring secure and efficient API operations.Dockerfile - Swar.API/Dockerfile establishes the environment for building and deploying the Swar.API application
- It sets up a multi-stage Docker build process, leveraging Microsoft's .NET images to compile and publish the application, which is then prepared to run within a Docker container, exposing it on port 80.Exceptions
WeakPasswordException.cs - Defines a custom exception, WeakPasswordException, within the Swar.API.Exceptions namespace to enforce strong password policies
- When triggered, it communicates that the provided password does not meet the required security standards, prompting users to choose a stronger password, thereby enhancing the application's security posture.UnableToAddException.cs - Defines a custom exception, UnableToAddException, within the Swar.API.Exceptions namespace to handle errors specifically related to addition operations that fail
- It enhances error reporting by providing a default error message and supports customization through message parameterization, improving the robustness of error handling in the application.InvalidCredentialsException.cs - InvalidCredentialsException.cs defines a custom exception within the Swar.API.Exceptions namespace, specifically for handling authentication errors when user credentials are incorrect
- It enhances error management by providing a clear, specific error message, thereby improving the debugging and user authentication processes within the application's architecture.ExternalServiceLoginException.cs - Swar.API/Exceptions/ExternalServiceLoginException.cs defines a custom exception to handle scenarios where a user attempts to log in without using the external authentication service initially used to create their account
- It ensures users are informed about the correct authentication method required, enhancing security and user experience within the application.InvalidRefreshTokenException.cs - InvalidRefreshTokenException.cs defines a custom exception within the Swar.API.Exceptions namespace, specifically for handling scenarios where an invalid refresh token is detected
- It extends the base Exception class, providing a predefined error message to improve error handling and debugging processes across the API.EntityAlreadyExistsException.cs - Defines a custom exception, `EntityAlreadyExistsException`, used throughout the Swar.API to handle scenarios where an attempt is made to add a duplicate entity to the database
- It enhances error handling by providing tailored messages and, in specific cases, associating the error with a user ID for better traceability.EntityNotFoundException.cs - Defines a custom exception, `EntityNotFoundException`, used throughout the Swar.API to handle scenarios where a requested entity does not exist in the system
- This exception enriches error handling by providing a clear and specific error message, improving the robustness and maintainability of the application's error management architecture.InactiveAccountException.cs - Defines a custom exception, InactiveAccountException, within the Swar.API.Exceptions namespace to handle scenarios where operations involve inactive user accounts
- It enhances error handling by providing a specific exception for inactive accounts, allowing for clearer debugging and user feedback mechanisms in the application's error management system.Controllers
LikedSongsController.cs - Manages user interactions with their liked songs through a RESTful API, enabling operations such as adding, removing, retrieving, and checking liked songs
- It handles various exceptions to ensure robust error management and secure access, requiring user authentication for all operations.PlaylistSongsController.cs - Manages interactions with playlist songs, including adding and removing songs from playlists, and retrieving all songs within a specific or all playlists
- It handles various exceptions and authorizes access based on user roles, ensuring secure and efficient management of playlist content.PlayHistoryController.cs - PlayHistoryController manages song playback history within the Swar.API, facilitating the logging and retrieval of song play data for users
- It supports operations to log individual song plays, fetch play history for a specific user, and retrieve play histories across all users, ensuring role-based access control.UserController.cs - Manages user interactions within the application, handling tasks such as user registration, login, token refresh, and user profile management
- It provides endpoints for user authentication, account updates, and administrative actions like user activation and deactivation, ensuring secure and efficient user management.PlaylistController.cs - Manages playlist operations within the application, enabling users and admins to create, delete, update, and retrieve playlists
- It handles user authentication and authorization, ensuring secure access to playlist functionalities based on user roles, and provides robust error handling for various exceptions.Models
ErrorModel.cs - ErrorModel, located within the Swar.API/Models directory, serves as a standardized response structure for error handling across the API
- It encapsulates error details, specifically the HTTP status code and a descriptive message, facilitating consistent error reporting and client-side error handling throughout the application's architecture.DTOs
UserPasswordUpdateDTO.cs - UserPasswordUpdateDTO serves as a data transfer object within the Swar.API's model layer, specifically facilitating the update of user passwords
- It ensures that both old and new passwords are provided by enforcing validation rules, thereby supporting secure and effective user authentication processes across the application.PlaylistSongsReturnDTO.cs - PlaylistSongsReturnDTO serves as a data transfer object in the Swar.API project, facilitating the encapsulation and transfer of essential data between layers
- It specifically manages the relationship between playlists and songs by holding identifiers for both, thus supporting operations related to querying or manipulating user playlists and their associated songs.UserUpdateDTO.cs - UserUpdateDTO serves as a data transfer object in the Swar.API project, facilitating the safe and validated updating of user profiles
- It ensures that updates to user names, emails, and genders adhere to specific format and length constraints, enhancing data integrity and user experience across the system.ReturnPlaylistDTO.cs - ReturnPlaylistDTO serves as a data transfer object in the Swar.API project, encapsulating playlist information for communication between the server and clients
- It includes details such as user and playlist identifiers, ownership, privacy settings, and metadata, facilitating efficient data handling and response structuring within the application's service layer.RegisteredUserDTO.cs - RegisteredUserDTO serves as a data transfer object within the Swar.API project, encapsulating user registration details such as user ID, external ID, name, email, role, status, and registration date
- It facilitates the efficient transfer of user data between processes and layers in the application, ensuring data integrity and simplifying interactions with user information.PlaylistInfoDTO.cs - PlaylistInfoDTO, extending ReturnPlaylistDTO within the Swar.API's Models.DTOs namespace, enriches playlist data by including a count of songs
- It serves as a data transfer object that facilitates the delivery of playlist information, including song totals, to client applications, enhancing data interaction and user interface capabilities in the broader system architecture.UserRegisterDTO.cs - UserRegisterDTO serves as a data transfer object in the Swar.API project, facilitating the registration process by encapsulating user details
- It ensures that essential fields such as name and email are not only present but also adhere to specified validation rules, enhancing data integrity and user management within the system.LoginResultDTO.cs - LoginResultDTO serves as a data transfer object within the Swar.API project, encapsulating authentication details such as access and refresh tokens, user role, and token type
- It facilitates secure data exchange between the client and server during authentication processes, ensuring that user credentials are handled efficiently and securely across the system.SongsListDTO.cs - Swar.API/Models/DTOs/SongsListDTO.cs defines a data transfer object that encapsulates a user's song list, including the user's ID, the total count of songs, and a list of song titles
- This DTO supports operations related to retrieving and displaying song collections in the system, facilitating data handling and transmission between processes.UserLoginDTO.cs - UserLoginDTO serves as a data transfer object in the Swar.API project, specifically designed to handle user authentication processes
- It enforces validation rules for user credentials, ensuring that both email and password inputs meet specific security and format standards essential for maintaining system integrity and user data safety.AddPlaylistDTO.cs - AddPlaylistDTO serves as a data transfer object in the Swar.API project, facilitating the creation of new playlists
- It ensures that essential playlist details such as name and privacy settings are correctly provided and validated, enhancing data integrity and user experience across the application's playlist management features.UpdatePlaylistPrivacyDTO.cs - UpdatePlaylistPrivacyDTO serves as a data transfer object within the Swar.API's Models layer, specifically designed to manage the privacy settings of playlists
- It encapsulates a single property, IsPrivate, which indicates whether a playlist should be private or public, facilitating the modification of playlist visibility across the application's services.UpdatePlaylistDTO.cs - UpdatePlaylistDTO serves as a data transfer object in the Swar.API project, specifically designed for updating playlist information
- It enforces validation rules ensuring that the playlist name is mandatory and restricts its length to between 1 and 100 characters, while also allowing an optional description field.AddSongToPlaylistDTO.cs - AddSongToPlaylistDTO serves as a data transfer object in the Swar.API project, facilitating the addition of songs to playlists
- It ensures that both PlaylistId and SongId are provided and validates the length of SongId, enhancing data integrity and interaction between the user interface and server.AccessTokenDTO.cs - AccessTokenDTO.cs defines a data transfer object used within the Swar.API to encapsulate details about an access token
- It primarily serves to facilitate the secure transmission of authentication information between the server and clients, ensuring that sensitive data is handled appropriately within the system's security protocols.PlaylistSongsDTO.cs - PlaylistSongsDTO serves as a data transfer object within the Swar.API, encapsulating playlist information alongside a list of songs
- It bridges the communication between the client and server by structuring playlist data, including metadata and associated songs, to facilitate efficient data handling and operations within the application's service architecture.LikedSongsReturnDTO.cs - Defines a data transfer object, LikedSongsReturnDTO, used to encapsulate details about user song preferences within the Swar.API
- It includes properties for user identification, song identification, and the date the song was liked, facilitating the efficient transfer and handling of liked song data across different components of the application.DBModels
PlaylistSong.cs - Defines the relationship between playlists and songs within the Swar.API project, facilitating the management of which songs belong to specific playlists
- The PlaylistSong model includes identifiers for both the playlist and the song, ensuring a structured link that supports operations like playlist creation, modification, and song assignment in the database.Playlist.cs - Defines the Playlist model within the Swar.API's database architecture, representing the structure for storing playlist data
- It includes properties such as playlist ID, name, description, visibility, creation date, and associated user details
- It also manages relationships with the User model and the PlaylistSong collection, facilitating data interaction and integrity within the application.User.cs - Defines the User model within the Swar.API's database architecture, encapsulating essential user attributes such as identification, authentication details, and role
- It also links to related entities like playlists, liked songs, and play histories, facilitating user interactions and data retrieval across the system's music streaming functionalities.LikedSong.cs - Defines the LikedSong model within the Swar.API's database architecture, representing user song preferences
- Each LikedSong entry includes a unique identifier, song ID, the date it was liked, and associated user details, linking to the User model to maintain relational integrity and facilitate user-specific data retrieval and management in the application.PlayHistory.cs - PlayHistory.cs defines a data model essential for tracking user interactions with songs within the Swar.API application
- It records each song play, noting the song identifier, play time, and the associated user
- This model supports features related to user activity history and analytics, enhancing personalized user experiences and data-driven decision-making in the application.ENUMs
UserRoleEnum.cs - Defines user roles within the Swar.API application, specifically categorizing roles as 'Admin' and 'User'
- This classification is crucial for managing access permissions and functionalities across different parts of the system, ensuring that users have appropriate rights based on their role, thereby supporting secure and efficient operation of the platform.UserStatusEnum.cs - Defines the `UserStatusEnum` within the Swar.API's Models.ENUMs namespace, which categorizes user states into `Active` and `Inactive`
- This enumeration is crucial for managing user lifecycle and status across the application, ensuring that system interactions and access controls are appropriately aligned with the user's current state.Migrations
20240823131712_initial.Designer.cs - Defines the initial database schema for the Swar API, setting up entities such as Users, LikedSongs, PlayHistories, Playlists, and PlaylistSongs
- It configures relationships, primary keys, and unique constraints to ensure data integrity and supports the PostgreSQL database using Entity Framework Core migrations.SwarContextModelSnapshot.cs - SwarContextModelSnapshot.cs captures the current state of the database model for the Swar API, detailing the structure and relationships of entities such as users, playlists, songs, and their interactions
- It ensures the database schema is consistently replicated during migrations, aiding in database version control and updates.20240823131712_initial.cs - Establishes the foundational database schema for the Swar.API project by creating tables for Users, LikedSongs, PlayHistories, Playlists, and PlaylistSongs
- It includes relationships and constraints to manage user interactions with songs and playlists, ensuring data integrity and supporting essential features like user management and music tracking.Services
PlaylistSongsService.cs - Manages interactions with playlist songs, including adding, removing, and retrieving songs within user-specific playlists
- Ensures user and playlist validation, handles exceptions for duplicate entries or unauthorized access, and logs activities for monitoring purposes
- Converts data between database models and transfer objects for external communication.LikedSongsService.cs - LikedSongsService in Swar.API manages user interactions with liked songs, facilitating the addition and removal of songs to a user's liked list, retrieving all liked songs for a user, and checking if a song is already liked by the user
- It ensures operations respect user account status and logs activities for monitoring.PlayHistoryService.cs - PlayHistoryService in Swar.API manages user song play histories, facilitating logging of song plays and retrieval of song history per user
- It ensures only active users can interact with their history, supports fetching unique song plays, and aggregates play histories across all users, enhancing user engagement and service personalization.UserService.cs - UserService.cs manages user-related operations within the Swar.API project, including user authentication, registration, and profile management
- It interfaces with repositories to access user data, utilizes token services for authentication, and logs activities for security and monitoring purposes
- This service ensures secure user management and facilitates user interactions with the system.TokenService.cs - TokenService in Swar.API/Services manages the creation of JWT tokens for user authentication, distinguishing between access and refresh tokens with configurable expirations
- It utilizes security keys derived from configuration settings to sign tokens, ensuring secure claims management for user identification and authorization purposes.PlaylistService.cs - PlaylistService in Swar.API manages playlist operations, including creation, deletion, and updates for playlists
- It interfaces with repositories to handle data retrieval and persistence, ensuring user authorization and logging actions for auditability
- This service also transforms data into DTOs for consistent client responses.Properties
launchSettings.json - Defines configuration settings for launching the Swar.API project across different environments and platforms, including direct project execution, IIS Express, and Docker
- It specifies startup URLs, environment variables, and server details to streamline development and testing phases by setting up a consistent, accessible API documentation interface via Swagger.Repositories
LikedSongsRepository.cs - LikedSongsRepository, located within the Swar.API/Repositories directory, serves as a specialized data access layer for managing 'LikedSong' entities
- It extends the functionality of AbstractRepository, leveraging the SwarContext to perform operations specific to liked songs in the database, thereby supporting features related to user preferences in music within the application's architecture.PlaylistSongsRepository.cs - PlaylistSongsRepository in Swar.API manages interactions with playlist-song relationships within the database
- It facilitates the retrieval and deletion of specific songs from playlists using composite keys
- This repository extends the base functionality to handle operations specific to the PlaylistSong model, ensuring efficient data management and integrity in the application's music management features.PlayHistoryRepository.cs - PlayHistoryRepository serves as a specialized data access layer within the Swar.API, managing interactions with the PlayHistory database model
- It extends the functionality of a generic repository by providing a context-specific interface for querying and manipulating play history records, thereby supporting the application's ability to track and analyze user playback activities efficiently.PlaylistRepository.cs - PlaylistRepository, part of Swar.API's repository layer, manages data interactions for Playlist entities within the database
- It extends the functionality of a generic repository by implementing the IPlaylistRepository interface, specifically adding the capability to retrieve playlists based on a unique public identifier
- This class plays a crucial role in abstracting and encapsulating database access for playlists in the application.AbstractRepository.cs - AbstractRepository.cs serves as a foundational class for data access operations within the Swar.API project
- It implements generic CRUD functionalities for entities, leveraging the SwarContext and DbSet from Entity Framework
- This class ensures efficient data manipulation and exception handling, facilitating the development of specific repositories by extending its capabilities.UserRepository.cs - UserRepository.cs serves as a specialized data access layer within the Swar.API, managing interactions with user data stored in the database
- It extends the functionality of a generic repository by providing a method to retrieve user details based on email, leveraging the Entity Framework for querying the database efficiently.Contexts
SwarContext.cs - SwarContext serves as the data access layer within the Swar.API, managing interactions with the database
- It defines the schema for users, playlists, liked songs, play histories, and playlist songs, ensuring relationships and constraints like unique indices and composite keys are properly configured to maintain data integrity and optimize database operations.Interfaces
Services
IPlaylistService.cs - IPlaylistService serves as a contract within the Swar.API project, outlining operations for managing playlists
- It defines methods for adding, retrieving, updating, and deleting playlists, both individually and in bulk, based on user identity
- This interface ensures consistent implementation of playlist management functionalities across various service components in the application.IPlayHistoryService.cs - IPlayHistoryService, defined within the Swar.API project, outlines methods essential for managing user song play histories
- It enables logging individual song plays, retrieving a user's song history with options for uniqueness, and fetching play histories across all users, facilitating personalized user experiences and data analytics within the application's service architecture.ITokenService.cs - ITokenService, located within the Swar.API/Interfaces/Services directory, defines a contract for generating JWT tokens
- It specifies a method to create a JWT token based on a user's details and a specified token type, ensuring secure and authenticated interactions within the application's services
- This interface is crucial for managing authentication across the system.IUserService.cs - Defines the contract for user-related operations within the Swar.API, outlining methods for user authentication, registration, and management
- It includes functionalities for logging in, registering, refreshing tokens, retrieving, updating, and deleting user profiles, as well as activating and deactivating users by administrators.ILikedSongsService.cs - ILikedSongsService, located within the Swar.API project, defines operations for managing a user's liked songs
- It supports adding and removing songs from a user's liked list, retrieving all liked songs, and checking if a specific song is liked by a user, facilitating personalized user interactions within the application's music service features.IPlaylistSongsService.cs - IPlaylistSongsService defines the contract for managing songs within playlists in the Swar.API project
- It specifies methods for adding and removing songs from playlists, as well as retrieving all songs within a user's specific playlist or across all playlists, ensuring interactions are tailored to user permissions and playlist ownership.Repositories
IPlaylistSongsRepository.cs - Defines the interface for interacting with playlist-song relationships in the database, specifically within the Swar.API project
- It extends a generic repository interface, adding functionality to retrieve and delete a song from a playlist using a composite key of playlist and song identifiers, ensuring efficient management of song associations within playlists.IPlaylistRepository.cs - Defines an interface for playlist repository operations within the Swar.API application, extending the generic repository capabilities specifically for Playlist objects
- It includes a method to retrieve playlists based on a unique public identifier, ensuring that playlist management can be handled efficiently and consistently across the application's data access layer.IUserRepository.cs - Defines an interface for user repository operations within the Swar.API project, extending a generic repository interface
- It specifies a method for retrieving a user by their email, ensuring that user management functionalities can interact seamlessly with the database to access user-specific data, crucial for authentication and user profile management tasks.IRepository.cs - Defines a generic repository interface within the Swar.API project, specifying common data operations such as add, update, delete, and retrieval for entities
- This interface ensures consistent implementation across different data models, facilitating easier maintenance and scalability of the data access layer within the application's architecture.
Swar.UnitTest
Swar.UnitTest.csproj - Swar.UnitTest.csproj configures a .NET 6.0 project specifically for unit testing within the Swar software architecture
- It integrates essential testing frameworks and libraries such as NUnit, Moq, and Microsoft.EntityFrameworkCore.InMemory to facilitate robust testing practices
- Additionally, it references the Swar.API project, ensuring that API functionalities are thoroughly tested against the unit tests defined.RepositoryUnitTest
PlaylistSongsRepositoryTests.cs - PlaylistSongsRepositoryTests.cs conducts comprehensive testing of the PlaylistSongsRepository's functionalities, ensuring correct behavior in adding, retrieving, updating, and deleting playlist-song associations within a simulated database environment
- It validates the repository's handling of normal operations and exception scenarios to maintain data integrity and reliability.LikedSongsRepositoryTests.cs - Validates the functionality of the LikedSongsRepository within the Swar.UnitTest suite, ensuring it correctly handles CRUD operations for liked songs
- Tests cover scenarios including adding, retrieving, updating, and deleting liked songs, as well as handling exceptions for duplicate entries and non-existent records.PlaylistRepositoryTests.cs - PlaylistRepositoryTests.cs serves as a comprehensive test suite for validating the functionality of the PlaylistRepository within the Swar.UnitTest project
- It ensures the repository correctly handles CRUD operations for playlist entities, including adding, retrieving, updating, and deleting playlists, as well as managing exceptions and validating entity existence.UserRepositoryTests.cs - UserRepositoryTests.cs serves as a comprehensive test suite for validating the functionality of the UserRepository class within the Swar.UnitTest project
- It ensures that user management operations such as add, delete, update, and retrieval by ID or email are correctly implemented and handle exceptions as expected.PlayHistoryRepositoryTests.cs - PlayHistoryRepositoryTests.cs serves as a comprehensive test suite for validating the functionality of the PlayHistoryRepository within the Swar API
- It ensures that operations such as adding, retrieving, updating, and deleting play history records in the database behave as expected, handling both normal and exceptional cases effectively.ServiceUnitTest
PlayHistoryServiceTests.cs - PlayHistoryServiceTests.cs conducts a series of unit tests for the PlayHistoryService within the Swar application, ensuring functionality such as logging and retrieving song play history operates correctly under various user conditions
- It validates service responses to active, inactive, and non-existent users, emphasizing robustness and error handling in user interactions.UserServiceTests.cs - UserServiceTests.cs conducts comprehensive unit testing for the UserService, ensuring functionality such as user authentication, registration, and management operations perform as expected
- It validates scenarios including valid inputs, error handling for invalid credentials, and user status changes, thereby confirming the robustness of user-related functionalities within the system.TokenServiceTests.cs - TokenServiceTests.cs is dedicated to verifying the functionality of the TokenService within the Swar.UnitTest project
- It focuses on ensuring that JWT tokens are correctly generated and validated for users, handling both access and refresh tokens, and confirming the integrity and claims of the tokens produced.PlaylistSongsServiceTests.cs - PlaylistSongsServiceTests.cs serves as a test suite for validating the functionality of the PlaylistSongsService within the Swar application
- It ensures that operations such as adding, retrieving, and removing songs from playlists behave as expected under various scenarios, including handling valid inputs, duplicate entries, and unauthorized access attempts.PlaylistServiceTests.cs - PlaylistServiceTests.cs conducts comprehensive unit testing for the PlaylistService within the Swar application, ensuring functionality such as adding, deleting, updating, and retrieving playlists operates correctly under various conditions
- It validates business logic adherence, exception handling, and user authorization, crucial for maintaining robust service operations.LikedSongsServiceTests.cs - LikedSongsServiceTests.cs conducts unit tests for the LikedSongsService within the Swar.UnitTest project, ensuring functionality such as adding, removing, and querying liked songs operates correctly
- It validates service responses under various scenarios including valid operations, user or song not found, and account status issues, using an in-memory database for isolated testing environments.
Swar.UI.React
package-lock.json - The file `package-lock.json` located in the `Swar.UI.React` directory plays a crucial role in managing the dependencies of the Swar project's React-based user interface
- This file ensures that the exact versions of the libraries and frameworks specified are installed, thereby preventing discrepancies that could arise from version mismatches in different development environments
- It includes dependencies crucial for authentication, UI components, HTTP requests, animations, and icons, which are essential for building a consistent and interactive user interface.This file is integral to the project as it supports the stability and reproducibility of the environment across different setups, which is vital for collaborative development and maintaining the project's integrity over time
- By locking down the versions of each package, the project minimizes issues related to upgrades and compatibility, ensuring that all contributors are working with a set of well-defined and tested libraries.vercel.json - Configures URL routing for the Swar.UI.React application within the Vercel hosting environment by redirecting all traffic to a single entry point
- This setup facilitates the implementation of a Single Page Application (SPA) architecture, ensuring smoother user navigation and interaction by handling routing client-side rather than server-side.tailwind.config.js - Tailwind.config.js configures Tailwind CSS for the Swar.UI.React project, specifying content sources and extending themes with custom properties like minimum heights and colors
- It integrates the NextUI plugin to enhance UI components and supports dark mode, aligning with modern web design practices for a cohesive and customizable user interface.vite.config.js - Configures the Vite build setup for the Swar.UI.React project, integrating React and progressive web app (PWA) capabilities
- It specifies a manifest for PWA, detailing app icons, screenshots, and theme settings to enhance user experience on mobile devices
- This setup ensures that Swar operates as a standalone application with auto-updating features.package.json - Serves as the configuration backbone for the Swar UI React application, defining project dependencies and scripts essential for development, building, and testing
- It integrates various libraries for UI components, animations, and state management, ensuring a robust setup for scalable and maintainable code
- Additionally, it configures development tools for code quality and performance optimization.index.html - Serves as the entry point for the Swar UI React application, setting up the foundational HTML structure and linking to the main React component
- It configures the viewport and character set for proper display on various devices, and initializes the React application by connecting the root element to the React components defined in main.jsx.postcss.config.cjs - Configures PostCSS to use TailwindCSS and Autoprefixer as plugins within the Swar.UI.React component of the project
- This setup enhances CSS by enabling utility-first styling with TailwindCSS and ensuring cross-browser compatibility with Autoprefixer, streamlining the development process for building responsive and visually consistent user interfaces.eslint.config.js - Swar.UI.React/eslint.config.js configures ESLint for JavaScript and JSX files in the project, excluding the 'dist' directory
- It sets up language options for ECMAScript 2020, enables JSX, and applies recommended rules from various plugins including React and React Hooks
- It also customizes specific rules for better handling of React features and refresh mechanisms.src
index.css - Swar.UI.React/src/index.css establishes the foundational styles for the Swar UI React project
- It integrates the Poppins font from Google Fonts and configures Tailwind CSS for base, components, and utilities
- Additionally, it customizes the body's typography and hides scrollbars in elements with the .hide-scrollbar class, enhancing the user interface's visual cleanliness.App.jsx - App.jsx serves as the central routing hub for the Swar.UI.React application, orchestrating navigation and layout management
- It integrates various pages like Home, Player, and Search within a structured layout, utilizing protected routes for user-specific content
- The application's visual consistency and user feedback mechanisms are maintained through theming and toast notifications.main.jsx - Main.jsx serves as the entry point for the Swar.UI.React application, initializing the React framework and integrating essential services
- It sets up routing with BrowserRouter and configures authentication using Auth0Provider, ensuring secure user access
- The application's visual and functional components are encapsulated within the App component, which is rendered to the root DOM node.contexts
PlayerContext.jsx - PlayerContext.jsx establishes a centralized management system for music playback within the Swar.UI.React application
- It handles song loading, play/pause toggling, track navigation, and media session updates, enhancing user interaction by maintaining playback state, song details, and navigation history
- This context facilitates efficient data sharing across different components of the application.components
MobileNav.jsx - MobileNav serves as the navigation component for mobile users within the Swar.UI.React project
- It utilizes icons and links for essential sections like Home, Library, and Profile, enhancing user experience by providing easy access and visibility
- Integration with Auth0 for authentication allows display of user-specific data, such as profile pictures.Navbar.jsx - Navbar.jsx serves as the user interface component responsible for rendering the navigation bar in a React application
- It integrates authentication checks to display user-specific elements like profile information and links to home and library pages, and includes a search functionality, enhancing user navigation and accessibility within the application.SongSkeleton.jsx - SongSkeleton.jsx provides a placeholder representation for song items within the user interface while data is loading
- It utilizes the react-loading-skeleton library to display animated skeletons for song images and details, enhancing the user experience by indicating content is on the way during data fetch operations
- This component supports dynamic rendering based on the number of cards specified.Layout.jsx - Layout.jsx serves as the structural backbone for the user interface in the Swar.UI.React project, dynamically integrating navigation and media playback components based on user authentication status, device type, and navigation state
- It ensures a responsive and user-centric experience by adjusting layout elements like padding and visibility of navigation bars according to the application's context and user interactions.InstallPWA.jsx - InstallPWA.jsx facilitates the installation of the web application as a Progressive Web App (PWA) on supported devices
- It manages user prompts for installation and confirms successful app installation with notifications
- This component enhances user engagement by providing a seamless installation experience directly from the browser interface.PlayerSkeleton.jsx - PlayerSkeleton.jsx serves as a placeholder component within the Swar.UI.React project, providing visual feedback during data loading phases
- It utilizes the react-loading-skeleton library to display animated skeletons mimicking the layout of a media player, enhancing user experience by indicating content loading states, particularly for player controls and lyrics sections.SearchBar.jsx - MobileSearchBar, a component within the Swar.UI.React/src/components directory, facilitates user interaction by enabling search functionality specifically for mobile users
- It captures user input to query songs and artists, then navigates to the search results page using dynamic URL routing, enhancing the application's usability and navigation efficiency.Footer.jsx - Footer.jsx serves as the footer component for the Swar.UI.React project, providing a consistent bottom section across all pages
- It includes links to the creator's GitHub and Instagram profiles, enhancing user engagement and offering direct access to social channels
- The component emphasizes a personal touch with a message crafted by the developer.PlaylistCard.jsx - PlaylistCard.jsx serves as a component within the Swar.UI.React project, enabling interactive management of playlist cards
- It facilitates navigation to specific playlists, editing playlist details, toggling privacy settings, and deleting playlists
- The component uses hooks for state management and actions, and integrates modals for user interactions like editing.PlaylistsSkeleton.jsx - PlaylistsSkeleton.jsx provides a loading placeholder for playlist components within the Swar.UI.React project
- It utilizes the react-loading-skeleton library to display animated skeletons, enhancing user experience during data fetching by indicating that content is being loaded
- This component is crucial for maintaining a smooth and visually consistent interface in the application's playlist sections.ArtistButton.jsx - ArtistButton.jsx defines a reusable React component that facilitates navigation within the application by rendering a styled button
- Each button, when clicked, directs the user to a search page filtered by the artist's name
- This component enhances user interaction by simplifying access to artist-specific searches, contributing to the overall usability and navigational efficiency of the UI layer in the Swar.UI.React project.MiniPlayer.jsx - MiniPlayer serves as a compact, interactive music player component within the Swar.UI.React project
- It integrates authentication and navigation handling, allowing users to control music playback and navigate to detailed song views
- The component only appears when users are authenticated and not on the main or player pages, enhancing user experience by context-sensitive display and functionality.Icons.jsx - Provides a collection of SVG icons including AddIcon, CopyIcon, EditIcon, and DeleteIcon for use across the Swar.UI.React application
- Each icon is designed with accessibility features such as aria-hidden and focusable attributes, ensuring they are presentationally appropriate while supporting various UI functionalities by accepting props for customization.ProfileSkeleton.jsx - ProfileSkeleton.jsx provides a placeholder user interface component within the Swar.UI.React project, specifically for user profiles during data loading phases
- It utilizes the react-loading-skeleton library to display animated skeletons, enhancing the user experience by indicating that profile information is currently being loaded.ArtistSkeleton.jsx - ArtistSkeleton.jsx provides a placeholder visualization for artist components within the Swar.UI.React project
- It generates a series of skeleton screens, which are used to maintain a smooth user experience by displaying temporary loading placeholders as the artist data loads
- This component enhances the visual consistency and perceived performance of the application.SongCard.jsx - SongCard.jsx defines a reusable component for displaying song information within the Swar.UI.React project
- It visually presents songs as cards, featuring clickable images linked to a player view, along with song titles and primary artist details
- This component enhances user interaction by facilitating navigation to the music player with specific song data.LikeButton
LikeButton.jsx - LikeButton, a React component, manages user interactions for liking or unliking songs within the Swar.UI.React application
- It utilizes custom hooks for API interactions and state management to reflect and update a song's like status, providing visual feedback through dynamic SVG icons and toast notifications for error handling.likebutton.css - Defines the visual and interactive elements of a Like button within the Swar.UI.React project, specifically styling a heart-shaped button that animates upon interaction
- The CSS rules manage the button's appearance, transitions, and animations, enhancing user engagement by visually responding to clicks with scaling and color changes.Error
NotResultError.jsx - NotResultError.jsx defines a React component that displays a user-friendly message and graphic when search results are absent
- Positioned within the UI component layer of the architecture, it enhances user experience by providing clear visual and textual feedback during unsuccessful search attempts, encouraging further interaction or return visits.ErrorMessage.jsx - ErrorMessage.jsx serves as a component within the Swar.UI.React project, dynamically rendering error messages based on HTTP status codes
- It specifically handles 404 and 400 errors with custom components, and provides a default message for other errors
- This modular approach enhances the user interface by providing clear, context-specific feedback for various error states.BadRequestError.jsx - BadRequestError.jsx defines a React component that displays a user-friendly error message and graphic when a bad request occurs
- It enhances user experience by providing a clear notification and encouragement to retry the action, contributing to the overall robustness and usability of the application's user interface.modals
PlaylistModal.jsx - PlaylistModal serves as a user interface component within the Swar.UI.React project, facilitating the creation and editing of playlists
- It manages user inputs for playlist names and descriptions, validates them, and handles their submission
- The modal supports both creation and edit modes, enhancing user interaction by providing a dynamic and responsive form experience.PlaylistInfoModal.jsx - PlaylistInfoModal serves as a user interface component within the Swar.UI.React project, enabling users to add songs to playlists
- It utilizes modal dialogs to present playlist options fetched through custom hooks, handles user interactions for selecting and adding songs to playlists, and provides feedback on the operation's success or failure.hooks
usePlaylistSongs.js - UsePlaylistSongs is a custom React hook designed to manage and fetch playlist songs from a specified API endpoint
- It leverages caching for efficient data retrieval and updates the state with categorized song lists, such as trending and relaxing, enhancing user experience by reducing load times and maintaining data availability offline.usePlaylistInfo.js - UsePlaylistInfo is a custom React hook designed to manage the retrieval and state of playlist information within the Swar.UI.React application
- It leverages an API client to fetch playlist data based on user ID, handling loading states and errors, thereby streamlining the integration of playlist data across the user interface components.useApiClient.js - UseApiClient serves as a custom React hook within the Swar.UI.React project, facilitating secure API interactions by integrating authentication tokens into requests
- It dynamically configures an API client based on service type and manages token insertion using Auth0, ensuring all outgoing requests are authenticated.useSearchData.js - UseSearchData is a custom React hook designed to manage the fetching and state of search results within the Swar.UI.React application
- It handles user queries to retrieve song data, manages loading states, and captures errors, providing a streamlined way to access search results and artist information based on user input.usePlaylistActionsBase.js - Provides a set of React hooks for managing playlist interactions within the Swar.UI.React application
- It facilitates adding and removing songs from playlists, handling API communications, and user feedback through success or error messages
- The hooks leverage an API client for server requests and optimize re-rendering with useCallback.useRecentlyPlayedSongs.js - UseRecentlyPlayedSongs is a custom React hook that manages the retrieval and caching of a user's recently played songs from a music streaming service
- It leverages dual API clients to fetch song details and user play history, updating the UI state with song data and loading status, enhancing user experience by efficiently handling data fetching and state management within the application's architecture.usePlayer.js - Provides a custom hook, `usePlayer`, that facilitates access to the `PlayerContext` within the React component tree of the Swar.UI.React project
- It ensures that the hook is used in a component wrapped by a `PlayerProvider`, enforcing proper context usage and enhancing state management across the UI components related to player functionalities.useUserPlaylistSongs.js - Manages the retrieval and caching of songs within a user's playlist in the Swar.UI.React application
- It utilizes API calls to fetch playlist details and individual songs, caching them for efficiency
- The hook also handles loading states and errors, providing a responsive user experience for managing playlists.usePlaylistActions.js - UsePlaylistActions is a custom React hook that facilitates interaction with playlist functionalities in a web application
- It enables operations such as deleting a playlist, toggling its privacy, copying its link, and editing its details
- Each action is integrated with API calls and user feedback mechanisms through toasts for success or error notifications.pages
Player.jsx - SongPlayer serves as the interactive media playback interface within the Swar.UI.React project, enabling users to play, pause, skip, and loop songs
- It integrates functionalities like downloading songs, displaying song details, and viewing lyrics
- The component enhances user interaction by providing real-time feedback on song progress and facilitating search capabilities through an embedded search bar.Profile.jsx - Profile.jsx serves as the user profile management interface within the Swar.UI.React application, enabling users to view and interact with their personal information, playlists, and recent activity
- It integrates user authentication, data fetching for playlists and recently played songs, and displays this data dynamically with error handling and loading states.Search.jsx - Search.jsx serves as a dynamic search interface within the Swar.UI.React project, enabling users to query and view search results, related artists, and trending songs
- It utilizes custom hooks for fetching data and components for displaying songs and artists, providing a responsive and interactive user experience.Library.jsx - Library.jsx serves as the user interface for managing playlists within the application
- It enables users to view, create, and manage their playlists, handling operations like fetching playlists from the server, displaying loading states or errors, and integrating modals for playlist creation
- The page enhances user interaction through responsive feedback mechanisms like success and error toasts.Playlist.jsx - Playlist.jsx serves as the user interface for displaying and managing individual playlists within the Swar.UI.React application
- It utilizes hooks for fetching playlist details and songs, handling song removal, and navigating to the song player
- The page dynamically updates song lists and provides interactive elements for user actions, enhancing the playlist management experience.Landing.jsx - Swar.UI.React/src/pages/Landing.jsx serves as the entry point for users into the Swar application, providing a visually engaging landing page
- It facilitates user authentication, showcases key features like high-quality streaming and playlist creation, and promotes app installation and usage through interactive elements and navigation prompts
- The page enhances user engagement with dynamic typewriter effects and a structured presentation of services.Home.jsx - Home.jsx serves as the main user interface for displaying various song categories in the Swar.UI.React project
- It utilizes custom hooks to fetch playlist and recently played songs, rendering them through the SongCard component
- The page also includes a SearchBar and Footer, enhancing user navigation and experience.routes
ProtectedRoute.jsx - ProtectedRoute.jsx serves as a security gate within the Swar.UI.React application, ensuring that only authenticated users can access certain routes
- It utilizes Auth0 for authentication, displays a loading indicator during user verification, and greets authenticated users
- Unauthenticated users are redirected to the home page, maintaining the integrity and privacy of protected routes.api
axios.js - Establishes a configurable Axios client for interacting with two distinct backend services within the Swar.UI.React application
- It dynamically sets the base URL depending on whether the request targets the main SWAR API or the Song Service, ensuring appropriate API calls are made with correct headers for JSON content.public
robots.txt - Manages web crawler access for the Swar.UI.React project, specifically within the public directory
- By allowing all user-agents unrestricted access, the robots.txt file ensures that search engines can freely index the site's content, enhancing its visibility and searchability on the internet.
Swar.UI
register.html - Swar.UI/register.html serves as the user registration interface for Swar, a music streaming platform
- It facilitates new user account creation by collecting essential details such as name, email, gender, and password
- The page is styled with Tailwind CSS and includes links to additional scripts for form handling and service interaction.library.html - Swar.UI/library.html serves as the user interface for the "Your Library" section of the Swar music streaming platform
- It provides users with access to their saved playlists and liked songs, enabling them to manage and enjoy their favorite music
- The page includes navigation elements, search functionality, and interactive components for an enhanced user experience.profile.html - Swar.UI/profile.html serves as the user profile interface for the Swar music streaming platform
- It provides users with functionalities to view and edit their profile, change their password, and delete their account
- Additionally, it displays user-specific content such as playlists and recent activity, enhancing the personalized experience on the platform.login.html - Swar.UI/login.html serves as the user interface for logging into the Swar music streaming platform
- It provides a form for email and password input, visual feedback for login processes, and links for users to register if they don't have an account
- The page enhances user experience with responsive design and aesthetic consistency.playlist.html - Swar.UI/playlist.html serves as the user interface for the "Your Library" section of the Swar music streaming platform
- It provides a responsive layout for navigating personal music collections, featuring search functionality, navigation bars, and dynamic content areas for displaying playlists and songs
- The page enhances user interaction with aesthetic elements and mobile responsiveness.songPlayer.html - The file `songPlayer.html` within the `Swar.UI` directory serves as a crucial component of the Swar music streaming platform, specifically tailored for playing songs
- This HTML document is structured to provide a user interface that allows users to interact with the platform's music streaming capabilities
- It includes meta tags for proper encoding, viewport configuration for responsive design, and detailed descriptions to enhance SEO
- Additionally, it incorporates various favicon links for device-specific icons, ensuring a cohesive visual representation across different devices and platforms.In the broader context of the Swar project's architecture,
songPlayer.htmllikely acts as a standalone page or a part of a larger web application responsible for the music playback experience
- This file's role is to deliver a seamless and accessible user interface, contributing directly to user engagement and satisfaction by enabling easy navigation and interaction with the platform's core features—music streaming.index.html - The file `Swar.UI/index.html` serves as the primary entry point for the Swar music streaming platform's user interface
- This HTML document is crucial for initializing the user experience, setting up the initial layout, and integrating essential metadata and resources
- It includes meta tags that define character encoding, viewport settings for responsive design, and a description that enhances SEO for the platform
- Additionally, it links to various favicon sizes and Apple touch icons, which are important for branding and user recognition across different devices and platforms
- The document also references a manifest file, which is key for defining the web application's behavior when added to a user's home screen, particularly in mobile environments.In the broader context of the project's architecture, this file acts as the foundational layer that supports the visual and interactive aspects of the platform, ensuring that users have a seamless and engaging experience right from the start
- It is likely interconnected with CSS for styling and JavaScript files for functionality, which would be specified in other parts of the project structure
- This setup is essential for maintaining a scalable and maintainable codebase in a potentially complex web application like a music streaming service.search.html - Swar.UI/search.html serves as the user interface for the search functionality within the Swar music streaming platform
- It provides a responsive layout for searching songs and artists, featuring a navigation bar, search input fields, and sections for displaying search results, trending content, and artist suggestions
- The page enhances user interaction with dynamic content loading and mobile responsiveness.public
manifest.json - Swar.UI's manifest.json configures the web application's appearance on user devices, defining essential metadata such as app names, icons, and theme colors
- It ensures the app is recognized and functions seamlessly across platforms, enhancing user engagement by setting visual elements and behavior in standalone display mode.robots.txt - Manages web crawler access for the Swar.UI public directory, specifically instructing search engines that all agents are permitted to index all content
- This setup enhances the visibility and searchability of the site, contributing to broader accessibility and user engagement across the internet.
Before getting started with Swar, ensure your runtime environment meets the following requirements:
- Programming Language: CSharp
- Package Manager: Nuget, Npm
- Container Runtime: Docker
Install Swar using one of the following methods:
Build from source:
- Clone the Swar repository:
❯ git clone https://github.com/neeraj779/Swar- Navigate to the project directory:
❯ cd Swar/<project-directory>- Install the project dependencies:
❯ dotnet restore❯ docker build -t Swar .Run Swar using the following command:
Using nuget
❯ dotnet run❯ docker run -it {image_name}Run the test suite using the following command:
Using nuget
❯ dotnet testDistributed under the MIT License. See LICENSE for more information.