How khuongkayyyyy/sound_sphere works
Project type and purpose
• This is a full-stack mobile & web application (“Sound Sphere”) implemented in Flutter on the client side, paired with a NestJS-based backend and Firebase services.
• Purpose: provide a music-streaming experience with user authentication, lyrics sync, playlist management, offline downloads, discovery features, dark mode UI, etc.
File structure
• Top-level:
• android / ios / linux / macos / windows / web / public – Flutter platform runners and hosting setup
• lib – core Flutter code, subdivided into:
– core (constants, utils, theming, routing, error handling)
– data (models, data sources, repositories)
– domain (repository interfaces)
– presentation (BLoC state management, UI views, widgets)
– main.dart (app entry point)
• firebase files (.firebaserc, firebase.json) – Firebase hosting/auth setup
• pubspec.yaml – Flutter dependencies
• test directories – widget/unit tests
README for additional insights
• Frontend: Flutter
• Backend: NestJS
• Authentication: Firebase Authentication
• Database: MongoDB / Firestore
• Deployment: static web hosting (Firebase Hosting) and mobile app stores
Main components and their interactions
a. Frontend (Flutter app)
• Presentation layer: Widgets, Views
• State management: BLoC components (authentication, track, playlist, etc.)
• Domain layer: repository interfaces
• Data layer:
• Local data source (e.g. shared_preferences, SQLite)
• Remote data source – HTTP calls to NestJS API & Firebase SDK calls
• Platform hosts: Android, iOS, Web, Desktop
b. Backend (NestJS API)
• HTTP REST (or GraphQL) endpoints for music catalog, playlists, lyrics sync
• Middleware for Firebase token validation
• Business logic modules: tracks, albums, artists, playlists, users
• Connects to a database (MongoDB or Firestore)
c. External services
• Firebase Authentication (OAuth2, token management)
• Firebase Hosting (static web assets)
• Firestore (if used as primary DB for some collections)
• Cloud Storage / CDN for serving audio files
• Optional: Cloud Functions (for notifications or processing)
d. Database
• MongoDB cluster or Firestore for persistence of users, playlists, history, metadata
Architectural patterns & design principles
• Clean architecture / layered architecture on the client
• BLoC pattern for state management (presentation → domain → data)
• Repository pattern for decoupling data sources
• Micro-modular NestJS backend with modules per feature
• Use of Firebase for cross-cutting concerns (auth, hosting, possibly storage)