# raghu-alekya/pinaka_restaurant_pos architecture

> Architecture diagram of the GitHub repository raghu-alekya/pinaka_restaurant_pos, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/raghu-alekya/pinaka_restaurant_pos
- Repository: https://github.com/raghu-alekya/pinaka_restaurant_pos

## Overview

##### Project Type and Purpose
- This is a cross-platform (Android, iOS, Linux, macOS, Windows, Web) Flutter application named “pinaka_restaurant_pos,” serving as a point-of-sale (POS) system for a restaurant.
- The README confirms it’s a standard Flutter starter project, but the file tree shows it implements UI screens for table management, check-in, reservations, attendance, and local data persistence.

##### File Structure Analysis
- Top-level platform folders (android, ios, linux, macos, windows, web) hold Flutter engine integration.
- `lib/` contains the app’s Dart code, organized into:
- App flow / UI layers (`lib/App flow/ui`, `lib/App flow/widgets`)
- State management with BLoC (`lib/blocs` → events, logic, state)
- Data layer: local database DAOs (`lib/local database`), database helper/init
- Repositories (`lib/repositories`) abstract data sources
- Models (`lib/models`) define domain objects
- Utilities (`lib/utils`) for session, logging, monitoring
- Constants (`lib/constants`)
- Entrypoint (`lib/main.dart`)
- Configuration files: `pubspec.yaml`, Android/iOS build files, CMakeLists for desktop.

##### Key Architectural Patterns
- Layered architecture separating Presentation (UI) → Business Logic (BLoC) → Data Access (Repositories → DAOs → SQLite)
- BLoC pattern for unidirectional data flow: UI emits Events → BLoC processes → yields States → UI reacts.
- Repository pattern abstracts local or remote data sources.
- DAO + DatabaseHelper pattern for local persistence (likely SQLite).

##### Main Components and Their Interactions
a. Presentation Layer
- Flutter Widgets and Screens under `lib/App flow/ui` and `widgets`
- Navigation managed via `global_navigator.dart` and top-bar / bottom nav widgets
b. State Management Layer
- BLoCs in `lib/blocs/Bloc Logic`
- Events (`Bloc Event/*`), States (`Bloc State/*`)
- UI dispatches Events → BLoC emits new States
c. Data Layer
- Repositories (`lib/repositories/*`) hide data-source details
- Local Database: DAOs (`lib/local database/*`), `database_helper.dart`, `db_init.dart`
- Models (`lib/models/*`) represent entities passed through layers
d. Utilities
e. Platform Integration

[UI Layer] → [BLoC Layer] → [Repository Layer] → [Local Database]
- UI Layer: Screens (e.g., ManagerDashboard, TablesScreen, CheckinPopup), Widgets, NavigationHelper
- BLoC Layer: AuthBloc, TableBloc, ZoneBloc, AttendanceBloc, CheckinBloc
- Repository Layer: auth_repository, table_repository, zone_repository, etc.
- Local Database: DAOs (ShiftDao, TableDao, AreaDao, LoginDao), DatabaseHelper, DB Init
- UI → dispatch Event → BLoC
- BLoC → call → Repository
- Repository → call → DAO / (optional external API)
- DAO → CRUD → SQLite DB
- BLoC → emit State → UI
- Step 4: Add cross-cutting utilities:
- SessionManager and ShiftMonitor as side-services called by BLoC or Repositories
- logger injected wherever needed

## Diagram (Mermaid)

