# okunaorg/okuna-app architecture

> Architecture diagram of the GitHub repository okunaorg/okuna-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/okunaorg/okuna-app
- Repository: https://github.com/okunaorg/okuna-app

## Overview

##### Project type and purpose
- This is a cross-platform mobile client (Flutter) for the Okuna social network that consumes a separate “okuna-api” backend.
- It provides UI pages, widget libraries, services to make HTTP calls, native plugins, localization, and platform‐specific Android/iOS code.

##### File structure
- Top-level:
- android/ & ios/ — native project files, Gradle, Xcode, Fastlane, platform plugins (OneSignal, image conversion, share).
- lib/ — main Flutter code, subdivided into pages (UI screens), widgets (reusable UI), models (data classes), services (business logic & HTTP clients), plugins (Dart wrappers around native code), delegates (localization), provider.dart (DI).
- assets/ — fonts, images, i18n message files.
- bin/ — build scripts (locale generation).
- configuration: .env, Pipfile, Makefile, pubspec.yaml.

- Architectural patterns:
- UI layer (pages + widgets)
- Domain/data layer (services + models)
- HTTP client (httpie.dart) to talk to backend
- Localization layer (intl + custom delegates)
- Native bridge layer (plugins)

##### README for additional insights
- Confirms Flutter‐based mobile app
- Depends on external okuna-api server
- Uses flavors (development/production), environment variables (.env.json)
- Integrates OneSignal, Intercom, universal links handlers, push notifications
- Describes locale generation workflow

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        direction TB
        Pages["Pages"]:::presentation
        Widgets["Widgets"]:::presentation
    end

    subgraph "Domain & Business Logic"
        direction TB
        Provider["Dependency Injection (Provider)"]:::domain
        Services["Services"]:::domain
        EnvironmentLoader["Environment Loader"]:::domain
    end

    subgraph "Data & Networking"
        direction TB
        Models["Models"]:::data
        HTTPClient["HTTP Client"]:::data
        Delegates["Localization Delegates"]:::data
        LocaleMessages["Generated Locale Messages"]:::data
        ARBAssets["ARB Localization Assets"]:::data
    end

    subgraph "Platform & Plugins"
        direction TB
        DartPlugins["Plugins (Dart Wrappers)"]:::platform
        AndroidPlugins["Android Plugins"]:::platform
        IOSPlugins["iOS Plugins"]:::platform
        AndroidProject["Android Project"]:::platform
        IOSProject["iOS Project"]:::platform
    end

    subgraph "External Services"
        direction TB
        Backend["okuna-api Backend"]:::external
        Push["Push Services (OneSignal/APNs/FCM)"]:::external
        Intercom["Intercom"]:::external
        DeepLinks["Universal Links/Deep Links"]:::external
    end

    subgraph "CI/CD & Scripts"
        direction TB
        FastlaneAndroid["Fastlane Android"]:::ci
        FastlaneIOS["Fastlane iOS"]:::ci
        LocaleScript["Locale Build Script"]:::ci
    end

    Pages -->|renders| Provider
    Widgets -->|renders| Provider
    Provider -->|injects| Services
    EnvironmentLoader -->|loads env| Services
    Services -->|uses| HTTPClient
    HTTPClient -->|calls REST/JSON| Backend
    Backend -->|returns JSON| Models
    Models -->|data for| Services
    Services -->|provides data| Pages
    Services -->|provides data| Widgets
    ARBAssets -->|loaded by| Delegates
    LocaleMessages -->|used by| Delegates
    Delegates -->|localizes| Pages
    Delegates -->|localizes| Widgets
    DartPlugins -->|calls| AndroidPlugins
    DartPlugins -->|calls| IOSPlugins
    Services -->|uses plugin| DartPlugins
    AndroidProject -->|hosts| AndroidPlugins
    IOSProject -->|hosts| IOSPlugins
    AndroidProject -->|built by| FastlaneAndroid
    IOSProject -->|built by| FastlaneIOS
    LocaleScript -->|generates| LocaleMessages
    DeepLinks -->|handled by| IOSProject
    DeepLinks -->|handled by| AndroidProject
    Push -->|pushes to| IOSProject
    Push -->|pushes to| AndroidProject
    Intercom -->|SDK in| Services

    click Pages "https://github.com/okunaorg/okuna-app/tree/master/lib/pages"
    click Widgets "https://github.com/okunaorg/okuna-app/tree/master/lib/widgets"
    click Models "https://github.com/okunaorg/okuna-app/tree/master/lib/models"
    click Services "https://github.com/okunaorg/okuna-app/tree/master/lib/services"
    click HTTPClient "https://github.com/okunaorg/okuna-app/blob/master/lib/services/httpie.dart"
    click EnvironmentLoader "https://github.com/okunaorg/okuna-app/blob/master/lib/services/environment_loader.dart"
    click Delegates "https://github.com/okunaorg/okuna-app/tree/master/lib/delegates"
    click LocaleMessages "https://github.com/okunaorg/okuna-app/blob/master/lib/locale/messages_all.dart"
    click ARBAssets "https://github.com/okunaorg/okuna-app/tree/master/assets/i18n"
    click Provider "https://github.com/okunaorg/okuna-app/blob/master/lib/provider.dart"
    click DartPlugins "https://github.com/okunaorg/okuna-app/tree/master/lib/plugins"
    click AndroidPlugins "https://github.com/okunaorg/okuna-app/tree/master/android/app/src/main/java/social/openbook/app/plugins"
    click IOSPlugins "https://github.com/okunaorg/okuna-app/blob/master/ios/Runner/ImageConverterPlugin.h"
    click AndroidProject "https://github.com/okunaorg/okuna-app/tree/master/android"
    click IOSProject "https://github.com/okunaorg/okuna-app/tree/master/ios"
    click FastlaneAndroid "https://github.com/okunaorg/okuna-app/tree/master/android/fastlane/Fastfile"
    click FastlaneIOS "https://github.com/okunaorg/okuna-app/tree/master/ios/fastlane/Fastfile"
    click LocaleScript "https://github.com/okunaorg/okuna-app/blob/master/bin/build_locales.dart"

    classDef presentation fill:#D0E8FF,stroke:#0366d6;
    classDef domain fill:#DFF5D8,stroke:#28a745;
    classDef data fill:#FFE5B4,stroke:#f0ad4e;
    classDef platform fill:#E6E6FA,stroke:#6f42c1;
    classDef external fill:#FEE2E2,stroke:#d73a49;
    classDef ci fill:#F0F0F0,stroke:#333333;
```
