# sapirshenkor/ai-crypto-adviso architecture

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

- Interactive diagram: https://gitdiagram.com/sapirshenkor/ai-crypto-adviso
- Repository: https://github.com/sapirshenkor/ai-crypto-adviso

## Overview

AI Crypto Advisor is a personalized crypto dashboard. Users sign up or log in, save investment preferences during onboarding, then load a dashboard with news, prices, a daily AI insight, and a meme; they can vote on eligible content. The frontend’s authenticated API client connects these stages to FastAPI routes, which delegate to services and persistent user data. README documents provider fallbacks and major features; some backend service internals and frontend components were not excerpted, so edges involving them rely on documented behavior or indexed references.

Main entry points: [`frontend/src/services/apiClient.ts`](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/apiClient.ts) (Authenticated API client), [`backend/app/services/dashboard_service.py`](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/dashboard_service.py) (Dashboard assembly), [`backend/app/main.py`](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/main.py) (FastAPI routes), [`frontend/src/App.tsx`](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/App.tsx) (Application routing)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["Application routing<br/>[App.tsx]"]
  node_authui["Login and signup<br/>[LoginPage.tsx]"]
  node_onboardui["Onboarding form<br/>[OnboardingPage.tsx]"]
  node_dashui["Dashboard page<br/>[DashboardPage.tsx]"]
  node_authstate["Session state<br/>[AuthProvider.tsx]"]
  node_token["Token storage<br/>[tokenStorage.ts]"]
  node_apiclient["Authenticated API client<br/>[apiClient.ts]"]
end

subgraph group_identity["Identity and preferences"]
  node_authfrontend["Auth API service<br/>[authService.ts]"]
  node_onboardfrontend["Onboarding API service"]
  node_authroutes["Auth routes<br/>[auth.py]"]
  node_authservice["Auth service<br/>[auth_service.py]"]
  node_authdeps["JWT user resolution<br/>[deps.py]"]
  node_onboardroutes["Onboarding routes<br/>[onboarding.py]"]
  node_onboardservice["Preference service"]
end

subgraph group_dashboard["Dashboard content"]
  node_dashboardfrontend["Dashboard API service"]
  node_feedbackfrontend["Feedback API service<br/>[feedbackService.ts]"]
  node_dashboardcards["Dashboard cards"]
  node_dashboardroutes["Dashboard route<br/>[dashboard.py]"]
  node_dashboardservice["Dashboard assembly"]
  node_news["News provider<br/>[news_service.py]"]
  node_prices["Market prices"]
  node_insight["AI insight"]
  node_meme["Meme content<br/>[meme_service.py]"]
  node_fallbacks["Static fallbacks"]
  node_feedbackroutes["Feedback routes<br/>[feedback.py]"]
  node_feedbackservice["Vote service"]
end

subgraph group_backend["API and persistence"]
  node_api["FastAPI routes<br/>[main.py]"]
  node_users[("User records<br/>[user.py]")]
  node_preferences[("Preference records")]
  node_feedbackdata[("Vote records<br/>[feedback.py]")]
end

node_investor(("Investor"))
node_postgres[("PostgreSQL")]
node_newsprovider["NewsData.io"]
node_coinprovider["CoinGecko"]

node_investor -->|"opens"| node_app
node_app -->|"routes to"| node_authui
node_app -->|"routes to"| node_onboardui
node_app -->|"routes to"| node_dashui
node_authui -->|"submits credentials"| node_authfrontend
node_authstate -->|"calls"| node_authfrontend
node_authfrontend -->|"sends requests"| node_apiclient
node_apiclient -->|"reads token"| node_token
node_apiclient -->|"calls API"| node_api
node_api -->|"registers routes"| node_authroutes
node_api -->|"registers routes"| node_onboardroutes
node_api -->|"registers routes"| node_dashboardroutes
node_api -->|"registers routes"| node_feedbackroutes
node_authroutes -->|"delegates to"| node_authservice
node_authroutes -->|"resolves user"| node_authdeps
node_authservice -->|"reads and writes"| node_users
node_onboardui -->|"loads and saves"| node_onboardfrontend
node_onboardfrontend -->|"sends requests"| node_apiclient
node_onboardfrontend -->|"calls endpoints"| node_onboardroutes
node_onboardroutes -->|"delegates to"| node_onboardservice
node_onboardservice -->|"reads and writes"| node_preferences
node_dashui -->|"loads dashboard"| node_dashboardfrontend
node_dashui -->|"submits votes"| node_feedbackfrontend
node_dashui -->|"renders"| node_dashboardcards
node_dashboardfrontend -->|"sends requests"| node_apiclient
node_dashboardfrontend -->|"requests dashboard"| node_dashboardroutes
node_dashboardroutes -->|"delegates to"| node_dashboardservice
node_dashboardservice -->|"assembles news"| node_news
node_dashboardservice -->|"assembles prices"| node_prices
node_dashboardservice -->|"assembles insight"| node_insight
node_dashboardservice -->|"assembles meme"| node_meme
node_news -->|"uses fallback"| node_fallbacks
node_prices -->|"uses fallback"| node_fallbacks
node_insight -->|"uses fallback"| node_fallbacks
node_news -->|"fetches articles"| node_newsprovider
node_prices -->|"fetches prices"| node_coinprovider
node_feedbackfrontend -->|"sends requests"| node_apiclient
node_feedbackfrontend -->|"submits votes"| node_feedbackroutes
node_feedbackroutes -->|"delegates to"| node_feedbackservice
node_feedbackservice -->|"stores votes"| node_feedbackdata
node_users -->|"persists in"| node_postgres
node_preferences -->|"persists in"| node_postgres
node_feedbackdata -->|"persists in"| node_postgres