```mermaid
graph TB
    %% Presentation Layer
    subgraph "Presentation Layer" 
        direction TB
        MDS["ManagerDashboardScreen"]:::ui
        TS["TablesScreen"]:::ui
        CP["CheckinPopup"]:::ui
        DAS["DailyAttendanceScreen"]:::ui
        KSS["KitchenStatusScreen"]:::ui
        CRS["CreateReservationScreen"]:::ui
        ELP["EmployeeLoginPage"]:::ui
        GDP["GuestDetailsPopup"]:::ui
        RLS["ReservationListScreen"]:::ui
        SS["SplashScreen"]:::ui
        NH["NavigationHelper"]:::ui
        GN["GlobalNavigator"]:::ui
    end

    %% BLoC Layer
    subgraph "BLoC Layer"
        direction TB
        AB["AuthBloc"]:::bloc
        TBc["TableBloc"]:::bloc
        ZB["ZoneBloc"]:::bloc
        CB["CheckinBloc"]:::bloc
        AtB["AttendanceBloc"]:::bloc
    end

    %% Repository Layer
    subgraph "Repository Layer"
        direction TB
        AR["AuthRepository"]:::repo
        TR["TableRepository"]:::repo
        ZR["ZoneRepository"]:::repo
        CR["CheckinRepository"]:::repo
        RSR["ReservationRepository"]:::repo
        ER["EmployeeRepository"]:::repo
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        DBH["DatabaseHelper"]:::data
        DBI["DB Init"]:::data
        ShD["ShiftDao"]:::data
        TaD["TableDao"]:::data
        AD["AreaDao"]:::data
        LD["LoginDao"]:::data
    end

    %% Database
    subgraph "Local Database"
        direction TB
        SQLite[(SQLite DB)]:::db
    end

    %% Utilities
    subgraph "Utilities"
        direction TB
        SM["SessionManager"]:::util
        SMo["ShiftMonitor"]:::util
        LG["Logger"]:::util
        TSC["TableStatusColors"]:::util
    end

    %% Constants and Entrypoint
    C["Constants"]:::const
    EN["main.dart"]:::entry

    %% Connections
    subgraph "Data Flow"
        direction TB
        %% UI to BLoC
        MDS -->|"Emit Event"| TBc
        TS -->|"Emit Event"| TBc
        CP -->|"Emit Event"| CB
        DAS -->|"Emit Event"| AtB
        KSS -->|"Emit Event"| ZB
        CRS -->|"Emit Event"| RSR
        ELP -->|"Emit Event"| AB
        GDP -->|"Emit Event"| CB
        RLS -->|"Emit Event"| RSR
        SS -->|"Emit Event"| AB
        NH -->|"Navigate"| MDS
        GN -->|"Navigate"| TS

        %% BLoC to Repo
        AB -->|"call"| AR
        TBc -->|"call"| TR
        ZB -->|"call"| ZR
        CB -->|"call"| CR
        AtB -->|"call"| ER
        AtB -->|"call"| RSR

        %% Repo to DAO
        AR -->|"query"| LD
        TR -->|"query"| TaD
        ZR -->|"query"| AD
        CR -->|"query"| ShD
        RSR -->|"query"| ShD
        ER -->|"query"| LD

        %% DAO to DB
        LD -->|"CRUD"| SQLite
        TaD -->|"CRUD"| SQLite
        AD -->|"CRUD"| SQLite
        ShD -->|"CRUD"| SQLite
        DBH -->|"init/setup"| SQLite
        DBI -->|"init"| DBH

        %% BLoC to UI
        AB -->|"Return State"| ELP
        TBc -->|"Return State"| TS
        CB -->|"Return State"| CP
        AtB -->|"Return State"| DAS

        %% Utilities usage
        SM -->|inject| AB
        SMo -->|monitor| AtB
        LG -->|log| AR
        TSC -->|style| TS

        %% Entrypoint & Constants
        EN -->|start| SS
        EN -->|import| C
    end

    %% Click Events
    click MDS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/ManagerDashboardScreen.dart"
    click TS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/tables_screen.dart"
    click CP "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/CheckinPopup.dart"
    click DAS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/DailyAttendanceScreen.dart"
    click KSS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/KitchenStatusScreen.dart"
    click CRS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/create_reservation_screen.dart"
    click ELP "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/employee_login_page.dart"
    click GDP "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/guest_details_popup.dart"
    click RLS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/reservation_list_screen.dart"
    click SS "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/ui/splash_screen.dart"
    click NH "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/App flow/widgets/NavigationHelper.dart"
    click AB "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/blocs/Bloc Logic/auth_bloc.dart"
    click TBc "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/blocs/Bloc Logic/table_bloc.dart"
    click ZB "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/blocs/Bloc Logic/zone_bloc.dart"
    click CB "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/blocs/Bloc Logic/checkin_bloc.dart"
    click AtB "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/blocs/Bloc Logic/attendance_bloc.dart"
    click AR "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/repositories/auth_repository.dart"
    click TR "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/repositories/table_repository.dart"
    click ZR "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/repositories/zone_repository.dart"
    click CR "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/repositories/checkin_repository.dart"
    click RSR "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/repositories/ReservationRepository.dart"
    click ER "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/repositories/employee_repository.dart"
    click DBH "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/local database/database_helper.dart"
    click DBI "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/local database/db_init.dart"
    click ShD "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/local database/ShiftDao.dart"
    click TaD "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/local database/table_dao.dart"
    click AD "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/local database/area_dao.dart"
    click LD "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/local database/login_dao.dart"
    click C "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/constants/constants.dart"
    click EN "https://github.com/raghu-alekya/pinaka_restaurant_pos/blob/main/lib/main.dart"

    %% Styles
    classDef ui fill:#D6EAF8,stroke:#21618C,color:#1B4F72
    classDef bloc fill:#D5F5E3,stroke:#27AE60,color:#145A32
    classDef repo fill:#FCF3CF,stroke:#F4D03F,color:#7D6608
    classDef data fill:#FADBD8,stroke:#E74C3C,color:#641E16
    classDef db fill:#E5E8E8,stroke:#ABB2B9,color:#566573
    classDef util fill:#FDEDEC,stroke:#C0392B,color:#78281F
    classDef const fill:#EBDEF0,stroke:#8E44AD,color:#4A235A
    classDef entry fill:#D0ECE7,stroke:#117864,color:#0E6251
```
