-
Notifications
You must be signed in to change notification settings - Fork 1
System Overview
fulleni edited this page Jan 18, 2026
·
1 revision
The API Server follows a strict Layered Architecture to ensure separation of concerns, testability, and code reuse across the Flutter ecosystem.
We use a Singleton pattern via AppDependencies (lib/src/config/app_dependencies.dart) to manage the lifecycle of all services.
- Initialization: Database connections and external clients are initialized once at startup.
-
Access: Handlers access repositories via
context.read<Repository>()(provided by Dart Frog middleware).
- Responsibility: Request parsing, validation, and response formatting.
- Logic: Minimal. Delegates immediately to Services or Repositories.
- Framework: Dart Frog.
- Responsibility: Business logic that spans multiple data sources or requires orchestration.
-
Examples:
-
AuthService: Coordinates User Repo, Token Service, and Email Service. -
RewardsService: Coordinates User Rewards Repo, Idempotency Service, and AdMob Verifier. -
AnalyticsSyncService: Orchestrates the ETL process between external providers and internal DB.
-
- Responsibility: Abstract data access. It provides a clean API for the application to interact with data, hiding the details of storage.
- Pattern: The API consumes the same shared repository package as the Flutter Mobile App. This ensures that business logic (like "how to fetch a headline") is consistent across platforms.
- Responsibility: Low-level database interactions.
-
Implementation: Uses
mongo_dartto interact with the MongoDB database. -
Key Feature: Handles the translation between Dart's
String idand MongoDB'sObjectId _id.
- Responsibility: Holds the "Source of Truth" for data models, enums, and exceptions.
- Usage: Used by the API, the Mobile App, and the Web Dashboard to ensure they all speak the same language.
For comprehensive details regarding licensing, including trial and commercial options for the entire toolkit, please refer to the toolkit organization page.