How defifundr-labs/defifundr_mobile works
Project type and purpose
• DefiFundr is a Flutter-based mobile client implementing a decentralised payroll and invoice management system.
• It follows a Clean (V.I.P.E.R-inspired) architecture: each feature is broken into Presentation, Domain, and Data layers.
File structure
• Top-level Flutter platforms: android/, ios/, linux/, macos/, web/
• Core engine: lib/ with subfolders:
• app/ → root widget (app.dart)
• core/ → configuration, constants, theming, localization, routing
• infrastructure → DI container, BLoC provider
• modules/ → feature folders (authentication, finance, expenses, invoice, kyc, onboarding, pay_cycle, payment, quickpay, time_off, time_tracking, web3auth) each with data/, domain/, presentation/
• shared/ → generic widgets
• Testing: test/, integration_test/
• Build & code-gen scripts: Makefile, pubspec.yaml, build_runner commands.
Insights from the README
• Confirms Clean Architecture, use of code generation (freezed, json_serializable), DI via injection_container.dart.
• No backend code here: app consumes remote datasources (APIs, Web3Auth) and local storage.
a. Main components
• Presentation Layer (UI)
• Flutter screens & widgets (modules/…/presentation)
• BLoC/Cubit classes for state management
• Domain Layer
• UseCases (modules/…/domain/usecase)
• Entities & Repository interfaces
• Data Layer
• Repository implementations (modules/…/data/repository)
• DataSources:
– Remote (HTTP/Web3Auth services, blockchain clients)
– Local (secure storage, shared preferences)
• Core & Infrastructure
• Dependency Injection (injection_container.dart)
• Routing (routers.dart, route_guards)
• Theming, Localization, Constants
• Platform Adapters
• Android (MainActivity.kt)
• iOS (AppDelegate.swift)
• Web, Linux, macOS plugin registrants
• External Services
• Web3Auth Service & blockchain networks
• RESTful backend APIs
• Local persistence (SQLite/secure storage)
b. Relationships & interactions
1. User taps UI widget → triggers BLoC event
2. BLoC invokes Domain UseCase
3. UseCase calls Repository interface
4. Repository implementation delegates to DataSources
5. RemoteDataSource issues HTTP/Web3Auth calls or blockchain transactions
6. LocalDataSource reads/writes secure cache
7. Results propagate back up to UI via BLoC state
8. DI container wires BLoCs, UseCases, Repositories, DataSources at startup (main.dart → injection_container)
c. Architectural patterns & design principles
• Layered Clean Architecture (strict dependency rule: Presentation → Domain → Data)
• Feature-based modularization (each module self-contained)
• Dependency Injection via GetIt (injection_container.dart)
• State management: BLoC/Cubit
• Code generation: freezed, json_serializable, auto_route (routers.gr.dart)
• Platform abstraction via Flutter plugins
d. Key technologies & libraries
• Flutter & Dart
• flutter_bloc
• get_it (DI)
• auto_route (navigation)
• freezed & build_runner (data classes)
• web3auth_sdk & custom blockchain clients
• shared_preferences / secure_storage