# susantp/udhaarokhata architecture

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

- Interactive diagram: https://gitdiagram.com/susantp/udhaarokhata
- Repository: https://github.com/susantp/udhaarokhata

## Overview

##### Project type and purpose
- This is a cross-platform mobile application built with Expo (React Native).
- Purpose: Allow users to create and view “creditors” and “transactions” on their device, persisting data locally via SQLite (managed through Drizzle ORM).

##### File structure
- app/ directory: file-based routing using the Expo Router, split into two tab groups: creditors and transactions, each with list and create screens.
- components/: shared UI building blocks, subdivided into common (buttons, dialogs, renderers) and ui (platform-specific/tab bar).
- hooks/: custom React hooks for creating creditors and transactions (data-access layer).
- db/ & drizzle.config.ts: database schema (db/schema.ts), enum definitions, and Drizzle configuration plus migration scripts.
- assets/: fonts and images used by the UI.
- global.css & tailwind.config.js: styling setup (NativeWind/Tailwind).

##### README for additional insights
- Confirms Expo + file-based routing.
- No external backend—data is stored locally.

##### Final advice
- Migrations as a pre-startup step before ORM uses the DB.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User Interaction
    User["User"]:::external
    User -->|taps tab| Router

    %% Navigation Layer
    subgraph "Navigation Layer"
        Router["Expo Router"]:::frontend
        TabsRoot["Root Tabs (app/(tabs)/index.tsx)"]:::frontend
        CreditorsLayout["Creditors Layout"]:::frontend
        TransactionsLayout["Transactions Layout"]:::frontend
    end

    Router --> TabsRoot
    TabsRoot --> CreditorsLayout
    TabsRoot --> TransactionsLayout

    %% Screens
    subgraph "Screens"
        CRList["Creditors List Screen"]:::frontend
        CRCreate["Create Creditor Screen"]:::frontend
        TRList["Transactions List Screen"]:::frontend
        TRCreate["Create Transaction Screen"]:::frontend
        NotFound["Not Found Screen"]:::frontend
    end

    CreditorsLayout --> CRList
    CreditorsLayout --> CRCreate
    TransactionsLayout --> TRList
    TransactionsLayout --> TRCreate
    Router --> NotFound

    %% UI Components
    subgraph "UI Components"
        AddCRBtn["AddCreditorBtn"]:::component
        AddTRBtn["AddTransactionBtn"]:::component
        ConfirmDialog["ConfirmDialog"]:::component
        ContentWrapper["ContentWrapper"]:::component
        CreditorView["CreditorRenderView"]:::component
        TransactionView["TransactionRenderView"]:::component
        ScreenHeader["ScreenHeader"]:::component
        SafeArea["SafeAreaWrapper"]:::component
        IconIOS["IconSymbol.ios"]:::component
        TabBarBG["TabBarBackground"]:::component
        TabBarBGiOS["TabBarBackground.ios"]:::component
    end

    CRList -->|renders| CreditorView
    CRList -->|uses| ScreenHeader
    CRCreate -->|renders| ContentWrapper
    CRCreate -->|uses| AddCRBtn
    TRList -->|renders| TransactionView
    TRList -->|uses| ScreenHeader
    TRCreate -->|renders| ContentWrapper
    TRCreate -->|uses| AddTRBtn
    allScreens --> SafeArea

    %% Business Logic Layer
    subgraph "Business Logic (Hooks)"
        createCR["useCreateCreditorHook"]:::logic
        createTR["useCreateTransactionHook"]:::logic
    end

    CRCreate -->|on submit| createCR
    TRCreate -->|on submit| createTR
    CRList -->|fetch data| createCR
    TRList -->|fetch data| createTR

    %% Data Access Layer
    subgraph "Drizzle ORM & Migrations"
        DrizzleCfg["drizzle.config.ts"]:::data
        Schema["db/schema.ts & db/columnEnums.ts"]:::data
        Migrations["migrations & meta"]:::data
    end

    createCR -->|calls ORM| DrizzleCfg
    createTR -->|calls ORM| DrizzleCfg
    Schema --> DrizzleCfg
    Migrations --> DrizzleCfg

    %% Database
    SQLite["SQLite Database"]:::data

    DrizzleCfg -->|runs migrations| SQLite
    SQLite -->|returns data| DrizzleCfg

    DrizzleCfg -->|provides data| createCR
    DrizzleCfg -->|provides data| createTR

    %% Assets & Configuration
    subgraph "Assets & Styling"
        Fonts["assets/fonts"]:::assets
        Images["assets/images"]:::assets
        GlobalCSS["global.css"]:::config
        TailwindCfg["tailwind.config.js"]:::config
        NativewindEnv["nativewind-env.d.ts"]:::config
        ColorsConst["constants/Colors.ts"]:::config
        TypesDef["types/index.d.ts"]:::config
        Lang["lang/lang.ts"]:::config
    end

    %% Click Events
    click MobileApp "https://github.com/susantp/udhaarokhata/blob/main/app.json"
    click MobileApp "https://github.com/susantp/udhaarokhata/blob/main/babel.config.js"
    click MobileApp "https://github.com/susantp/udhaarokhata/blob/main/metro.config.js"
    click Router "https://github.com/susantp/udhaarokhata/blob/main/app/_layout.tsx"
    click TabsRoot "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/index.tsx"
    click CreditorsLayout "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/creditors/_layout.tsx"
    click TransactionsLayout "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/transactions/_layout.tsx"
    click CRList "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/creditors/index.tsx"
    click CRCreate "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/creditors/create.tsx"
    click TRList "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/transactions/index.tsx"
    click TRCreate "https://github.com/susantp/udhaarokhata/blob/main/app/(tabs)/transactions/create.tsx"
    click NotFound "https://github.com/susantp/udhaarokhata/blob/main/app/+not-found.tsx"
    click AddCRBtn "https://github.com/susantp/udhaarokhata/blob/main/components/common/AddCreditorBtn.tsx"
    click AddTRBtn "https://github.com/susantp/udhaarokhata/blob/main/components/common/AddTransactionBtn.tsx"
    click ConfirmDialog "https://github.com/susantp/udhaarokhata/blob/main/components/common/ConfirmDialog.tsx"
    click ContentWrapper "https://github.com/susantp/udhaarokhata/blob/main/components/common/ContentWrapper.tsx"
    click CreditorView "https://github.com/susantp/udhaarokhata/blob/main/components/common/CreditorRenderView.tsx"
    click TransactionView "https://github.com/susantp/udhaarokhata/blob/main/components/common/TransactionRenderView.tsx"
    click ScreenHeader "https://github.com/susantp/udhaarokhata/blob/main/components/common/ScreenHeader.tsx"
    click SafeArea "https://github.com/susantp/udhaarokhata/blob/main/components/common/SafeAreaWrapper.tsx"
    click IconIOS "https://github.com/susantp/udhaarokhata/blob/main/components/ui/IconSymbol.ios.tsx"
    click TabBarBG "https://github.com/susantp/udhaarokhata/blob/main/components/ui/TabBarBackground.tsx"
    click TabBarBGiOS "https://github.com/susantp/udhaarokhata/blob/main/components/ui/TabBarBackground.ios.tsx"
    click createCR "https://github.com/susantp/udhaarokhata/blob/main/hooks/useCreateCreditorHook.tsx"
    click createTR "https://github.com/susantp/udhaarokhata/blob/main/hooks/useCreateTransactionHook.tsx"
    click Schema "https://github.com/susantp/udhaarokhata/blob/main/db/schema.ts"
    click Schema "https://github.com/susantp/udhaarokhata/blob/main/db/columnEnums.ts"
    click DrizzleCfg "https://github.com/susantp/udhaarokhata/blob/main/drizzle.config.ts"
    click Migrations "https://github.com/susantp/udhaarokhata/blob/main/drizzle/0000_youthful_enchantress.sql"
    click Migrations "https://github.com/susantp/udhaarokhata/blob/main/drizzle/meta/0000_snapshot.json"
    click Migrations "https://github.com/susantp/udhaarokhata/blob/main/drizzle/meta/_journal.json"
    click Migrations "https://github.com/susantp/udhaarokhata/blob/main/drizzle/migrations.js"
    click Fonts "https://github.com/susantp/udhaarokhata/tree/main/assets/fonts/"
    click Images "https://github.com/susantp/udhaarokhata/tree/main/assets/images/"
    click GlobalCSS "https://github.com/susantp/udhaarokhata/blob/main/global.css"
    click TailwindCfg "https://github.com/susantp/udhaarokhata/blob/main/tailwind.config.js"
    click NativewindEnv "https://github.com/susantp/udhaarokhata/blob/main/nativewind-env.d.ts"
    click ColorsConst "https://github.com/susantp/udhaarokhata/blob/main/constants/Colors.ts"
    click TypesDef "https://github.com/susantp/udhaarokhata/blob/main/types/index.d.ts"
    click Lang "https://github.com/susantp/udhaarokhata/blob/main/lang/lang.ts"

    %% Styles
    classDef external fill:#f2f2f2,stroke:#999,stroke-width:1px
    classDef frontend fill:#D6EAF8,stroke:#3498DB,stroke-width:2px
    classDef component fill:#FCF3CF,stroke:#F1C40F,stroke-width:2px
    classDef logic fill:#FCF3CF,stroke:#F39C12,stroke-width:2px
    classDef data fill:#FADBD8,stroke:#E74C3C,stroke-width:2px
    classDef config fill:#D5F5E3,stroke:#27AE60,stroke-width:2px
    classDef assets fill:#E8DAEF,stroke:#9B59B6,stroke-width:2px
```
