# lazzerbeamstudios/spectra-react-native architecture

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

- Interactive diagram: https://gitdiagram.com/lazzerbeamstudios/spectra-react-native
- Repository: https://github.com/lazzerbeamstudios/spectra-react-native

## Overview

##### Project type and purpose
- This is a mobile-first, React Native (Expo) front-end application (app-v1/) written in TypeScript.
- It uses Expo Router for screen navigation, NativeWind (Tailwind CSS) for styling, Zustand for client state, and an OpenAPI-generated client to call an external REST API (the backend is out of scope).

##### File structure
- Top level: project meta (.gitignore, README.md, LICENSE, tool-config) and a single app folder (app-v1/).
- app-v1/: environment files, build scripts, TS configs, Expo configs (app.json, metro.config.js, babel.config.js, etc.).
- src/:
- api.ts – central API entry point.
- app/ – Expo Router folder-based navigation with (auth) and (app) layout groups.
- screens/ – feature-based UI screens (home, sign-in, profile, dashboard, not-found).
- components/ – shared UI components (e.g., BackButton).
- stores/ – Zustand or other client-state stores (auth.store.ts, profile.store.ts).
- openapi/ – generated OpenAPI client, docs, configs, and codegen scripts.
- assets/ – static images.
- scripts/ – utility scripts (error handling, Android nav bar fix).
- theme-constants.ts, tailwind.config.js – theming and styling.

##### Key README insights
- Dependencies: Node.js (via ASDF), Expo CLI.
- Commands: npm install/update, expo start/run, openapi-generator script.
- No backend code—everything here runs on the mobile client.

- Mobile Client (Expo Runtime)
- Navigation Layer (Expo Router with app/(auth) and app/(app) stacks)
- UI Components & Screens (React components under src/components & src/screens)
- State Management (Zustand stores in src/stores)
- API Client (OpenAPI-generated client modules under src/openapi)
- External REST API (backend service with Auth, Profile, Home endpoints)
- Asset Store (images in src/assets)
- Build & Tooling (Metro bundler, Babel, TypeScript compiler, Expo CLI)

b. Component relationships & data flow
1. User taps on Screen (UI layer)
2. Screen reads/writes client-state via Zustand store
3. Store triggers OpenAPI client (api.ts) to make HTTP requests to External REST API
4. HTTP response updates store or returns data to UI
5. Navigation Layer transitions between Screens

c. Architectural patterns & design principles
- Folder-based routing (Expo Router) for clear separation of auth vs. app flows
- Unidirectional data flow: UI → Store → API → Store → UI
- Code generation: OpenAPI schema → strongly typed client APIs
- Component reusability: shared UI components in src/components
- Theming via Tailwind (NativeWind) and centralized theme constants

