# hugobordier/meow architecture

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

- Interactive diagram: https://gitdiagram.com/hugobordier/meow
- Repository: https://github.com/hugobordier/meow

## Overview

##### Main Components
- Entry Point & Routing Layer: The project’s entry files are in the app directory with the main index.tsx and global _layout.tsx files. The file-based routing clearly segments the features into groups like authentication ((auth)), discussions ((discussion)), and home screens ((home)).
- Feature Modules:
- Authentication: Contains sign-in, sign-up, forgot-password pages, and an id_verification submodule for additional checks (e.g., ID card, insurance, RIB verification).
- Discussion Flow: Includes camera and chatScreen files.
- Home Screens: There are different layouts for petsitters and general users.
- Services & Business Logic: The services directory contains API integration and authentication service files. Additionally, context (e.g., AuthContext, ToastContext) and hooks (e.g., useAuth, useThemeColor) offer state management and utility functions.
- Configuration and Build Tools: Includes configuration files like tailwind.config.js, babel.config.js, metro.config.js, tsconfig.json, and scripts for project reset.

##### Relationships & Data Flow
- The application starts via the Expo entry point (app/index.tsx) and then routes users based on the URL paths determined by file-based routing.
- Each feature module (auth, discussion, home) has its own localized layout and screens. They may interact by transitioning between screens and passing state.
- Global contexts (e.g., AuthContext) are used by components throughout the app to manage user state and notifications (ToastContext), tying into the service layer.
- The services layer (api.ts, auth.service.ts) is used by various components to interact with backend APIs; these interactions support operations such as user authentication and other related data flows.
- Reusable hooks (like useAuth and useColorScheme) are integrated into UI components for state and theme management, enhancing the interactive experience.
- Assets and components are referenced by many screens for consistent styling and functionality.

##### Architectural Patterns & Technologies
- File-based Routing: Leveraged by the “app” directory where folders (and even parenthesized route groups such as (auth)) offer a clear structure.
- Component-Based UI: React components are used for modular, reusable UI (e.g., AnimatedButton, header.tsx, various layout files).
- Context API and Custom Hooks: These provide state management and side-effect logic without global state libraries, making the app more maintainable.
- Service Layer Abstraction: Modular service files separate API calls and business logic from the UI.
- Styling: Uses Tailwind (with a tailwind.config.js file) and possibly NativeWind for styling in a React Native environment.
- Expo & React Native: The project takes advantage of the Expo ecosystem for app development and deployment.

- Branch out to a “Routing” component node that uses file-based routing to connect to each major module:
- “Auth Module”: Highlight its internal structure with its own submodule (id_verification).
- “Discussion Module”: Illustrate screens like camera and chatScreen.
- “Home Module”: Show differentiation for different home views.
- A “Global State & Hooks” node to every feature module to illustrate shared context (AuthContext, ToastContext) and common hooks (useAuth, useThemeColor).
- An “Assets & UI Components” node that is referenced by multiple modules/screen layouts.
- A “Configuration/Build Tools” layer that shows the supporting files like tailwind.config.js, metro.config.js, etc.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Expo App"]:::module

    subgraph "Entry & Routing"
        B1["index.tsx"]:::entry
        B2["_layout.tsx"]:::entry
    end

    A --> B1
    A --> B2
    B2 -->|"routes to"| C["Authentication Module"]:::module
    B2 -->|"routes to"| D["Discussion Module"]:::module
    B2 -->|"routes to"| E["Home Module"]:::module

    C --> C2["ID Verification Submodule"]:::module

    %% Assets & UI Elements
    subgraph "Assets & UI Elements"
        F1["Assets"]:::assets
        F2["UI Components"]:::assets
    end

    %% Services & Business Logic
    subgraph "Services & Business Logic"
        G1["Services"]:::services
        G2["Context"]:::services
        G3["Hooks"]:::services
    end

    %% Connections from Feature Modules to Shared Layers
    C ---|"renders"| F1
    D ---|"renders"| F1
    E ---|"renders"| F1

    C ---|"renders"| F2
    D ---|"renders"| F2
    E ---|"renders"| F2

    C ---|"APICalls"| G1
    D ---|"APICalls"| G1
    E ---|"APICalls"| G1

    C ---|"state"| G2
    D ---|"state"| G2
    E ---|"state"| G2

    C ---|"hooks"| G3
    D ---|"hooks"| G3
    E ---|"hooks"| G3

    %% Configuration & Build Tools
    subgraph "Configuration & Build Tools"
        I1["Tailwind Config"]:::config
        I2["Babel Config"]:::config
        I3["Metro Config"]:::config
        I4["TypeScript Config"]:::config
        I5["App Config"]:::config
        I6["Reset Script"]:::config
    end

    A ---|"configuredBy"| I1

    %% Click Events
    click B1 "https://github.com/hugobordier/meow/blob/main/app/index.tsx"
    click B2 "https://github.com/hugobordier/meow/blob/main/app/_layout.tsx"
    click C "https://github.com/hugobordier/meow/tree/main/app/(auth)/"
    click C2 "https://github.com/hugobordier/meow/tree/main/app/(auth)/(id_verification)/"
    click D "https://github.com/hugobordier/meow/tree/main/app/(discussion)/"
    click E "https://github.com/hugobordier/meow/tree/main/app/(home)/"
    click F1 "https://github.com/hugobordier/meow/tree/main/assets/"
    click F2 "https://github.com/hugobordier/meow/tree/main/components/"
    click G1 "https://github.com/hugobordier/meow/tree/main/services/"
    click G2 "https://github.com/hugobordier/meow/tree/main/context/"
    click G3 "https://github.com/hugobordier/meow/tree/main/hooks/"
    click I1 "https://github.com/hugobordier/meow/blob/main/tailwind.config.js"
    click I2 "https://github.com/hugobordier/meow/blob/main/babel.config.js"
    click I3 "https://github.com/hugobordier/meow/blob/main/metro.config.js"
    click I4 "https://github.com/hugobordier/meow/blob/main/tsconfig.json"
    click I5 "https://github.com/hugobordier/meow/blob/main/app.json"
    click I6 "https://github.com/hugobordier/meow/blob/main/scripts/reset-project.js"

    %% Styles
    classDef entry fill:#f9e79f,stroke:#e67e22,stroke-width:2px;
    classDef module fill:#aed6f1,stroke:#2980b9,stroke-width:2px;
    classDef assets fill:#a9dfbf,stroke:#27ae60,stroke-width:2px;
    classDef services fill:#f5b7b1,stroke:#c0392b,stroke-width:2px;
    classDef config fill:#d5dbdb,stroke:#7f8c8d,stroke-width:2px;
```
