# viyasarsingaram5-sketch/redis-fastapi architecture

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

- Interactive diagram: https://gitdiagram.com/viyasarsingaram5-sketch/redis-fastapi
- Repository: https://github.com/viyasarsingaram5-sketch/redis-fastapi

## Overview

This is a small FastAPI service with a single user-lookup workflow: requests check Redis, fall back to an in-memory user map, and cache successful lookups for 15 seconds. It also exposes a Redis health check and a root message. The Redis client is configured from environment variables in `rd_client.py`. The README is empty, so the graph reflects only the sampled source; the user data and API handlers share `main.py`.

Main entry points: [`main.py`](https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/main.py) (FastAPI routes), [`rd_client.py`](https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/rd_client.py) (Redis client config)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["API and user data"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_users["In-memory users<br/>[main.py]"]
end

subgraph group_cache["Redis cache"]
  node_client["Redis client config<br/>[rd_client.py]"]
  node_redis[("Redis")]
end

node_caller(("HTTP caller"))

node_caller -->|"requests routes"| node_api
node_api -->|"uses client"| node_client
node_api -->|"checks health"| node_redis
node_api -->|"reads cache"| node_redis
node_api -->|"looks up user"| node_users
node_api -->|"writes cache"| node_redis

click node_api "https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/main.py"
click node_users "https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/main.py"
click node_client "https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/rd_client.py"

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_api,node_users toneBlue
class node_client,node_redis toneAmber
class node_caller toneIndigo
```

## Components

### API and user data

- [FastAPI routes](https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/main.py): `main.py`
- [In-memory users](https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/main.py): `main.py`

### Redis cache

- [Redis client config](https://github.com/viyasarsingaram5-sketch/redis-fastapi/blob/main/rd_client.py): `rd_client.py`
- **Redis**

### Other components

- **HTTP caller**

## Connections

- HTTP caller → FastAPI routes: requests routes (evidence: `main.py`)
- FastAPI routes → Redis client config: uses client (evidence: `main.py`)
- FastAPI routes → Redis: checks health (evidence: `main.py`)
- FastAPI routes → Redis: reads cache (evidence: `main.py`)
- FastAPI routes → In-memory users: looks up user (evidence: `main.py`)
- FastAPI routes → Redis: writes cache (evidence: `main.py`)
