How marcosobiang/hotty2 works
1. Overall shape
- This is a Flutter/Dart client for a social app called Hotty, targeting mobile plus desktop/web via the standard Flutter platform folders.
- The codebase is organized as a modular monolith: each business area owns its own models, repositories, use cases, state, and views.
2. App entry and bootstrapping
- lib/main.dart and lib/main_starter.dart are the entry points into the app lifecycle.
- Startup is not “everything at once”; instead, the app uses starter classes under lib/starters/ to control which modules are initialized before sign-in and after a user session is established.
3. Lifecycle orchestration
- Starters are the main boundary for resource management: they initialize and dispose modules, especially those that hold subscriptions, WebSocket connections, or listeners.
- This is important for the architecture diagram because modules are conditionally active rather than always resident.
4. Dependency and infrastructure layer
- lib/dependencies/main_injector.dart acts as the central service locator.
- The app uses this for shared infrastructure services like API access, WebSockets, notifications, storage, purchases, ads, navigation, and platform utilities.
- Readme indicates GetX is used as the locator, while Provider is used for UI state propagation.
5. Shared contracts and abstractions
- lib/interfaces/ contains the cross-module contracts: starters, use cases, data handlers, state interfaces, async info exposure, and module sync executors.
- These abstractions are the main decoupling boundary between infrastructure and feature modules.
6. Feature-module architecture
- Most domains follow the same internal structure:
- model/ for domain data
- repo/ for backend/data access
- usecases/ for business actions
- state/ for reactive view state
- view/ or screen/ for UI
- dependencies/ for module wiring
- This pattern is visible in Chat, Messages, Discover, Like, Purchases, Rewards, Settings, Auth, CreateUser, and UserData modules.
7. Authentication and onboarding
- lib/mdoules/auth_module/ handles login flow, token refresh, and auth strategy selection.
- It includes a dedicated flow layer (flow/) with steps, which suggests a multi-stage sign-in process rather than a single login call.
- CreateUserModule is a separate onboarding boundary for account creation, profile setup, and post-signup completion screens.
8. Core social product domains
- DiscoverModule handles profile discovery, filtering, sending likes, and location updates.
- LikeModule manages like lifecycle, reveal/accept/delete actions, and countdown/timer-driven UI.
- ChatModule owns chat list handling, chat deletion, real-time sorting, and message read coordination.
- MessagesModule is the message-thread domain, with send, load, sync, listen, and mark-as-read operations.
- SettingsModule manages profile editing, picture uploads, bio/characteristics/settings changes, and user deletion/logout.
- UserDataModule centralizes current-user data loading and reactive observation.
9. Real-time and event-driven flow
- The repo has a strong real-time layer built around WebSockets and internal event buses.
- lib/services/events/ChatEventBus.dart, ChatEventService.dart, and PurchaseEventBus.dart suggest in-app event propagation across modules.
- Chat and message modules include handler factories and synchronizers, meaning inbound socket events are translated into module-specific state updates rather than handled directly in the UI.
10. Data access and external services
- Repositories are the main gateway to backend services; they typically depend on ApiService, WebSocket services, auth/session services, and platform storage.
- firebase_options.dart, google-services.json, and the push notification services indicate Firebase integration for notifications.
- There are also services for purchases, ads, location/permissions, and likely a backend auth provider via keycloak_service.dart and session storage.
11. State and UI boundaries
- Feature state objects such as AuthState, ChatState, MessagesState, DiscoveryPageState, LikeState, PurchasesState, RewardState, and SettingsState are the main reactive bridge to the UI.
- Views listen to these states and invoke use cases; they should be diagrammed as consumers of module state, not direct callers of repositories.
12. Error handling and dialogs
- There is a dedicated exceptions layer in the root lib/Exceptions/ and module-specific exception mappers.
- lib/Dialogs/ contains reusable dialog components for generic, network, and presentation feedback, indicating the UI surfaces errors through shared dialog infrastructure rather than ad hoc widgets.
13. Platform and build integration
- Native wrappers exist for Android, iOS, macOS, Linux, Windows, and Web.
- The Android project includes Firebase config, and the repo also contains shell utilities for developer workflows, suggesting this app is built and tested across multiple targets.
14. Testing posture
- The test/ tree is broad and module-specific, covering auth flow, repositories, use cases, models, and widget tests.
- This reinforces the architecture: business logic is designed to be testable at the use-case/repository boundary, with UI tests isolated from infrastructure.
Main entry points: starters Starters · auth_module Auth · services Core services · ChatModule Chat
Components 21
Bootstrap
App entrypoints and lifecycle starters
- main.dart · Flutter app entrypoint
lib/main.dart - Main starter · Chooses and sequences module startup
lib/main_starter.dart - Starters · Conditional module initialization and disposal
lib/starters
Infrastructure
Shared services and platform integrations
- Injector · Central dependency wiring and shared singleton registration
lib/dependencies/main_injector.dart - Core services · API, websocket, notifications, storage, ads, purchases, navigation, auth
lib/services - WebSocket · Socket connectivity and payload container
lib/services/WebSocket/WebSocketService.dart - API · Backend request gateway
lib/services/ApiService.dart - Push notif. · Firebase push notification integration
lib/services/PushNotifications/push_notifications_service.dart - Storage · Secure storage, permissions, and location utilities
lib/services/platform/storage/SecureStorage.dart
Contracts
Cross-module abstractions and state interfaces
- Interfaces · Shared module contracts and lifecycle interfaces
lib/interfaces
Feature modules
Business modules for auth, social, messaging, and monetization
- Auth · Login flow, token refresh, and auth strategy selection
lib/mdoules/auth_module - Create user · Account creation and profile completion
lib/mdoules/CreateUserModule - Discover · Profile discovery, filters, likes, and location updates
lib/mdoules/DiscoverModule - Likes · Like lifecycle, reveal, accept, and timers
lib/mdoules/LikeModule - Chat · Chat list, deletion, sorting, and read coordination
lib/mdoules/ChatModule - Messages · Thread load, send, sync, listen, and mark-read
lib/mdoules/MessagesModule - Settings · Profile editing, uploads, logout, and deletion
lib/mdoules/SettingsModule - Purchases · Products, paywall, restore, and recharge flows
lib/mdoules/PurchasesModule - Rewards · Daily and welcome reward claiming
lib/mdoules/RewardsModule - User data · Current-user data loading and observation
lib/mdoules/user_data_module
Real-time
Event buses and websocket-driven coordination
- Event bus · Chat and purchase event propagation
lib/services/events
Connections 32
- main.dart → Main starter: launches · App entry delegates lifecycle setup
- Main starter → Injector: wires · Bootstraps shared dependencies
- Main starter → Starters: runs · Coordinates module startup order
- Injector → Core services: registers · Provides shared infrastructure services
- Injector → Interfaces: implements · Binds shared abstractions to concrete services
- Starters → Auth: starts · Initial auth session is prepared first
- Starters → User data: starts · Session-scoped user data is initialized
- Starters → WebSocket: starts · Socket connections are activated when needed
- Starters → Push notif.: starts · Notification listeners are conditionally enabled
- Starters → Chat: starts · Chat runtime is activated for signed-in users
- Starters → Messages: starts · Thread sync/listen flow is activated
- Starters → Discover: starts · Discovery experience is enabled post-auth
- Starters → Likes: starts · Like lifecycle services are activated
- Starters → Purchases: starts · Monetization services are activated
- Starters → Rewards: starts · Reward timers and claims are activated
- Starters → Settings: starts · Profile/settings flows are made available
- Auth → Storage: reads/writes · Uses secure session storage
- Auth → API: calls · Authenticates against backend services
- Auth → Core services: uses · Depends on shared auth/session utilities
- Discover → API: calls · Loads profiles and saves discovery settings
- Discover → Core services: uses · Uses location and permission utilities
- Likes → Event bus: publishes · Shares like-related state changes
- Chat → WebSocket: listens · Consumes realtime chat events
- Chat → Event bus: subscribes · Coordinates chat UI updates via event bus
- Messages → WebSocket: syncs · Consumes and emits realtime message updates
- Messages → Event bus: publishes · Broadcasts message state changes
- Settings → API: calls · Uploads profile changes and account actions
- Purchases → Core services: uses · Depends on purchase platform services
- Rewards → Core services: uses · Depends on shared infrastructure and timing
- User data → API: loads · Fetches the current user profile/session data
- Chat → Messages: coordinates · Chat list and message threads are connected
- Create user → Auth: follows · Onboarding continues from authenticated/session state