# ystem-lms/mobile architecture

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

- Interactive diagram: https://gitdiagram.com/ystem-lms/mobile
- Repository: https://github.com/ystem-lms/mobile

## Overview

This is an Expo mobile foundation for a STEM-and-chess learning app. Its current user workflow is startup configuration and session bootstrap, mock student or mentor sign-in, then role-gated navigation into the app; the home screen links to learning, puzzles, play, and profile. Those feature screens are present, but real authentication, lessons, gameplay, and backend integration remain pending. The graph reflects documented capabilities and route structure; unsampled route implementations are not assumed to contain working domain logic.

Main entry points: [`src/providers/SessionProvider.tsx`](https://github.com/ystem-lms/mobile/blob/main/src/providers/SessionProvider.tsx) (Session provider), [`app/_layout.tsx`](https://github.com/ystem-lms/mobile/blob/main/app/_layout.tsx) (Root navigator), [`app/(app)/(tabs)/index.tsx`](https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/index.tsx) (Home screen), [`src/components/ui/AppText.tsx`](https://github.com/ystem-lms/mobile/blob/main/src/components/ui/AppText.tsx) (Text component)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["App navigation"]
  node_root["Root navigator<br/>[_layout.tsx]"]
  node_signin["Sign-in screen<br/>[sign-in.tsx]"]
  node_tabs["App tabs<br/>[_layout.tsx]"]
  node_home["Home screen<br/>[index.tsx]"]
  node_profile["Profile screen<br/>[profile.tsx]"]
  node_mentor["Mentor screen<br/>[index.tsx]"]
end

subgraph group_features["Learning and play"]
  node_learn["Learn screen<br/>[learn.tsx]"]
  node_lesson["Lesson details<br/>[lesson-detail.tsx]"]
  node_play["Play screen<br/>[play.tsx]"]
  node_game["Game screen<br/>[play-game.tsx]"]
  node_puzzles["Puzzle screen<br/>[puzzles.tsx]"]
end

subgraph group_foundation["Session and UI foundation"]
  node_session["Session provider"]
  node_session_state["Session reducer<br/>[session.ts]"]
  node_query["Query provider<br/>[QueryProvider.tsx]"]
  node_environment["Environment validation<br/>[env.ts]"]
  node_placeholder["Placeholder screens"]
  node_session_placeholder["Session placeholder"]
  node_app_text["Text component<br/>[AppText.tsx]"]
  node_screen["Screen component<br/>[Screen.tsx]"]
  node_spinner["Loading spinner<br/>[Spinner.tsx]"]
  node_button["Button component<br/>[Button.tsx]"]
  node_feedback["Feedback components"]
  node_inline_error["Inline error<br/>[InlineError.tsx]"]
  node_theme["Semantic theme<br/>[theme.ts]"]
  node_tokens["Design tokens<br/>[tokens.ts]"]
end

node_user(("Mobile user"))

node_user -->|"opens app"| node_signin
node_signin -->|"mock sign-in"| node_session
node_root -->|"validates config"| node_environment
node_root -->|"wraps app"| node_query
node_root -->|"provides session"| node_session
node_root -->|"routes by status"| node_session
node_session -->|"reduces actions"| node_session_state
node_root -->|"renders bootstrap"| node_screen
node_root -->|"shows loading"| node_spinner
node_session -->|"enables app routes"| node_tabs
node_session -->|"enables public routes"| node_signin
node_tabs -->|"hosts route"| node_home
node_home -->|"links to learning"| node_learn
node_home -->|"links to puzzles"| node_puzzles
node_home -->|"links to play"| node_play
node_home -->|"links to profile"| node_profile
node_profile -->|"uses session"| node_session
node_mentor -->|"renders placeholder"| node_session_placeholder
node_session_placeholder -->|"reads session"| node_session
node_session_placeholder -->|"renders"| node_placeholder
node_placeholder -->|"renders text"| node_app_text
node_placeholder -->|"uses layout"| node_screen
node_app_text -->|"styles text"| node_theme
node_theme -->|"uses tokens"| node_tokens
node_root -->|"styles tabs"| node_theme
node_button -->|"renders label"| node_app_text
node_button -->|"renders loading"| node_spinner
node_feedback -->|"renders message"| node_app_text
node_inline_error -->|"renders message"| node_app_text

click node_root "https://github.com/ystem-lms/mobile/blob/main/app/_layout.tsx"
click node_signin "https://github.com/ystem-lms/mobile/blob/main/app/(public)/sign-in.tsx"
click node_tabs "https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/_layout.tsx"
click node_home "https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/index.tsx"
click node_profile "https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/profile.tsx"
click node_mentor "https://github.com/ystem-lms/mobile/blob/main/app/(app)/mentor/index.tsx"
click node_learn "https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/learn.tsx"
click node_lesson "https://github.com/ystem-lms/mobile/blob/main/app/(app)/lesson-detail.tsx"
click node_play "https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/play.tsx"
click node_game "https://github.com/ystem-lms/mobile/blob/main/app/(app)/play-game.tsx"
click node_puzzles "https://github.com/ystem-lms/mobile/blob/main/app/(app)/puzzles.tsx"
click node_session "https://github.com/ystem-lms/mobile/blob/main/src/providers/SessionProvider.tsx"
click node_session_state "https://github.com/ystem-lms/mobile/blob/main/src/state/session.ts"
click node_query "https://github.com/ystem-lms/mobile/blob/main/src/providers/QueryProvider.tsx"
click node_environment "https://github.com/ystem-lms/mobile/blob/main/src/config/env.ts"
click node_placeholder "https://github.com/ystem-lms/mobile/blob/main/src/components/PlaceholderScreen.tsx"
click node_session_placeholder "https://github.com/ystem-lms/mobile/blob/main/src/components/SessionPlaceholderScreen.tsx"
click node_app_text "https://github.com/ystem-lms/mobile/blob/main/src/components/ui/AppText.tsx"
click node_screen "https://github.com/ystem-lms/mobile/blob/main/src/components/ui/Screen.tsx"
click node_spinner "https://github.com/ystem-lms/mobile/blob/main/src/components/ui/Spinner.tsx"
click node_button "https://github.com/ystem-lms/mobile/blob/main/src/components/ui/Button.tsx"
click node_feedback "https://github.com/ystem-lms/mobile/blob/main/src/components/feedback/ConnectionBanner.tsx"
click node_inline_error "https://github.com/ystem-lms/mobile/blob/main/src/components/feedback/InlineError.tsx"
click node_theme "https://github.com/ystem-lms/mobile/blob/main/src/design/theme.ts"
click node_tokens "https://github.com/ystem-lms/mobile/blob/main/src/design/tokens.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_root,node_signin,node_tabs,node_home,node_profile,node_mentor,node_user toneBlue
class node_learn,node_lesson,node_play,node_game,node_puzzles toneAmber
class node_session,node_session_state,node_query,node_environment,node_placeholder,node_session_placeholder,node_app_text,node_screen,node_spinner,node_button,node_feedback,node_inline_error,node_theme,node_tokens toneMint
```

## Components

### App navigation

- [Root navigator](https://github.com/ystem-lms/mobile/blob/main/app/_layout.tsx): `app/_layout.tsx`
- [Sign-in screen](https://github.com/ystem-lms/mobile/blob/main/app/(public)/sign-in.tsx): `app/(public)/sign-in.tsx`
- [App tabs](https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/_layout.tsx): `app/(app)/(tabs)/_layout.tsx`
- [Home screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/index.tsx): `app/(app)/(tabs)/index.tsx`
- [Profile screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/profile.tsx): `app/(app)/(tabs)/profile.tsx`
- [Mentor screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/mentor/index.tsx): `app/(app)/mentor/index.tsx`

### Learning and play

- [Learn screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/learn.tsx): `app/(app)/(tabs)/learn.tsx`
- [Lesson details](https://github.com/ystem-lms/mobile/blob/main/app/(app)/lesson-detail.tsx): `app/(app)/lesson-detail.tsx`
- [Play screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/(tabs)/play.tsx): `app/(app)/(tabs)/play.tsx`
- [Game screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/play-game.tsx): `app/(app)/play-game.tsx`
- [Puzzle screen](https://github.com/ystem-lms/mobile/blob/main/app/(app)/puzzles.tsx): `app/(app)/puzzles.tsx`

### Session and UI foundation

- [Session provider](https://github.com/ystem-lms/mobile/blob/main/src/providers/SessionProvider.tsx): `src/providers/SessionProvider.tsx`
- [Session reducer](https://github.com/ystem-lms/mobile/blob/main/src/state/session.ts): `src/state/session.ts`
- [Query provider](https://github.com/ystem-lms/mobile/blob/main/src/providers/QueryProvider.tsx): `src/providers/QueryProvider.tsx`
- [Environment validation](https://github.com/ystem-lms/mobile/blob/main/src/config/env.ts): `src/config/env.ts`
- [Placeholder screens](https://github.com/ystem-lms/mobile/blob/main/src/components/PlaceholderScreen.tsx): `src/components/PlaceholderScreen.tsx`
- [Session placeholder](https://github.com/ystem-lms/mobile/blob/main/src/components/SessionPlaceholderScreen.tsx): `src/components/SessionPlaceholderScreen.tsx`
- [Text component](https://github.com/ystem-lms/mobile/blob/main/src/components/ui/AppText.tsx): `src/components/ui/AppText.tsx`
- [Screen component](https://github.com/ystem-lms/mobile/blob/main/src/components/ui/Screen.tsx): `src/components/ui/Screen.tsx`
- [Loading spinner](https://github.com/ystem-lms/mobile/blob/main/src/components/ui/Spinner.tsx): `src/components/ui/Spinner.tsx`
- [Button component](https://github.com/ystem-lms/mobile/blob/main/src/components/ui/Button.tsx): `src/components/ui/Button.tsx`
- [Feedback components](https://github.com/ystem-lms/mobile/blob/main/src/components/feedback/ConnectionBanner.tsx): `src/components/feedback/ConnectionBanner.tsx`
- [Inline error](https://github.com/ystem-lms/mobile/blob/main/src/components/feedback/InlineError.tsx): `src/components/feedback/InlineError.tsx`
- [Semantic theme](https://github.com/ystem-lms/mobile/blob/main/src/design/theme.ts): `src/design/theme.ts`
- [Design tokens](https://github.com/ystem-lms/mobile/blob/main/src/design/tokens.ts): `src/design/tokens.ts`

### Other components

- **Mobile user**

## Connections

- Mobile user → Sign-in screen: opens app (evidence: `README.md`)
- Sign-in screen → Session provider: mock sign-in (evidence: `app/(public)/sign-in.tsx`)
- Root navigator → Environment validation: validates config (evidence: `app/_layout.tsx`)
- Root navigator → Query provider: wraps app (evidence: `app/_layout.tsx`)
- Root navigator → Session provider: provides session (evidence: `app/_layout.tsx`)
- Root navigator → Session provider: routes by status (evidence: `app/_layout.tsx`)
- Session provider → Session reducer: reduces actions (evidence: `src/providers/SessionProvider.tsx`)
- Root navigator → Screen component: renders bootstrap (evidence: `app/_layout.tsx`)
- Root navigator → Loading spinner: shows loading (evidence: `app/_layout.tsx`)
- Session provider → App tabs: enables app routes
- Session provider → Sign-in screen: enables public routes (evidence: `app/(public)/sign-in.tsx`)
- App tabs → Home screen: hosts route (evidence: `app/(app)/(tabs)/_layout.tsx`)
- Home screen → Learn screen: links to learning (evidence: `app/(app)/(tabs)/index.tsx`)
- Home screen → Puzzle screen: links to puzzles (evidence: `app/(app)/(tabs)/index.tsx`)
- Home screen → Play screen: links to play (evidence: `app/(app)/(tabs)/index.tsx`)
- Home screen → Profile screen: links to profile (evidence: `app/(app)/(tabs)/index.tsx`)
- Profile screen → Session provider: uses session (evidence: `app/(app)/(tabs)/profile.tsx`)
- Mentor screen → Session placeholder: renders placeholder (evidence: `app/(app)/mentor/index.tsx`)
- Session placeholder → Session provider: reads session (evidence: `src/components/SessionPlaceholderScreen.tsx`)
- Session placeholder → Placeholder screens: renders (evidence: `src/components/SessionPlaceholderScreen.tsx`)
- Placeholder screens → Text component: renders text (evidence: `src/components/PlaceholderScreen.tsx`)
- Placeholder screens → Screen component: uses layout (evidence: `src/components/PlaceholderScreen.tsx`)
- Text component → Semantic theme: styles text (evidence: `src/components/ui/AppText.tsx`)
- Semantic theme → Design tokens: uses tokens (evidence: `src/design/theme.ts`)
- Root navigator → Semantic theme: styles tabs
- Button component → Text component: renders label (evidence: `src/components/ui/Button.tsx`)
- Button component → Loading spinner: renders loading (evidence: `src/components/ui/Button.tsx`)
- Feedback components → Text component: renders message (evidence: `src/components/feedback/ConnectionBanner.tsx`)
- Inline error → Text component: renders message (evidence: `src/components/feedback/InlineError.tsx`)
