How fmoraless/nubbleapp works
Project Type and Purpose
• This is a full-client React Native mobile application (iOS + Android) structured with:
• A Presentation/UI layer (screens, components, routing)
• A Domain/Use-Case layer (business logic, services)
• An Infrastructure layer (API adapters, storage)
• Native device integrations (camera, storage, permissions)
• It consumes a remote REST API and uses local storage (MMKV or AsyncStorage).
File Structure
• Top-level “android” and “ios” folders: native build targets.
• “src” subdivided into:
• api (apiAdapter, configuration, types)
• domain (Auth, Post, PostComment, PostReaction, User – each with adapters, APIs, services, use-cases)
• infra (generic hooks: paginated list, mutation)
• services (permission, cameraRoll, multimedia, authCredentials, storage, toast, etc.)
• routes (navigation stacks, tab bar, router)
• screens (auth, onboarding, app flows)
• components (UI primitives, form inputs, lists, indicators)
• assets, theme, utils, types
• Configuration: metro.config.js, babel.config.js, jest.config.ts, Android/iOS build files.
README for Insights
• Confirms React Native bootstrap with Metro bundler.
• No backend code here—app relies on external API servers.
Defining Main Components
a. Presentation Layer
• App entry (index.js → App.tsx)
• Navigation (Routes → AuthStack, OnboardingStack, AppStack/AppTabNavigator)
• Screens and UI components
b. Domain Layer
• Use-Cases (e.g. useAuthSignIn, usePostList, usePostCreate)
• Domain services/managers (authService, postService, etc.)
c. Infrastructure Layer
• API Adapter / apiConfig (axios or fetch wrapper)
• Storage implementations (MMKV, AsyncStorage)
• Generic React hooks (usePaginatedList, useMutation)
d. Native Device Services
• Camera (react-native-vision-camera), cameraRollService
• Permissions (permissionService)
• Toast provider
e. External Services
• Remote REST API endpoints (Auth API, Posts API, Comments API)
• Third-party native modules (MMKV storage, AsyncStorage)
Mapping Relationships & Data Flow
1. User taps UI → screen component
2. Screen dispatches a domain use-case hook
3. Use-case calls its domain service
4. Service invokes an infrastructure adapter (API or storage)
5. Adapter performs network/storage I/O
6. Response propagates back up (adapter → service → use-case → UI)
7. Navigation events flow between routing components
Architectural Patterns & Principles
• Clean Architecture (separation into layers—UI, domain, infra)
• Dependency Inversion (domain logic depends on abstractions, not on concrete adapters)
• Component-based UI with presentational vs. container patterns
• Hooks for side-effects and data fetching