# betomoedano/react-native-notion-clone architecture

> Architecture diagram of the GitHub repository betomoedano/react-native-notion-clone, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/betomoedano/react-native-notion-clone
- Repository: https://github.com/betomoedano/react-native-notion-clone

## Overview

##### Main Components

- Mobile Frontend – The core UI lives in the app/ directory. The “app” folder contains several screens (e.g., tabs, _layout.tsx, explore.tsx, new-notion.tsx) that represent different sections. Also, there’s a components/ directory for reusable UI components (like Collapsible, DraggableNotionList, NotionButton, etc.) and hooks (e.g., useColorScheme).

- Data Layer & Local Persistence – The project contains a Prisma schema (schema.prisma), migrations (in the migrations folder), and an SQLite database file (app.db). This indicates that the mobile app is using a local database solution managed by Prisma ORM.

- Assets & Constants – The assets (e.g., fonts, images) and constants folders hold design and styling elements, while additional libraries (such as navigation components inside components/navigation) support the UI.

- Build & Configuration – Files like app.json, babel.config.js, eas.json, package.json, and tsconfig.json show that the project is configured for Expo, TypeScript, and has rules for the build and deployment processes.

- Scripts & Queries – Additional support functions include scripts for project resetting and queries.sql for explicit SQL commands when needed.

##### Relationships and Interactions

- UI <-> Business Logic: The Expo/React-based UI layer (app/ and components/) drives user interactions via hooks and reusable components.

- Business Logic <-> Data Layer: The UI layer makes calls (possibly via direct Prisma Client usage) to the local SQLite database. This interaction is managed by Prisma (with its schema, migrations, and generated client).

- Data Persistence: The migrations folder shows version control for the database schema. The “app.db” file acts as the local database, ensuring data persistence in a “local-first” manner.

- Build/Configuration to All Layers: The configuration files ensure that the proper environment and build processes are applied to both UI and data layers.

##### Architectural Patterns and Key Technologies

- Separation of Concerns/MVC-ish Structure: Even though mobile apps don’t strictly follow MVC, you have a clear separation between presentational components (in app/ and components/), business logic (hooks, constants), and data persistence (Prisma schema and migrations).

- Mobile-First Design: Expo and React Native patterns are followed for a mobile experience. Notice the separation of screens (tabs, layouts) and a component-driven approach.

- Local-First and Offline Considerations: The usage of an SQLite database (app.db) with Prisma migrations indicates an emphasis on local storage and possibly offline-first capabilities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Mobile Frontend Layer
    subgraph "Mobile Frontend"
        A["Screens (app/)"]:::frontend
        B["Reusable Components (components/)"]:::frontend
        C["Business Logic & Hooks (hooks/)"]:::logic
    end

    %% Data Layer
    subgraph "Data Layer"
        D["Prisma ORM (schema.prisma, migrations/)"]:::database
        E["SQLite Database (app.db)"]:::database
        F["Database Module (myDbModule.ts)"]:::database
        G["Additional SQL (queries.sql)"]:::database
    end

    %% Supporting & Configuration
    subgraph "Supporting & Config"
        H["Assets (assets/)"]:::assets
        I["Constants (constants/)"]:::assets
        J["Configuration Files (app.json, babel.config.js, eas.json, package.json, tsconfig.json)"]:::config
        K["Reset Scripts (scripts/reset-project.js)"]:::scripts
    end

    %% Inter-layer interactions
    A -->|"triggers"| C
    B -->|"uses"| C
    C -->|"queries"| D
    C -->|"calls"| F
    D -->|"returnsData"| A
    F -->|"executes"| G
    %% Support interactions
    J -->|"configures"| A
    J -->|"configures"| D
    H -->|"provides"| A
    I -->|"provides"| A
    K -->|"initializes"| A

    %% Styling Classes
    classDef frontend fill:#ffccff,stroke:#cc0099,stroke-width:2px;
    classDef logic fill:#fff2cc,stroke:#cc9900,stroke-width:2px;
    classDef database fill:#cce5ff,stroke:#0066cc,stroke-width:2px;
    classDef assets fill:#d5e8d4,stroke:#82b366,stroke-width:2px;
    classDef config fill:#f8cecc,stroke:#b85450,stroke-width:2px;
    classDef scripts fill:#d9ead3,stroke:#6aa84f,stroke-width:2px;

    %% Click Events
    click A "https://github.com/betomoedano/react-native-notion-clone/tree/main/app/"
    click B "https://github.com/betomoedano/react-native-notion-clone/tree/main/components/"
    click C "https://github.com/betomoedano/react-native-notion-clone/tree/main/hooks/"
    click D "https://github.com/betomoedano/react-native-notion-clone/blob/main/schema.prisma"
    click E "https://github.com/betomoedano/react-native-notion-clone/blob/main/app.db"
    click F "https://github.com/betomoedano/react-native-notion-clone/blob/main/myDbModule.ts"
    click G "https://github.com/betomoedano/react-native-notion-clone/blob/main/queries.sql"
    click H "https://github.com/betomoedano/react-native-notion-clone/tree/main/assets/"
    click I "https://github.com/betomoedano/react-native-notion-clone/tree/main/constants/"
    click J "https://github.com/betomoedano/react-native-notion-clone/blob/main/app.json"
    click K "https://github.com/betomoedano/react-native-notion-clone/blob/main/scripts/reset-project.js"
```