click node_app "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/App.tsx"
click node_authui "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/pages/LoginPage.tsx"
click node_onboardui "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/pages/OnboardingPage.tsx"
click node_dashui "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/pages/DashboardPage.tsx"
click node_authstate "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/context/AuthProvider.tsx"
click node_token "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/utils/tokenStorage.ts"
click node_apiclient "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/apiClient.ts"
click node_authfrontend "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/authService.ts"
click node_onboardfrontend "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/onboardingService.ts"
click node_dashboardfrontend "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/dashboardService.ts"
click node_feedbackfrontend "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/feedbackService.ts"
click node_dashboardcards "https://github.com/sapirshenkor/ai-crypto-adviso/tree/main/frontend/src/components/dashboard"
click node_api "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/main.py"
click node_authroutes "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/auth.py"
click node_authservice "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/auth_service.py"
click node_authdeps "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/deps.py"
click node_onboardroutes "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/onboarding.py"
click node_onboardservice "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/onboarding_service.py"
click node_dashboardroutes "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/dashboard.py"
click node_dashboardservice "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/dashboard_service.py"
click node_news "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/news_service.py"
click node_prices "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/market_data_service.py"
click node_insight "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/ai_insight_service.py"
click node_meme "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/meme_service.py"
click node_fallbacks "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/data/dashboard_fallbacks.py"
click node_feedbackroutes "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/feedback.py"
click node_feedbackservice "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/feedback_service.py"
click node_users "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/models/user.py"
click node_preferences "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/models/user_preferences.py"
click node_feedbackdata "https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/models/feedback.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_app,node_authui,node_onboardui,node_dashui,node_authstate,node_token,node_apiclient toneBlue
class node_authfrontend,node_onboardfrontend,node_authroutes,node_authservice,node_authdeps,node_onboardroutes,node_onboardservice,node_postgres toneAmber
class node_dashboardfrontend,node_feedbackfrontend,node_dashboardcards,node_dashboardroutes,node_dashboardservice,node_news,node_prices,node_insight,node_meme,node_fallbacks,node_feedbackroutes,node_feedbackservice toneMint
class node_api,node_users,node_preferences,node_feedbackdata toneRose
class node_investor,node_newsprovider,node_coinprovider toneIndigo
```

## Components

### Web application

- [Application routing](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Login and signup](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/pages/LoginPage.tsx): `frontend/src/pages/LoginPage.tsx`
- [Onboarding form](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/pages/OnboardingPage.tsx): `frontend/src/pages/OnboardingPage.tsx`
- [Dashboard page](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/pages/DashboardPage.tsx): `frontend/src/pages/DashboardPage.tsx`
- [Session state](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/context/AuthProvider.tsx): `frontend/src/context/AuthProvider.tsx`
- [Token storage](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/utils/tokenStorage.ts): `frontend/src/utils/tokenStorage.ts`
- [Authenticated API client](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/apiClient.ts): `frontend/src/services/apiClient.ts`

### Identity and preferences

- [Auth API service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/authService.ts): `frontend/src/services/authService.ts`
- [Onboarding API service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/onboardingService.ts): `frontend/src/services/onboardingService.ts`
- [Auth routes](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/auth.py): `backend/app/api/routes/auth.py`
- [Auth service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/auth_service.py): `backend/app/services/auth_service.py`
- [JWT user resolution](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/deps.py): `backend/app/api/deps.py`
- [Onboarding routes](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/onboarding.py): `backend/app/api/routes/onboarding.py`
- [Preference service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/onboarding_service.py): `backend/app/services/onboarding_service.py`

### Dashboard content

- [Dashboard API service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/dashboardService.ts): `frontend/src/services/dashboardService.ts`
- [Feedback API service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/frontend/src/services/feedbackService.ts): `frontend/src/services/feedbackService.ts`
- [Dashboard cards](https://github.com/sapirshenkor/ai-crypto-adviso/tree/main/frontend/src/components/dashboard): `frontend/src/components/dashboard`
- [Dashboard route](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/dashboard.py): `backend/app/api/routes/dashboard.py`
- [Dashboard assembly](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/dashboard_service.py): `backend/app/services/dashboard_service.py`
- [News provider](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/news_service.py): `backend/app/services/news_service.py`
- [Market prices](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/market_data_service.py): `backend/app/services/market_data_service.py`
- [AI insight](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/ai_insight_service.py): `backend/app/services/ai_insight_service.py`
- [Meme content](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/meme_service.py): `backend/app/services/meme_service.py`
- [Static fallbacks](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/data/dashboard_fallbacks.py): `backend/app/data/dashboard_fallbacks.py`
- [Feedback routes](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/api/routes/feedback.py): `backend/app/api/routes/feedback.py`
- [Vote service](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/services/feedback_service.py): `backend/app/services/feedback_service.py`

### API and persistence

- [FastAPI routes](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/main.py): `backend/app/main.py`
- [User records](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/models/user.py): `backend/app/models/user.py`
- [Preference records](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/models/user_preferences.py): `backend/app/models/user_preferences.py`
- [Vote records](https://github.com/sapirshenkor/ai-crypto-adviso/blob/main/backend/app/models/feedback.py): `backend/app/models/feedback.py`

### Other components

- **Investor**
- **PostgreSQL**
- **NewsData.io**
- **CoinGecko**

## Connections

- Investor → Application routing: opens (evidence: `README.md`)
- Application routing → Login and signup: routes to (evidence: `frontend/src/App.tsx`)
- Application routing → Onboarding form: routes to (evidence: `frontend/src/App.tsx`)
- Application routing → Dashboard page: routes to (evidence: `frontend/src/App.tsx`)
- Login and signup → Auth API service: submits credentials (evidence: `README.md`)
- Session state → Auth API service: calls (evidence: `frontend/src/context/AuthProvider.tsx`)
- Auth API service → Authenticated API client: sends requests (evidence: `frontend/src/services/authService.ts`)
- Authenticated API client → Token storage: reads token (evidence: `frontend/src/services/apiClient.ts`)
- Authenticated API client → FastAPI routes: calls API (evidence: `README.md`)
- FastAPI routes → Auth routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI routes → Onboarding routes: registers routes (evidence: `backend/app/main.py`)
- FastAPI routes → Dashboard route: registers routes (evidence: `backend/app/main.py`)
- FastAPI routes → Feedback routes: registers routes (evidence: `backend/app/main.py`)
- Auth routes → Auth service: delegates to (evidence: `backend/app/api/routes/auth.py`)
- Auth routes → JWT user resolution: resolves user (evidence: `backend/app/api/routes/auth.py`)
- Auth service → User records: reads and writes (evidence: `backend/app/services/auth_service.py`)
- Onboarding form → Onboarding API service: loads and saves (evidence: `frontend/src/pages/OnboardingPage.tsx`)
- Onboarding API service → Authenticated API client: sends requests (evidence: `frontend/src/services/onboardingService.ts`)
- Onboarding API service → Onboarding routes: calls endpoints (evidence: `README.md`)
- Onboarding routes → Preference service: delegates to (evidence: `backend/app/api/routes/onboarding.py`)
- Preference service → Preference records: reads and writes (evidence: `backend/app/services/onboarding_service.py`)
- Dashboard page → Dashboard API service: loads dashboard (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Dashboard page → Feedback API service: submits votes (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Dashboard page → Dashboard cards: renders (evidence: `frontend/src/pages/DashboardPage.tsx`)
- Dashboard API service → Authenticated API client: sends requests (evidence: `README.md`)
- Dashboard API service → Dashboard route: requests dashboard (evidence: `README.md`)
- Dashboard route → Dashboard assembly: delegates to (evidence: `backend/app/api/routes/dashboard.py`)
- Dashboard assembly → News provider: assembles news (evidence: `README.md`)
- Dashboard assembly → Market prices: assembles prices (evidence: `README.md`)
- Dashboard assembly → AI insight: assembles insight (evidence: `README.md`)
- Dashboard assembly → Meme content: assembles meme (evidence: `README.md`)
- News provider → Static fallbacks: uses fallback (evidence: `backend/app/services/news_service.py`)
- Market prices → Static fallbacks: uses fallback (evidence: `backend/app/services/market_data_service.py`)
- AI insight → Static fallbacks: uses fallback (evidence: `backend/app/services/ai_insight_service.py`)
- News provider → NewsData.io: fetches articles (evidence: `README.md`)
- Market prices → CoinGecko: fetches prices (evidence: `README.md`)
- Feedback API service → Authenticated API client: sends requests (evidence: `frontend/src/services/feedbackService.ts`)
- Feedback API service → Feedback routes: submits votes (evidence: `README.md`)
- Feedback routes → Vote service: delegates to (evidence: `backend/app/api/routes/feedback.py`)
- Vote service → Vote records: stores votes (evidence: `README.md`)
- User records → PostgreSQL: persists in (evidence: `README.md`)
- Preference records → PostgreSQL: persists in (evidence: `README.md`)
- Vote records → PostgreSQL: persists in (evidence: `README.md`)
