# ubeydeozdmr/grabsnap architecture

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

- Interactive diagram: https://gitdiagram.com/ubeydeozdmr/grabsnap
- Repository: https://github.com/ubeydeozdmr/grabsnap

## Overview

##### Project type and purpose
- GrabSnap is a cross-platform (iOS & Android) mobile application built with React Native and TypeScript.
- It’s a front-end centric, design-driven project for buying and selling second-hand cars. The backend is implied by local JSON “data” files and an `api` abstraction but not packaged here.

##### File structure
- Top-level entry points:
- App.tsx – main root component
- index.ts – app bootstrap
- app.json / eas.json – Expo configuration
- Presentation layer:
- screens/ – each “page” or view in the app (Home, Filter, CarDetails, authentication flows under screens/auth)
- components/ – reusable UI widgets (Card, FormButton, Tile, etc.)
- State & business logic:
- context/ – React Context providers (AuthContext, UserContext) implementing authentication state, user data
- Data layer:
- api/ – abstraction over data calls (data.ts, utils.ts)
- data/ – static JSON files emulating persistence (cars.json, users.json, makes/models)
- Utilities & styling:
- utils/ – helper functions (normalize, validation)
- Tests:
- __tests__/ – unit tests for data utilities

##### README
- Confirms front-end oriented, design centric, uses Context API for authentication, shaped by Figma mockups.
- No real backend; local data files are the “data store.”

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Device
    Mobile["Mobile Device (iOS/Android Expo App)"]:::external

    %% Entry Points
    subgraph "Entry Points"
        App["App.tsx"]:::entry
        Index["index.ts"]:::entry
    end

    %% Configuration & Build
    subgraph "Configuration & Build"
        ExpoAppJSON["app.json"]:::config
        ExpoEAS["eas.json"]:::config
        Babel["babel.config.js"]:::config
        TSConfig["tsconfig.json"]:::config
    end

    %% Presentation Layer
    subgraph "Presentation Layer"
        subgraph "Screens"
            Home["Home Screen"]:::presentation
            Filter["Filter Screen"]:::presentation
            CarDetails["Car Details Screen"]:::presentation
            Makes["Makes Screen"]:::presentation
            Models["Models Screen"]:::presentation
            SellCar["SellCar Screen"]:::presentation
            SubmissionCompleted["SubmissionCompleted Screen"]:::presentation
            Profile["Profile Screen"]:::presentation
            Settings["Settings Screen"]:::presentation
            SecuritySettings["SecuritySettings Screen"]:::presentation
            Report["Report Screen"]:::presentation
            Listed["Listed Screen"]:::presentation
            subgraph "Auth Flow"
                Welcome["Welcome Screen"]:::presentation
                Login["Login Screen"]:::presentation
                Register["Register Screen"]:::presentation
                Verification["Verification Screen"]:::presentation
                ChangePass["ChangePass Screen"]:::presentation
                ChangePhone["ChangePhone Screen"]:::presentation
            end
        end
        subgraph "Components"
            Card["Card"]:::presentation
            FormButton["FormButton"]:::presentation
            FormTitle["FormTitle"]:::presentation
            GroupedButton["GroupedButton"]:::presentation
            GroupedField["GroupedField"]:::presentation
            Line["Line"]:::presentation
            LinkNavigator["LinkNavigator"]:::presentation
            ListItem["ListItem"]:::presentation
            RoundedButton["RoundedButton"]:::presentation
            TextWarning["TextWarning"]:::presentation
            Tile["Tile"]:::presentation
        end
    end

    %% State Management Layer
    subgraph "State Management"
        AuthContext["AuthContext Provider"]:::state
        UserContext["UserContext Provider"]:::state
    end

    %% Data Access Layer
    subgraph "Data Access Layer"
        APIData["api/data.ts"]:::dataaccess
        APIUtils["api/utils.ts"]:::dataaccess
    end

    %% Data Storage
    subgraph "Data Storage"
        Cars[(cars.json)]:::storage
        Users[(users.json)]:::storage
        MakesData[(makes.json)]:::storage
        ModelsData[(models.json)]:::storage
    end

    %% Utilities & Constants
    subgraph "Utilities & Constants"
        Colors["constants/colors.ts"]:::util
        Fonts["constants/fonts.ts"]:::util
        MiscConst["constants/miscellaneous.ts"]:::util
        Normalize["utils/normalize.ts"]:::util
        Validation["utils/validation.ts"]:::util
    end

    %% Tests
    subgraph "Tests"
        DataTest["__tests__/data.test.ts"]:::test
    end

    %% External / Future
    Figma["Figma Design"]:::external
    RemoteAPI[("Remote REST API")]:::external

    %% Connections
    Mobile --> App
    Mobile --> Index
    App -->|"renders"| Home
    App -->|"bootstrap"| Index
    Home -->|"renders"| Card
    Filter -->|"renders"| Tile
    CarDetails -->|"renders"| ListItem
    AuthContext -->|provides state to| Home
    UserContext -->|provides data to| Profile

    Home -->|"useContext"| AuthContext
    Login -->|"dispatch login"| AuthContext
    Register -->|"dispatch register"| AuthContext

    AuthContext -->|"calls"| APIData
    UserContext -->|"calls"| APIData
    APIData -->|"uses"| APIUtils
    APIUtils -->|"reads"| Cars
    APIUtils -->|"reads"| Users
    APIUtils -->|"reads"| MakesData
    APIUtils -->|"reads"| ModelsData
    Cars -->|"data"| AuthContext
    Users -->|"data"| UserContext

    Components -->|"use constants"| Colors
    Components -->|"use constants"| Fonts
    Components -->|"use constants"| MiscConst
    Components -->|"use utils"| Normalize
    Components -->|"use utils"| Validation

    __tests__/data.test.ts -->|"tests"| APIUtils
    __tests__/data.test.ts -->|"uses data"| Cars

    ExpoAppJSON --> App
    ExpoEAS --> App
    Babel --> App
    TSConfig --> App

    AuthContext -->|"optional swap"| RemoteAPI
    RemoteAPI -.->|future data source| APIData
    Figma -.->|design reference| Home

    %% Click Events
    click App "https://github.com/ubeydeozdmr/grabsnap/blob/main/App.tsx"
    click Index "https://github.com/ubeydeozdmr/grabsnap/blob/main/index.ts"
    click ExpoAppJSON "https://github.com/ubeydeozdmr/grabsnap/blob/main/app.json"
    click ExpoEAS "https://github.com/ubeydeozdmr/grabsnap/blob/main/eas.json"
    click Babel "https://github.com/ubeydeozdmr/grabsnap/blob/main/babel.config.js"
    click TSConfig "https://github.com/ubeydeozdmr/grabsnap/blob/main/tsconfig.json"
    click Home "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Home.tsx"
    click Filter "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Filter.tsx"
    click CarDetails "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/CarDetails.tsx"
    click Makes "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Makes.tsx"
    click Models "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Models.tsx"
    click SellCar "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/SellCar.tsx"
    click SubmissionCompleted "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/SubmissionCompleted.tsx"
    click Profile "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Profile.tsx"
    click Settings "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Settings.tsx"
    click SecuritySettings "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/SecuritySettings.tsx"
    click Report "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Report.tsx"
    click Listed "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/Listed.tsx"
    click Welcome "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/auth/Welcome.tsx"
    click Login "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/auth/Login.tsx"
    click Register "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/auth/Register.tsx"
    click Verification "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/auth/Verification.tsx"
    click ChangePass "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/auth/ChangePass.tsx"
    click ChangePhone "https://github.com/ubeydeozdmr/grabsnap/blob/main/screens/auth/ChangePhone.tsx"
    click Card "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/Card.tsx"
    click FormButton "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/FormButton.tsx"
    click FormTitle "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/FormTitle.tsx"
    click GroupedButton "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/GroupedButton.tsx"
    click GroupedField "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/GroupedField.tsx"
    click Line "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/Line.tsx"
    click LinkNavigator "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/LinkNavigator.tsx"
    click ListItem "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/ListItem.tsx"
    click RoundedButton "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/RoundedButton.tsx"
    click TextWarning "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/TextWarning.tsx"
    click Tile "https://github.com/ubeydeozdmr/grabsnap/blob/main/components/Tile.tsx"
    click AuthContext "https://github.com/ubeydeozdmr/grabsnap/blob/main/context/AuthContext.tsx"
    click UserContext "https://github.com/ubeydeozdmr/grabsnap/blob/main/context/UserContext.tsx"
    click APIData "https://github.com/ubeydeozdmr/grabsnap/blob/main/api/data.ts"
    click APIUtils "https://github.com/ubeydeozdmr/grabsnap/blob/main/api/utils.ts"
    click Cars "https://github.com/ubeydeozdmr/grabsnap/blob/main/data/cars.json"
    click Users "https://github.com/ubeydeozdmr/grabsnap/blob/main/data/users.json"
    click MakesData "https://github.com/ubeydeozdmr/grabsnap/blob/main/data/makes.json"
    click ModelsData "https://github.com/ubeydeozdmr/grabsnap/blob/main/data/models.json"
    click Colors "https://github.com/ubeydeozdmr/grabsnap/blob/main/constants/colors.ts"
    click Fonts "https://github.com/ubeydeozdmr/grabsnap/blob/main/constants/fonts.ts"
    click MiscConst "https://github.com/ubeydeozdmr/grabsnap/blob/main/constants/miscellaneous.ts"
    click Normalize "https://github.com/ubeydeozdmr/grabsnap/blob/main/utils/normalize.ts"
    click Validation "https://github.com/ubeydeozdmr/grabsnap/blob/main/utils/validation.ts"
    click DataTest "https://github.com/ubeydeozdmr/grabsnap/blob/main/__tests__/data.test.ts"

    %% Styles
    classDef presentation fill:#E0F7FA,stroke:#006064,color:#006064
    classDef state fill:#E8F5E9,stroke:#2E7D32,color:#2E7D32
    classDef dataaccess fill:#FFF3E0,stroke:#EF6C00,color:#EF6C00
    classDef storage fill:#FFFDE7,stroke:#F9A825,color:#F9A825
    classDef config fill:#F3E5F5,stroke:#6A1B9A,color:#6A1B9A
    classDef util fill:#FCE4EC,stroke:#C2185B,color:#C2185B
    classDef test fill:#ECEFF1,stroke:#607D8B,color:#607D8B
    classDef entry fill:#E1F5FE,stroke:#0288D1,color:#0288D1
    classDef external fill:#FAFAFA,stroke:#BDBDBD,color:#616161,stroke-dasharray: 5 5
```
