# uzziahlanz/cosmic-explorer architecture

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

- Interactive diagram: https://gitdiagram.com/uzziahlanz/cosmic-explorer
- Repository: https://github.com/uzziahlanz/cosmic-explorer

## Overview

Cosmic Explorer is an Expo mobile app for discovering NASA imagery. Users browse a paginated space-image feed or search NASA’s image catalog, open a result for full metadata, and optionally save it; saved items persist locally and reappear in Favorites. The documented navigation places Home, Search, and Favorites in tabs, with Details on a root stack. The sampled source confirms the screens, API service, reusable result card, and AsyncStorage-backed favorite operations. ScreenHeader is mentioned in the README but absent from the supplied tree, so it is not represented.

Main entry points: [`App.js`](https://github.com/uzziahlanz/cosmic-explorer/blob/main/App.js) (App navigation), [`screens/DetailsScreen.js`](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/DetailsScreen.js) (Item details), [`screens/HomeScreen.js`](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/HomeScreen.js) (Home feed), [`screens/SearchScreen.js`](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/SearchScreen.js) (Catalog search)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_navigation["Navigation"]
  node_app["App navigation<br/>[App.js]"]
end

subgraph group_discovery["NASA discovery"]
  node_home["Home feed<br/>[HomeScreen.js]"]
  node_search["Catalog search<br/>[SearchScreen.js]"]
  node_nasa_api["NASA API service<br/>[nasaApi.js]"]
end

subgraph group_presentation["Result presentation"]
  node_card["Space card<br/>[SpaceCard.js]"]
  node_details["Item details<br/>[DetailsScreen.js]"]
end

subgraph group_saved["Saved discoveries"]
  node_favorites_screen["Favorites list<br/>[FavoritesScreen.js]"]
  node_favorites_service["Favorites service<br/>[favorites.js]"]
  node_local_store[("Device storage")]
end

node_user(("App user"))
node_nasa{{"NASA image API"}}

node_user -->|"opens"| node_app
node_app -->|"routes"| node_home
node_app -->|"routes"| node_search
node_app -->|"routes"| node_favorites_screen
node_app -->|"routes"| node_details
node_home -->|"loads pages"| node_nasa_api
node_search -->|"searches pages"| node_nasa_api
node_nasa_api -->|"fetches images"| node_nasa
node_home -->|"renders items"| node_card
node_search -->|"renders results"| node_card
node_favorites_screen -->|"renders saved"| node_card
node_home -->|"opens item"| node_details
node_search -->|"opens item"| node_details
node_favorites_screen -->|"opens item"| node_details
node_details -->|"checks and toggles"| node_favorites_service
node_favorites_screen -->|"loads on focus"| node_favorites_service
node_favorites_service -->|"reads and writes"| node_local_store

click node_app "https://github.com/uzziahlanz/cosmic-explorer/blob/main/App.js"
click node_home "https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/HomeScreen.js"
click node_search "https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/SearchScreen.js"
click node_nasa_api "https://github.com/uzziahlanz/cosmic-explorer/blob/main/services/nasaApi.js"
click node_card "https://github.com/uzziahlanz/cosmic-explorer/blob/main/components/SpaceCard.js"
click node_details "https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/DetailsScreen.js"
click node_favorites_screen "https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/FavoritesScreen.js"
click node_favorites_service "https://github.com/uzziahlanz/cosmic-explorer/blob/main/services/favorites.js"

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_app,node_user toneBlue
class node_home,node_search,node_nasa_api toneAmber
class node_card,node_details,node_nasa toneMint
class node_favorites_screen,node_favorites_service,node_local_store toneRose
```

## Components

### Navigation

- [App navigation](https://github.com/uzziahlanz/cosmic-explorer/blob/main/App.js): `App.js`

### NASA discovery

- [Home feed](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/HomeScreen.js): `screens/HomeScreen.js`
- [Catalog search](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/SearchScreen.js): `screens/SearchScreen.js`
- [NASA API service](https://github.com/uzziahlanz/cosmic-explorer/blob/main/services/nasaApi.js): `services/nasaApi.js`

### Result presentation

- [Space card](https://github.com/uzziahlanz/cosmic-explorer/blob/main/components/SpaceCard.js): `components/SpaceCard.js`
- [Item details](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/DetailsScreen.js): `screens/DetailsScreen.js`

### Saved discoveries

- [Favorites list](https://github.com/uzziahlanz/cosmic-explorer/blob/main/screens/FavoritesScreen.js): `screens/FavoritesScreen.js`
- [Favorites service](https://github.com/uzziahlanz/cosmic-explorer/blob/main/services/favorites.js): `services/favorites.js`
- **Device storage**

### Other components

- **App user**
- **NASA image API**

## Connections

- App user → App navigation: opens
- App navigation → Home feed: routes
- App navigation → Catalog search: routes
- App navigation → Favorites list: routes
- App navigation → Item details: routes
- Home feed → NASA API service: loads pages
- Catalog search → NASA API service: searches pages
- NASA API service → NASA image API: fetches images
- Home feed → Space card: renders items
- Catalog search → Space card: renders results
- Favorites list → Space card: renders saved
- Home feed → Item details: opens item
- Catalog search → Item details: opens item
- Favorites list → Item details: opens item
- Item details → Favorites service: checks and toggles
- Favorites list → Favorites service: loads on focus
- Favorites service → Device storage: reads and writes
