# dav1ee/rick-and-morty architecture

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

- Interactive diagram: https://gitdiagram.com/dav1ee/rick-and-morty
- Repository: https://github.com/dav1ee/rick-and-morty

## Overview

This Next.js application lets visitors browse Rick and Morty characters, episodes, and locations, with character filters and paginated lists, then access individual detail routes. The sampled list-page code shows requests to the corresponding API helpers; the README identifies the Rick and Morty API as the data source. Detail routes are present in the tree, but their data-flow connections are not established by the supplied evidence.

Main entry points: [`app/(characters)/characters/page.tsx`](https://github.com/dav1ee/rick-and-morty/blob/main/app/(characters)/characters/page.tsx) (Character list), [`app/(episodes)/episodes/[page]/page.tsx`](https://github.com/dav1ee/rick-and-morty/blob/main/app/(episodes)/episodes/%5Bpage%5D/page.tsx) (Episode list), [`app/(locations)/locations/[page]/page.tsx`](https://github.com/dav1ee/rick-and-morty/blob/main/app/(locations)/locations/%5Bpage%5D/page.tsx) (Location list), [`src/utils/api/api.ts`](https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/api.ts) (HTTP client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application routes"]
  node_root["Home page<br/>[page.tsx]"]
  node_characters["Character list<br/>[page.tsx]"]
  node_character_detail["Character detail<br/>[page.tsx]"]
  node_episodes["Episode list<br/>[page.tsx]"]
  node_episode_detail["Episode detail<br/>[page.tsx]"]
  node_locations["Location list<br/>[page.tsx]"]
  node_location_detail["Location detail<br/>[page.tsx]"]
end

subgraph group_ui["User interface"]
  node_shell["Shared shell"]
  node_character_ui["Character cards<br/>[Card.tsx]"]
  node_character_filter["Character filters<br/>[Filter.tsx]"]
  node_character_info["Character info<br/>[DetailedInfo.tsx]"]
  node_status["Status indicator<br/>[StatusCircle.tsx]"]
  node_pagination["Pagination<br/>[Pagination.tsx]"]
  node_item_link["Item links<br/>[LinkItem.tsx]"]
  node_episode_info["Episode info<br/>[Info.tsx]"]
  node_location_info["Location info<br/>[Info.tsx]"]
end

subgraph group_data["API access"]
  node_character_api["Character API<br/>[characters.ts]"]
  node_episode_api["Episode API<br/>[episodes.ts]"]
  node_location_api["Location API<br/>[locations.ts]"]
  node_http_client["HTTP client<br/>[api.ts]"]
end

node_visitor(("Visitor"))
node_external_api[("Rick and Morty API")]

node_visitor -->|"opens"| node_root
node_root -->|"renders"| node_shell
node_visitor -->|"opens"| node_characters
node_characters -->|"fetches"| node_character_api
node_characters -->|"renders"| node_character_filter
node_characters -->|"renders"| node_pagination
node_visitor -->|"opens"| node_episodes
node_episodes -->|"fetches"| node_episode_api
node_episodes -->|"renders"| node_pagination
node_episodes -->|"renders"| node_item_link
node_visitor -->|"opens"| node_locations
node_locations -->|"fetches"| node_location_api
node_locations -->|"renders"| node_pagination
node_locations -->|"renders"| node_item_link
node_character_info -->|"renders"| node_status
node_character_api -->|"calls"| node_http_client
node_episode_api -->|"calls"| node_http_client
node_location_api -->|"calls"| node_http_client
node_http_client -->|"requests"| node_external_api

click node_root "https://github.com/dav1ee/rick-and-morty/blob/main/app/page.tsx"
click node_shell "https://github.com/dav1ee/rick-and-morty/tree/main/src/components/layout"
click node_characters "https://github.com/dav1ee/rick-and-morty/blob/main/app/(characters)/characters/page.tsx"
click node_character_detail "https://github.com/dav1ee/rick-and-morty/blob/main/app/(characters)/character/%5Bid%5D/page.tsx"
click node_episodes "https://github.com/dav1ee/rick-and-morty/blob/main/app/(episodes)/episodes/%5Bpage%5D/page.tsx"
click node_episode_detail "https://github.com/dav1ee/rick-and-morty/blob/main/app/(episodes)/episode/%5Bid%5D/page.tsx"
click node_locations "https://github.com/dav1ee/rick-and-morty/blob/main/app/(locations)/locations/%5Bpage%5D/page.tsx"
click node_location_detail "https://github.com/dav1ee/rick-and-morty/blob/main/app/(locations)/location/%5Bid%5D/page.tsx"
click node_character_ui "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/Card.tsx"
click node_character_filter "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/Filter.tsx"
click node_character_info "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/DetailedInfo.tsx"
click node_status "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/StatusCircle.tsx"
click node_pagination "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/Pagination.tsx"
click node_item_link "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/LinkItem.tsx"
click node_episode_info "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/episodes/Info.tsx"
click node_location_info "https://github.com/dav1ee/rick-and-morty/blob/main/src/components/locations/Info.tsx"
click node_character_api "https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/characters.ts"
click node_episode_api "https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/episodes.ts"
click node_location_api "https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/locations.ts"
click node_http_client "https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/api.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_characters,node_character_detail,node_episodes,node_episode_detail,node_locations,node_location_detail toneBlue
class node_shell,node_character_ui,node_character_filter,node_character_info,node_status,node_pagination,node_item_link,node_episode_info,node_location_info,node_external_api toneAmber
class node_character_api,node_episode_api,node_location_api,node_http_client toneMint
class node_visitor toneIndigo
```

## Components

### Application routes

- [Home page](https://github.com/dav1ee/rick-and-morty/blob/main/app/page.tsx): `app/page.tsx`
- [Character list](https://github.com/dav1ee/rick-and-morty/blob/main/app/(characters)/characters/page.tsx): `app/(characters)/characters/page.tsx`
- [Character detail](https://github.com/dav1ee/rick-and-morty/blob/main/app/(characters)/character/%5Bid%5D/page.tsx): `app/(characters)/character/[id]/page.tsx`
- [Episode list](https://github.com/dav1ee/rick-and-morty/blob/main/app/(episodes)/episodes/%5Bpage%5D/page.tsx): `app/(episodes)/episodes/[page]/page.tsx`
- [Episode detail](https://github.com/dav1ee/rick-and-morty/blob/main/app/(episodes)/episode/%5Bid%5D/page.tsx): `app/(episodes)/episode/[id]/page.tsx`
- [Location list](https://github.com/dav1ee/rick-and-morty/blob/main/app/(locations)/locations/%5Bpage%5D/page.tsx): `app/(locations)/locations/[page]/page.tsx`
- [Location detail](https://github.com/dav1ee/rick-and-morty/blob/main/app/(locations)/location/%5Bid%5D/page.tsx): `app/(locations)/location/[id]/page.tsx`

### User interface

- [Shared shell](https://github.com/dav1ee/rick-and-morty/tree/main/src/components/layout): `src/components/layout`
- [Character cards](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/Card.tsx): `src/components/characters/Card.tsx`
- [Character filters](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/Filter.tsx): `src/components/characters/Filter.tsx`
- [Character info](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/DetailedInfo.tsx): `src/components/characters/DetailedInfo.tsx`
- [Status indicator](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/characters/StatusCircle.tsx): `src/components/characters/StatusCircle.tsx`
- [Pagination](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/Pagination.tsx): `src/components/Pagination.tsx`
- [Item links](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/LinkItem.tsx): `src/components/LinkItem.tsx`
- [Episode info](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/episodes/Info.tsx): `src/components/episodes/Info.tsx`
- [Location info](https://github.com/dav1ee/rick-and-morty/blob/main/src/components/locations/Info.tsx): `src/components/locations/Info.tsx`

### API access

- [Character API](https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/characters.ts): `src/utils/api/characters.ts`
- [Episode API](https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/episodes.ts): `src/utils/api/episodes.ts`
- [Location API](https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/locations.ts): `src/utils/api/locations.ts`
- [HTTP client](https://github.com/dav1ee/rick-and-morty/blob/main/src/utils/api/api.ts): `src/utils/api/api.ts`

### Other components

- **Visitor**
- **Rick and Morty API**

## Connections

- Visitor → Home page: opens
- Home page → Shared shell: renders
- Visitor → Character list: opens
- Character list → Character API: fetches (evidence: `app/(characters)/characters/page.tsx`)
- Character list → Character filters: renders (evidence: `app/(characters)/characters/page.tsx`)
- Character list → Pagination: renders (evidence: `app/(characters)/characters/page.tsx`)
- Visitor → Episode list: opens
- Episode list → Episode API: fetches (evidence: `app/(episodes)/episodes/[page]/page.tsx`)
- Episode list → Pagination: renders (evidence: `app/(episodes)/episodes/[page]/page.tsx`)
- Episode list → Item links: renders (evidence: `app/(episodes)/episodes/[page]/page.tsx`)
- Visitor → Location list: opens
- Location list → Location API: fetches (evidence: `app/(locations)/locations/[page]/page.tsx`)
- Location list → Pagination: renders (evidence: `app/(locations)/locations/[page]/page.tsx`)
- Location list → Item links: renders (evidence: `app/(locations)/locations/[page]/page.tsx`)
- Character info → Status indicator: renders (evidence: `src/components/characters/DetailedInfo.tsx`)
- Character API → HTTP client: calls (evidence: `src/utils/api/characters.ts`)
- Episode API → HTTP client: calls (evidence: `src/utils/api/episodes.ts`)
- Location API → HTTP client: calls (evidence: `src/utils/api/locations.ts`)
- HTTP client → Rick and Morty API: requests (evidence: `src/utils/api/api.ts`)
