How hash-studios/prism works
Project Type & Purpose
• Prism is a full-stack mobile application built primarily with Flutter (using Dart) targeting Android (with iOS support) that delivers high-quality wallpapers and home screen setups.
• Its purpose is to provide an attractive, high-performance user interface for browsing, downloading, and setting wallpapers and setups, while also managing user interactions (such as authentication, notifications, and social sharing) and interacting with external services (e.g., WallHaven, Pexels, Firebase, Google Sign-In).
Analyzing the File Structure
• Top-Level Directories:
– The “android” and “ios” directories contain platform-specific configurations and native wrappers (with build scripts, Gradle settings, Fastlane for deployment, and Xcode projects).
– The “lib” directory is the heart of the Flutter codebase. It is subdivided into various feature modules: analytics, auth, data, notifications, payments, routes, theme, ui (with further subdirectories for pages and widgets), and more.
– Additional folders like “assets” (for images, fonts, and animations) and configuration files (pubspec.yaml, pubspec.lock, analysis_options.yaml) round out the project.
• Architectural Clues:
– The use of “Provider” in multiple directories and data modules indicates that state management is handled via the Provider pattern.
– A modular structure is apparent (authentication, data fetching, notifications, theming) which hints at separation of concerns.
– There are also industry-standard integrations (Firebase services, Google Ads, local notifications, in-app payments) reflective of common mobile app practices.
Key Components & Their Interactions
A. User Interface (UI) Layer
• UI Pages: Located in lib/ui/pages – different pages such as Home, Search, Profile, Setup, Upload, etc.
• UI Widgets: Individual components (for animations, buttons, menus, popups) in subdirectories like lib/ui/widgets.
• Navigation: The routing system in lib/routes that defines app navigation routes and routing constants.
B. Business Logic & State Management
• Providers: Numerous “provider” modules in directories under lib/data (for ads, categories, collections, notifications, etc.) and in global directories; these manage app state and data updates.
• Services: Analytics (lib/analytics), Logger (lib/logger) and Notification services (both local notifications and Firebase messaging).
• Theme & Config: Theme configuration, dark mode, and custom widget behavior (lib/theme).
C. Data Layer & Integrations
• External Data Sources: Modules for fetching data from WallHaven and Pexels (lib/data/wallhaven and lib/data/pexels) as well as user profile and setups.
• Cloud & Local Storage: Firebase integration (Cloud Firestore, Firebase Analytics, etc.), caching with Hive (in pubspec dependencies) and local storage for caching images.
• Authentication: The user sign-in and authentication flow (lib/auth with google_auth.dart and various user models).
• Payment & Ads: Integration for payments (using RevenueCat through purchases_flutter) and Google Mobile Ads for rewarded video ads.
D. Platform & Build Infrastructure
• CI/CD Pipelines: The workflows and scripts under the .github directory for continuous integration and deployment.
Architectural Patterns & Design Principles
• Layered Architecture: Separate presentation (UI), business logic/state management (Provider and services), and data (API calls, local storage).
• Modular Design: The clear separation of concerns across directories (auth, data, routes, theme, notifications) supports easier testing, maintenance, and scalability.
• Provider Pattern: A central pattern used throughout for state management and dependency injection.
• Integration with External APIs/Services: Emphasize connections to third-party APIs (WallHaven, Pexels, Firebase).
• At the top, show the “User Interface” layer that includes screens (Home, Profile, Upload, etc.).
• Further below, map out the “Data & Integration” layer, highlighting components for fetching wallpapers from WallHaven and Pexels, caching (Hive), Firebase interactions, authentication, and payment services.
– Data flow: From the Data Layer to State Management and eventually to the UI.
– Dependencies: For example, external services (Firebase, third-party APIs) influencing both the Data and Auth layers.