# yahiachokri928-hash/sokna architecture

> Architecture diagram of the GitHub repository yahiachokri928-hash/sokna, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yahiachokri928-hash/sokna
- Repository: https://github.com/yahiachokri928-hash/sokna

## Overview

Sokna is a Flutter rental-listing app for Tunisia: renters browse and filter homes, inspect details and reviews, and save favorites; authenticated owners can publish and manage listings. The README describes authentication and profile flows, guest access gates, and hybrid cloud/local persistence. The graph follows documented feature responsibilities and relationships; Dart implementation excerpts were not provided, so internal call paths are limited to those stated in the README. The README also describes offline and cloud variants, so its REST/local fallback and Firestore capabilities may not all coexist in this checkout.

Main entry points: [`lib/features/listings/data/datasources/listing_data_source.dart`](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/data/datasources/listing_data_source.dart) (Listing data access), [`lib/features/listings/presentation/blocs/listings/listings_bloc.dart`](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/blocs/listings/listings_bloc.dart) (Listing state), [`lib/features/listings/presentation/screens/home_screen.dart`](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/home_screen.dart) (Home catalogue), [`lib/features/listings/presentation/screens/listing_detail_screen.dart`](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/listing_detail_screen.dart) (Listing details)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["App experience"]
  node_app["App entry<br/>[main.dart]"]
  node_navigation["App navigation<br/>[app_router.dart]"]
  node_home["Home catalogue<br/>[home_screen.dart]"]
  node_search["Search and filters<br/>[search_screen.dart]"]
  node_detail["Listing details"]
end

subgraph group_identity["Identity and access"]
  node_auth["Sign-in and registration<br/>[login_screen.dart]"]
  node_profile["User profile"]
  node_authbloc["Authentication state<br/>[auth_bloc.dart]"]
  node_authusecases["Account operations"]
end

subgraph group_rental["Rental marketplace"]
  node_listingstate["Listing state<br/>[listings_bloc.dart]"]
  node_listingdata["Listing data access"]
  node_listingrepo["Listing repository"]
  node_posting["Publish listing"]
  node_reviews["Reviews and ratings<br/>[reviews_bloc.dart]"]
  node_favorites["Saved listings"]
  node_favoriterepo["Favorites repository"]
end

subgraph group_persistence["Persistence and services"]
  node_firestore[("Cloud Firestore")]
  node_firebaseauth["Firebase Auth"]
  node_localcache[("Local preferences")]
  node_cloudservice["Firestore service"]
  node_restcatalog["Remote JSON catalogue<br/>[listings.json]"]
end

node_person(("Renter or owner"))

node_person -->|"opens"| node_app
node_app -->|"starts navigation"| node_navigation
node_navigation -->|"routes to"| node_home
node_person -->|"filters homes"| node_search
node_home -->|"loads catalogue"| node_listingstate
node_search -->|"requests search"| node_listingstate
node_listingstate -.->|"requests listings"| node_listingrepo
node_listingrepo -.->|"uses data source"| node_listingdata
node_listingdata -.->|"reads listings"| node_cloudservice
node_cloudservice -->|"reads and writes"| node_firestore
node_listingdata -.->|"fallback catalogue"| node_restcatalog
node_home -->|"opens listing"| node_detail
node_detail -->|"shows and submits"| node_reviews
node_reviews -.->|"stores reviews"| node_firestore
node_detail -->|"toggles saved"| node_favorites
node_favorites -.->|"updates favorites"| node_favoriterepo
node_favoriterepo -.->|"syncs IDs"| node_firestore
node_favoriterepo -.->|"mirrors locally"| node_localcache
node_person -->|"signs in"| node_auth
node_auth -.->|"submits credentials"| node_authbloc
node_authbloc -.->|"runs account actions"| node_authusecases
node_authusecases -.->|"authenticates"| node_firebaseauth
node_profile -.->|"updates profile"| node_authbloc
node_person -->|"publishes listing"| node_posting
node_posting -.->|"submits listing"| node_listingstate
node_listingdata -.->|"creates or deletes"| node_firestore

