# geekyants/nativebase architecture

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

- Interactive diagram: https://gitdiagram.com/geekyants/nativebase
- Repository: https://github.com/geekyants/nativebase

## Overview

- **Source Modules** (src/)
- primitives (low-level UI building blocks)
- composites (higher-order components composed from primitives)
- hooks (accessibility, responsive, theme, clipboard, etc.)
- utils (styling, DOM normalization, responsive queries, test utilities)
- theme (base tokens, component themes, v3/v33x compatibility)
- factory (component builder abstraction)
- **Build & CI**
- Babel (babel.config.js)
- Metro (metro.config.js)
- Webpack (webpack.config.js in web/next apps)
- GitHub Actions (/.github/workflows/build.yml) running tests, builds, lint
- Publishing to npm (cli.js → npm registry)
- **Example & Demo Apps**
- Bare RN (RNBareExample/android + ios)
- Expo (expo-example/)
- Next.js Web (next-example/)
- Storybook Demo (example/storybook/)
- **External Services**
- npm registry
- GitHub (source, CI triggers, issue templates)
- React Native ecosystem (react-native, react-native-web, Expo, Next.js)

##### Architectural patterns & principles
- **Component Hierarchy**: primitives → composites → app code
- **Theming System**: theme/base tokens + theme/components → consumed via useThemeProps
- **Utility Props**: styled-system integration via factory/styled utilities
- **Platform Abstraction**: react-native vs web via react-native-web shims in utils/react-native-web-functions

- RNBareExample (Android/iOS)
- expo-example (Expo managed)
- next-example (Next.js/Web)
- example/storybook (Storybook UI explorer)
d. At the far right, list external services: GitHub (source + issues + PR templates), npm registry, Discord badge.

- **Custom Theme**: “extendTheme” entry point in core
- **Responsive Props**: “useBreakpointValue” hook
- **Accessibility**: “React Native ARIA hooks” in hooks/*
- **Platform Shims**: utils/react-native-web-functions

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "NativeBase Library (src/)"
        primitives["primitives"]:::source
        composites["composites"]:::source
        core["core"]:::source
        hooks["hooks"]:::source
        utils["utils"]:::source
        theme["theme"]:::source
        factory["factory"]:::source
    end

    primitives --> composites
    composites --> factory
    factory --> core
    core --> hooks
    hooks --> utils
    utils --> theme

    subgraph "Build & CI"
        Babel["Babel (babel.config.js)"]:::build
        Metro["Metro (metro.config.js)"]:::build
        Actions["GitHub Actions"]:::build
        CLI["CLI publish (cli.js)"]:::build
    end

    factory --> Actions
    factory --> Babel
    factory --> Metro
    Actions --> CLI

    subgraph "External Services"
        GitHub["GitHub"]:::external
        npmReg["npm registry"]:::external
    end

    GitHub --> Actions
    CLI --> npmReg

    subgraph "Example & Demo Apps"
        RN["RNBareExample"]:::example
        Expo["expo-example"]:::example
        Next["next-example"]:::example
        SB["example/storybook"]:::example
    end

    npmReg --> RN
    npmReg --> Expo
    npmReg --> Next
    npmReg --> SB

    RN -->|"runtime import"| core
    Expo -->|"runtime import"| core
    Next -->|"runtime import"| core
    SB -->|"runtime import"| core

    click primitives "https://github.com/geekyants/nativebase/tree/master/src/components/primitives"
    click composites "https://github.com/geekyants/nativebase/tree/master/src/components/composites"
    click core "https://github.com/geekyants/nativebase/tree/master/src/core"
    click hooks "https://github.com/geekyants/nativebase/tree/master/src/hooks"
    click utils "https://github.com/geekyants/nativebase/tree/master/src/utils"
    click theme "https://github.com/geekyants/nativebase/tree/master/src/theme"
    click factory "https://github.com/geekyants/nativebase/tree/master/src/factory"
    click Babel "https://github.com/geekyants/nativebase/blob/master/babel.config.js"
    click Metro "https://github.com/geekyants/nativebase/blob/master/metro.config.js"
    click Actions "https://github.com/geekyants/nativebase/blob/master/.github/workflows/build.yml"
    click CLI "https://github.com/geekyants/nativebase/blob/master/cli.js"
    click RN "https://github.com/geekyants/nativebase/tree/master/RNBareExample/"
    click Expo "https://github.com/geekyants/nativebase/tree/master/expo-example/"
    click Next "https://github.com/geekyants/nativebase/tree/master/next-example/"
    click SB "https://github.com/geekyants/nativebase/tree/master/example/storybook/"

    classDef source fill:#e5ffe5,stroke:#2d662d,color:#004d00
    classDef build fill:#e0eaff,stroke:#234,color:#001144
    classDef example fill:#fff0db,stroke:#ff6600,color:#994400
    classDef external fill:#f0f0f0,stroke:#666,color:#333
```
