# expo/examples architecture

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

- Interactive diagram: https://gitdiagram.com/expo/examples
- Repository: https://github.com/expo/examples

## Overview

##### Project Type and Purpose
- This is an open-source monorepo hosting dozens of standalone “Expo Example” projects.
- Its purpose is to provide easy, ready-to-run React Native (Expo) templates demonstrating individual features or integrations (e.g., with-apollo, with-aws-storage-upload, with-nextjs, etc.).
- It also includes CI workflows for previewing examples and automating dependency upgrades.

##### File-Structure Analysis
- Top-level folders and files:
- `.github/`: GitHub Actions workflows (preview.yml, upgrade.yml) and issue templates.
- `.all-contributorsrc`, `contributing.md`, `README.md`: repo metadata, contribution guide, central README.
- A set of peer folders at root (`blank/`, `stickersmash/`, `with-*`), each representing one example with its own `README.md`, `package.json`, source code and assets.
- Misc scripts: `upgrade-dependencies.sh`.
- Patterns:
- Monorepo of isolated sample apps (no shared code at runtime).
- Each example is a self-contained Node project using Expo.
- CI is decoupled: GitHub Actions trigger preview deployments and dependency upgrades.

##### README Insights
- Describes the repo as “Easy example for using features, libraries, and other integrations with the Expo SDK.”
- Shows how to consume an example via the `create-expo` CLI (e.g., `npx create-expo ./my-app --example with-typescript`).

a. Main Components
- GitHub Repository (examples monorepo)
- Example Projects (each folder under root)
- Expo CLI (create-expo)
- Node/NPM (package management)
- GitHub Actions (CI workflows: preview, upgrade)
- Contributors & Users (developers)
b. Relationships & Interactions
- User invokes Expo CLI → fetches a specific example folder from the GitHub repo → initializes a new local project.
- CI workflows watch the repo → on PR pushes run preview builds (deploy to Expo Dev) → upgrade workflow runs `upgrade-dependencies.sh`.
- Contributors fork & clone repo → add/update examples → open PRs → metadata files (`contributing.md`, `.all-contributorsrc`) coordinate contributions.
c. Architectural Patterns / Design Principles
- Monorepo structure: independent example modules alongside shared root-level CI and docs.
- Template-driven generation: each example serves as a template for `create-expo`.
- Minimal coupling: examples do not share runtime code, reducing blast radius when upgrading Expo SDK.
d. Key Technologies
- Expo SDK & CLI
- React / React Native
- Node.js & npm
- GitHub Actions
- YAML for workflows
- Shell scripting (`upgrade-dependencies.sh`)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Actors
    User["Users & Contributors"]:::actor

    %% Tools
    CLI["Expo CLI (create-expo)"]:::tool
    NPM["Node.js / npm"]:::tool

    %% Monorepo Root
    subgraph "Monorepo Root (GitHub Repo)"
        Repo["Monorepo Root"]:::repo
        subgraph Governance
            Contrib["contributing.md"]:::governance
            AllContrib[".all-contributorsrc"]:::governance
        end
        subgraph Examples
            blank["blank"]:::example
            stickers["stickersmash"]:::example
            apollo["with-apollo"]:::example
            auth0["with-auth0"]:::example
            aws["with-aws-storage-upload"]:::example
            ellipsis["..."]:::example
        end
        subgraph CI_Workflows
            PreviewWF["preview.yml"]:::process
            UpgradeWF["upgrade.yml"]:::process
            IssueBug["bug_report.md"]:::process
            IssueNew["new-example-idea.yml"]:::process
        end
        Scripts["upgrade-dependencies.sh"]:::process
        Readme["README.md"]:::repo
        Meta["meta.json"]:::repo
    end

    %% Local Project & Preview
    Local["Local Project"]:::project
    Preview["Expo Dev Previews"]:::external

    %% Relationships
    User -->|forks/clones & PR| Repo
    User -->|contributes guided by| Contrib
    User -->|uses| CLI
    CLI -->|"--example <Example>"| Repo
    Repo -->|serves template| Local
    Local -->|runs via| NPM
    Repo -->|triggers| CI_Workflows
    CI_Workflows -->|deploy preview| Preview
    CI_Workflows -->|invoke upgrade script| Scripts
    Scripts -->|updates deps in| Repo

    %% Click Events
    click Repo "https://github.com/expo/examples/tree/master//"
    click blank "https://github.com/expo/examples/tree/master//blank"
    click stickers "https://github.com/expo/examples/tree/master//stickersmash"
    click apollo "https://github.com/expo/examples/tree/master//with-apollo"
    click auth0 "https://github.com/expo/examples/tree/master//with-auth0"
    click aws "https://github.com/expo/examples/tree/master//with-aws-storage-upload"
    click Contrib "https://github.com/expo/examples/blob/master//contributing.md"
    click AllContrib "https://github.com/expo/examples/blob/master//.all-contributorsrc"
    click PreviewWF "https://github.com/expo/examples/blob/master//.github/workflows/preview.yml"
    click UpgradeWF "https://github.com/expo/examples/blob/master//.github/workflows/upgrade.yml"
    click IssueBug "https://github.com/expo/examples/blob/master//.github/ISSUE_TEMPLATE/bug_report.md"
    click IssueNew "https://github.com/expo/examples/blob/master//.github/ISSUE_TEMPLATE/new-example-idea.yml"
    click Scripts "https://github.com/expo/examples/blob/master//upgrade-dependencies.sh"
    click Readme "https://github.com/expo/examples/blob/master//README.md"
    click Meta "https://github.com/expo/examples/blob/master//meta.json"

    %% Styles
    classDef example fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef tool fill:#90EE90,stroke:#000,stroke-width:1px
    classDef process fill:#FFD700,stroke:#000,stroke-width:1px
    classDef actor fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef repo fill:#FFFFFF,stroke:#000,stroke-width:1px
    classDef governance fill:#E6E6FA,stroke:#000,stroke-width:1px
    classDef project fill:#FFE4E1,stroke:#000,stroke-width:1px
    classDef external fill:#F0F8FF,stroke:#000,stroke-width:1px
```