click node_app "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/main.dart"
click node_navigation "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/core/router/app_router.dart"
click node_home "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/home_screen.dart"
click node_search "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/search_screen.dart"
click node_detail "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/listing_detail_screen.dart"
click node_auth "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/auth/presentation/screens/login_screen.dart"
click node_profile "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/auth/presentation/screens/profile_screen.dart"
click node_authbloc "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/auth/presentation/blocs/auth/auth_bloc.dart"
click node_authusecases "https://github.com/yahiachokri928-hash/sokna/tree/main/lib/features/auth/domain/usecases"
click node_listingstate "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/blocs/listings/listings_bloc.dart"
click node_listingdata "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/data/datasources/listing_data_source.dart"
click node_listingrepo "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/data/repositories/listing_repository_impl.dart"
click node_posting "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/post_listing_screen.dart"
click node_reviews "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/blocs/reviews/reviews_bloc.dart"
click node_favorites "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/favorites/presentation/blocs/saved_listings/saved_listings_bloc.dart"
click node_favoriterepo "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/favorites/data/repositories/favorites_repository_impl.dart"
click node_localcache "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/favorites/data/datasources/favorites_local_data_source.dart"
click node_cloudservice "https://github.com/yahiachokri928-hash/sokna/blob/main/lib/core/firebase/firestore_service.dart"
click node_restcatalog "https://github.com/yahiachokri928-hash/sokna/blob/main/assets/data/listings.json"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_navigation,node_home,node_search,node_detail toneBlue
class node_auth,node_profile,node_authbloc,node_authusecases toneAmber
class node_listingstate,node_listingdata,node_listingrepo,node_posting,node_reviews,node_favorites,node_favoriterepo toneMint
class node_firestore,node_firebaseauth,node_localcache,node_cloudservice,node_restcatalog toneRose
class node_person toneIndigo
```

## Components

### App experience

- [App entry](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/main.dart): `lib/main.dart`
- [App navigation](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/core/router/app_router.dart): `lib/core/router/app_router.dart`
- [Home catalogue](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/home_screen.dart): `lib/features/listings/presentation/screens/home_screen.dart`
- [Search and filters](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/search_screen.dart): `lib/features/listings/presentation/screens/search_screen.dart`
- [Listing details](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/listing_detail_screen.dart): `lib/features/listings/presentation/screens/listing_detail_screen.dart`

### Identity and access

- [Sign-in and registration](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/auth/presentation/screens/login_screen.dart): `lib/features/auth/presentation/screens/login_screen.dart`
- [User profile](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/auth/presentation/screens/profile_screen.dart): `lib/features/auth/presentation/screens/profile_screen.dart`
- [Authentication state](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/auth/presentation/blocs/auth/auth_bloc.dart): `lib/features/auth/presentation/blocs/auth/auth_bloc.dart`
- [Account operations](https://github.com/yahiachokri928-hash/sokna/tree/main/lib/features/auth/domain/usecases): `lib/features/auth/domain/usecases`

### Rental marketplace

- [Listing state](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/blocs/listings/listings_bloc.dart): `lib/features/listings/presentation/blocs/listings/listings_bloc.dart`
- [Listing data access](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/data/datasources/listing_data_source.dart): `lib/features/listings/data/datasources/listing_data_source.dart`
- [Listing repository](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/data/repositories/listing_repository_impl.dart): `lib/features/listings/data/repositories/listing_repository_impl.dart`
- [Publish listing](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/screens/post_listing_screen.dart): `lib/features/listings/presentation/screens/post_listing_screen.dart`
- [Reviews and ratings](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/listings/presentation/blocs/reviews/reviews_bloc.dart): `lib/features/listings/presentation/blocs/reviews/reviews_bloc.dart`
- [Saved listings](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/favorites/presentation/blocs/saved_listings/saved_listings_bloc.dart): `lib/features/favorites/presentation/blocs/saved_listings/saved_listings_bloc.dart`
- [Favorites repository](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/favorites/data/repositories/favorites_repository_impl.dart): `lib/features/favorites/data/repositories/favorites_repository_impl.dart`

### Persistence and services

- **Cloud Firestore**
- **Firebase Auth**
- [Local preferences](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/features/favorites/data/datasources/favorites_local_data_source.dart): `lib/features/favorites/data/datasources/favorites_local_data_source.dart`
- [Firestore service](https://github.com/yahiachokri928-hash/sokna/blob/main/lib/core/firebase/firestore_service.dart): `lib/core/firebase/firestore_service.dart`
- [Remote JSON catalogue](https://github.com/yahiachokri928-hash/sokna/blob/main/assets/data/listings.json): `assets/data/listings.json`

### Other components

- **Renter or owner**

## Connections

- Renter or owner → App entry: opens (evidence: `README.md`)
- App entry → App navigation: starts navigation
- App navigation → Home catalogue: routes to (evidence: `README.md`)
- Renter or owner → Search and filters: filters homes (evidence: `README.md`)
- Home catalogue → Listing state: loads catalogue (evidence: `README.md`)
- Search and filters → Listing state: requests search (evidence: `README.md`)
- Listing state → Listing repository: requests listings
- Listing repository → Listing data access: uses data source
- Listing data access → Firestore service: reads listings (evidence: `README.md`)
- Firestore service → Cloud Firestore: reads and writes (evidence: `README.md`)
- Listing data access → Remote JSON catalogue: fallback catalogue (evidence: `README.md`)
- Home catalogue → Listing details: opens listing (evidence: `README.md`)
- Listing details → Reviews and ratings: shows and submits (evidence: `README.md`)
- Reviews and ratings → Cloud Firestore: stores reviews (evidence: `README.md`)
- Listing details → Saved listings: toggles saved (evidence: `README.md`)
- Saved listings → Favorites repository: updates favorites
- Favorites repository → Cloud Firestore: syncs IDs (evidence: `README.md`)
- Favorites repository → Local preferences: mirrors locally (evidence: `README.md`)
- Renter or owner → Sign-in and registration: signs in (evidence: `README.md`)
- Sign-in and registration → Authentication state: submits credentials
- Authentication state → Account operations: runs account actions
- Account operations → Firebase Auth: authenticates (evidence: `README.md`)
- User profile → Authentication state: updates profile (evidence: `README.md`)
- Renter or owner → Publish listing: publishes listing (evidence: `README.md`)
- Publish listing → Listing state: submits listing
- Listing data access → Cloud Firestore: creates or deletes (evidence: `README.md`)