d. Key technologies & frameworks
- Expo & React Native (mobile runtime)
- Expo Router (file-system–based navigation)
- TypeScript, Babel, Metro Bundler (build toolchain)
- Zustand (state management)
- OpenAPI Generator (client SDK)
- NativeWind / Tailwind CSS (styling)
- asdf, brew, npm, Expo CLI (development environment)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Mobile App Runtime Configuration
    subgraph "Mobile Client Runtime"
        direction TB
        AppJson["app.json"]:::config
        BabelConfig["babel.config.js"]:::config
        MetroConfig["metro.config.js"]:::config
        TsConfig["tsconfig.json"]:::config
    end

    %% Navigation Layer
    subgraph "Navigation Layer (Expo Router)" 
        direction TB
        LayoutRoot["_layout.tsx"]:::navigation
        SignInRoute["(auth)/sign-in.tsx"]:::navigation
        SignUpRoute["(auth)/sign-up.tsx"]:::navigation
        AppLayout["(app)/_layout.tsx"]:::navigation
        DashboardRoute["(app)/dashboard.tsx"]:::navigation
        ProfileRoute["(app)/profile.tsx"]:::navigation
        ProfileUpdateRoute["(app)/profile-update.tsx"]:::navigation
        IndexRoute["index.tsx"]:::navigation
        NotFoundRoute["+not-found.tsx"]:::navigation
    end

    %% UI Components
    subgraph "Shared UI Components"
        direction TB
        BackButton["back-button.tsx"]:::ui
    end

    %% Feature Screens
    subgraph "Feature Screens"
        direction TB
        HomeScreen["home.tsx"]:::ui
        DashboardScreen["dashboard.tsx"]:::ui
        DashboardProfileScreen["dashboard-profile.tsx"]:::ui
        ProfileScreen["profile.tsx"]:::ui
        ProfileSignOut["profile-signout.tsx"]:::ui
        ProfileThemeBtn["profile-theme-button.tsx"]:::ui
        ProfileUpdateScreen["profile-update.tsx"]:::ui
        SignInScreen["sign-in.tsx"]:::ui
        SignUpScreen["sign-up.tsx"]:::ui
        NotFoundScreen["not-found.tsx"]:::ui
    end

    %% State Management
    subgraph "State Management (Zustand)"
        direction TB
        AuthStore["auth.store.ts"]:::store
        ProfileStore["profile.store.ts"]:::store
    end

    %% API Layer
    subgraph "API Client"
        direction TB
        ApiEntry["api.ts"]:::api
        OApiCommon["openapi/common.ts"]:::api
        OApiConfig["openapi/configuration.ts"]:::api
        OApiBase["openapi/base.ts"]:::api
        OApiApi["openapi/api.ts"]:::api
        OApiIndex["openapi/index.ts"]:::api
        OApiDocs["openapi/docs/*"]:::api
    end

    %% Assets & Theming
    subgraph "Assets & Theming"
        direction TB
        Assets["Images"]:::assets
        ThemeConstants["theme-constants.ts"]:::theme
        TailwindConfig["tailwind.config.js"]:::theme
        GlobalCSS["global.css"]:::theme
    end

    %% Build & Tooling
    subgraph "Build & Tooling"
        direction TB
        OpenApiGen["openapi-generator.sh"]:::tool
        ScriptErrors["errors.ts"]:::tool
        ScriptNavFix["android-navigation-bar.ts"]:::tool
    end

    %% External Backend
    ExternalAPI["External REST API"]:::external

    %% Data Flow & Relationships
    LayoutRoot -->|navigates to| SignInRoute
    LayoutRoot -->|navigates to| SignUpRoute
    LayoutRoot -->|navigates to| AppLayout
    AppLayout -->|navigates to| DashboardRoute
    AppLayout -->|navigates to| ProfileRoute
    AppLayout -->|navigates to| ProfileUpdateRoute
    LayoutRoot -->|handles| NotFoundRoute

    SignInScreen -->|uses| AuthStore
    SignUpScreen -->|uses| AuthStore
    DashboardScreen -->|uses| AuthStore
    DashboardProfileScreen -->|uses| ProfileStore
    ProfileScreen -->|uses| ProfileStore
    ProfileSignOut -->|uses| AuthStore
    ProfileThemeBtn -->|uses| ProfileStore
    ProfileUpdateScreen -->|uses| ProfileStore
    HomeScreen -->|uses| AuthStore

    AuthStore -->|calls| ApiEntry
    ProfileStore -->|calls| ApiEntry
    ApiEntry -->|wraps| OApiApi
    OApiApi -->|requests| ExternalAPI
    ExternalAPI -->|responds| OApiApi
    OApiApi -->|returns| ApiEntry
    ApiEntry -->|updates| AuthStore
    ApiEntry -->|updates| ProfileStore

    BackButton -->|used by| SignInScreen
    BackButton -->|used by| SignUpScreen
    BackButton -->|used by| ProfileUpdateScreen

    Assets -->|loaded by| HomeScreen
    ThemeConstants -->|styling| BackButton
    TailwindConfig -->|styling| BackButton
    GlobalCSS -->|styling| BackButton

    %% Click Events
    click AppJson "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/app.json"
    click BabelConfig "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/babel.config.js"
    click MetroConfig "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/metro.config.js"
    click TsConfig "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/tsconfig.json"

    click LayoutRoot "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/_layout.tsx"
    click SignInRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/(auth)/sign-in.tsx"
    click SignUpRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/(auth)/sign-up.tsx"
    click AppLayout "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/(app)/_layout.tsx"
    click DashboardRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/(app)/dashboad.tsx"
    click ProfileRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/(app)/profile.tsx"
    click ProfileUpdateRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/(app)/profile-update.tsx"
    click IndexRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/index.tsx"
    click NotFoundRoute "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/app/+not-found.tsx"

    click BackButton "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/components/back-button.tsx"

    click HomeScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/home/home.tsx"
    click DashboardScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/dashboad/dashboad.tsx"
    click DashboardProfileScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/dashboad/dashboad-profile.tsx"
    click ProfileScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/profile/profile.tsx"
    click ProfileSignOut "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/profile/profile-signout.tsx"
    click ProfileThemeBtn "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/profile/profile-theme-button.tsx"
    click ProfileUpdateScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/profile-update/profile-update.tsx"
    click SignInScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/sign-in/sign-in.tsx"
    click SignUpScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/sign-up/sign-up.tsx"
    click NotFoundScreen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/screens/not-found/not-found.tsx"

    click AuthStore "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/stores/auth.store.ts"
    click ProfileStore "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/stores/profile.store.ts"

    click ApiEntry "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/api.ts"
    click OApiCommon "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/openapi/common.ts"
    click OApiConfig "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/openapi/configuration.ts"
    click OApiBase "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/openapi/base.ts"
    click OApiApi "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/openapi/api.ts"
    click OApiIndex "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/openapi/index.ts"
    click OApiDocs "https://github.com/lazzerbeamstudios/spectra-react-native/tree/main/app-v1/src/openapi/docs/*"

    click Assets "https://github.com/lazzerbeamstudios/spectra-react-native/tree/main/app-v1/src/assets/images/*"
    click ThemeConstants "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/theme-constants.ts"
    click TailwindConfig "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/tailwind.config.js"
    click GlobalCSS "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/global.css"

    click OpenApiGen "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/openapi-generator.sh"
    click ScriptErrors "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/scripts/errors.ts"
    click ScriptNavFix "https://github.com/lazzerbeamstudios/spectra-react-native/blob/main/app-v1/src/scripts/android-navigation-bar.ts"

    %% Styles
    classDef config fill:#e0f7fa,stroke:#006064
    classDef navigation fill:#bbdefb,stroke:#0d47a1
    classDef ui fill:#90caf9,stroke:#0d47a1
    classDef store fill:#a5d6a7,stroke:#1b5e20
    classDef api fill:#ffcc80,stroke:#e65100
    classDef external fill:#eeeeee,stroke:#424242
    classDef assets fill:#ce93d8,stroke:#4a148c
    classDef theme fill:#f8bbd0,stroke:#880e4f
    classDef tool fill:#cfd8dc,stroke:#37474f
```
