How alexandrim0/tentura works
Project Type and Purpose
• Tentura is a social network application “based on MeritRank” with multiple features (auth, beacon, chat, comment, profile, etc.).
• The project targets mobile (Android and iOS), web, and even a widgetbook for design previews, showcasing its multi-platform nature.
• The README emphasizes a build process that involves GraphQL code generation and database schema management, reflecting a robust data layer with both remote (GraphQL API) and local (Drift-driven SQLite) data stores.
Primary Components of the Architecture
a. Presentation Layer
• UI Screens and Widgets: Located in directories such as lib/app, lib/ui, and each feature’s ui folder (for example, lib/features/auth/ui/screen, lib/features/beacon/ui/screen, etc.).
• BLoC/Cubit Modules: Every feature includes a bloc or cubit in its ui/bloc subdirectories (e.g., auth_cubit.dart, beacon_cubit.dart, chat_cubit.dart). These components manage the state transitions and business logic triggered by user interactions.
b. Business Logic / Domain Layer
• Use Cases and Domain Entities: Found under directories like lib/domain and within each feature’s domain folder. These encapsulate the actual business rules and logic.
• Domain Exceptions and Use Case modules: For handling logic errors and executing business workflows.
c. Data Layer
• Repositories: Each feature has its own repository folder (e.g., lib/features/auth/data/repository) to interface with data sources.
• Data Sources: Includes both remote services (GraphQL-based, as evidenced by lib/data/gql and packages/tentura_sdk for API clients) and local storage (such as Drift for local databases located in lib/data/database).
• Service Modules: Additional abstraction layers for API communication (e.g., remote_api_service.dart, local_secure_storage.dart) and specialized modules like image and token services from the tentura_sdk package.
d. Infrastructure and Integration
• Dependency Injection: The directory lib/app/di (with files like di.dart and modules.dart) suggests a centralized mechanism for managing dependencies.
• External Integrations: GraphQL code generation, API clients, and database schema management tools are part of the build process (as directed in the README).
Relationships and Interactions
• User Interaction Flow: The user interacts with the UI layer (screens/widgets). Actions are captured by BLoC/Cubit modules, which are the heart of the business logic.
• Integration with External Services: Show how repository components interact with both remote GraphQL APIs (via the tentura_sdk or internal GraphQL clients) and the local database. Highlight connectors to local (SQLite/Drift) and remote systems.
Emphasizing BLoC/Cubit Modules
• How each feature’s BLoC/Cubit module is structured.
• The events (user actions) being sent to these modules.
• The process of state transformation (e.g., loading, success, error states).
• How these modules interface with the domain layer to fetch or process data.
Additional Elements
• Clear labels for each component.
• External system components such as GraphQL APIs, local secure storage, and database connectors.