How invoiceninja/admin-portal works
Project type and purpose
• This is a cross-platform client application (mobile + desktop + web) written in Flutter/Dart.
• It implements a Redux-based unidirectional data-flow architecture and communicates with the Invoice Ninja backend via RESTful APIs.
File structure
• Top-level “android”, “ios”, “linux”, “macos”, “windows”, “web” folders: native runners generated by Flutter.
• “lib/” contains the Dart code, split into four main packages:
• data/ → models, repositories, file storage & WebClient
• redux/ → actions, middleware, reducers, selectors, immutable app state
• ui/ → Flutter widgets & view-models for every feature (auth, invoices, clients, etc.)
• utils/ → shared utilities (i18n, formatting, OAuth stubs, code generation helpers)
• Configuration & build scripts: GitHub Actions (.github/workflows), Codemagic, Fastlane, Snapcraft, Flatpak manifests.
README for additional insights
• Confirms the layers (data, redux, ui, utils) and reliance on flutter_redux_starter.
• Mentions build_runner code generation for JSON-serializable models.
• Provides testing scripts (flutter drive) and CI pipelines.
Main components
a. Client Platforms (Android, iOS, Web, Windows, macOS, Linux)
• Each platform runs the same Flutter engine + Dart VM + native host.
b. App Layers within each client
• UI Layer (Widgets / Screens under lib/ui)
• State Management Layer (Redux Store: actions → middleware → reducers → app state; selectors read state)
• Data Layer (Repositories + WebClient + FileStorage)
c. External Backend Service
• Invoice Ninja REST API (hosted separately)
• Authentication endpoint, entity endpoints (invoices, clients, payments…), static data endpoints
d. Local Persistence
• FileStorage writes/reads local cache or credentials (lib/data/file_storage.dart)
e. Build & CI/CD
• Code Generation (build_runner → model.g.dart files)
• GitHub Actions, Codemagic, Fastlane, Snapcraft, Flatpak pipelines
Relationships & data flows
1) User interacts with UI Widget → dispatches a Redux Action
2) Action passes through Middleware → calls Data Repository
3) Repository uses WebClient → issues HTTP request to Backend API
4) Backend responds → repository returns data to Middleware
5) Middleware dispatches success/failure Action → Reducer updates App State
6) UI Layer subscribes via Selectors → rebuilds Widgets with new State
7) For offline or caching scenarios → FileStorage reads/writes locally
Architectural patterns & design principles
• Unidirectional data flow (Redux)
• Separation of concerns: UI, state, data, model layers
• Code generation for boilerplate model serializers
• Platform-agnostic business logic, single codebase → multiple targets