# shashwat-akhilesh-shukla/fintracker architecture

> Architecture diagram of the GitHub repository shashwat-akhilesh-shukla/fintracker, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-08-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shashwat-akhilesh-shukla/fintracker
- Repository: https://github.com/shashwat-akhilesh-shukla/fintracker

## Overview

##### Project Type and Purpose
- This is a full-stack, microservices-based financial portfolio management platform (“FinTracker Pro”) with:
- A React/TypeScript SPA frontend
- FastAPI-based backend microservices (API Gateway, Auth, Portfolio, News)
- A machine-learning component for AI-powered insights
- A data layer (PostgreSQL, Redis) and external APIs for market data and news

##### File Structure
- **Top Level**:
- backend/ (microservices)
- frontend/ (React + Redux + Material-UI)
- ml/ (model training & serving)
- infrastructure/ (Dockerfiles, config for Nginx, Postgres, Redis)
- docker-compose.yml orchestrates all containers
- **backend/**: Each service follows the same pattern:
- app/api/v1/endpoints → HTTP routes
- app/core → config, database, security
- app/models & schemas → Pydantic + SQLAlchemy
- app/services → business logic
- **frontend/**:
- src/pages → route-level components
- src/components → charts, common UI, layouts, sections
- src/services → API client wrappers
- src/store → Redux slices & RTK Query
- **ml/**:
- scripts/train.py → model training
- scripts/serve.py → model serving API
- models/price_model.pkl → trained artifact

##### README for Additional Insights
- Confirms microservices architecture with ports:
- API Gateway (8080) → Auth (8001), Portfolio (8002), News (8003)
- Data layer: three separate PostgreSQL instances + Redis cache
- External APIs: Alpha Vantage, Finnhub, NewsAPI
- ML: sentiment analysis and market prediction
- Infrastructure: Docker Compose, health checks, structured logging

##### Detailed Focus
- Service’s database and any caching or external API calls
- ML ingestion/training vs. serving pathways if needed
- Infrastructure elements (Docker network, Nginx) at the top or side

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Infrastructure"
        NGINX["Nginx Load Balancer"]:::infra
        DOCKER["Docker Network"]:::infra
    end

    subgraph "Frontend Layer"
        FE["React/TypeScript SPA"]:::frontend
    end

    subgraph "Backend"
        APIGW["API Gateway (8080)"]:::gateway
        subgraph "Auth Service"
            AUTH["Auth Service (8001)"]:::service
        end
        subgraph "Portfolio Service"
            PORT["Portfolio Service (8002)"]:::service
        end
        subgraph "News Service"
            NEWS["News Service (8003)"]:::service
        end
    end

    subgraph "Data Layer"
        PG_AUTH["Postgres Auth DB"]:::db
        PG_PORT["Postgres Portfolio DB"]:::db
        PG_NEWS["Postgres News DB"]:::db
        REDIS["Redis Cache"]:::cache
    end

    subgraph "Machine Learning"
        ML_SERVE["ML Serving Service"]:::ml
    end

    subgraph "External APIs"
        MARKET_API["Alpha Vantage / Finnhub"]:::external
        NEWS_API["NewsAPI"]:::external
    end

    FE -->|HTTP/WebSocket| NGINX
    NGINX -->|routes| APIGW
    APIGW -->|auth requests| AUTH
    APIGW -->|portfolio requests| PORT
    APIGW -->|news requests| NEWS

    AUTH -->|reads/writes| PG_AUTH
    PORT -->|reads/writes| PG_PORT
    PORT -->|cache lookup| REDIS
    PORT -->|market data| MARKET_API
    NEWS -->|reads/writes| PG_NEWS
    NEWS -->|news data| NEWS_API
    NEWS -->|sentiment analysis| ML_SERVE
    PORT -->|prediction requests| ML_SERVE

    %% Click Events
    click FE "https://github.com/shashwat-akhilesh-shukla/fintracker/tree/main/frontend/"
    click APIGW "https://github.com/shashwat-akhilesh-shukla/fintracker/blob/main/backend/api-gateway/app/main.py"
    click AUTH "https://github.com/shashwat-akhilesh-shukla/fintracker/tree/main/backend/auth-service/"
    click PORT "https://github.com/shashwat-akhilesh-shukla/fintracker/tree/main/backend/portfolio-service/"
    click NEWS "https://github.com/shashwat-akhilesh-shukla/fintracker/tree/main/backend/news-service/"
    click ML_SERVE "https://github.com/shashwat-akhilesh-shukla/fintracker/tree/main/ml/"
    click DOCKER "https://github.com/shashwat-akhilesh-shukla/fintracker/blob/main/docker-compose.yml"

    classDef frontend fill:#ffeedb,stroke:#d4a373,stroke-width:1px
    classDef gateway fill:#d0e1f9,stroke:#40739e,stroke-width:1px
    classDef service fill:#e3f9d2,stroke:#27ae60,stroke-width:1px
    classDef db fill:#ffe3e3,stroke:#c0392b,stroke-width:1px
    classDef cache fill:#e3e3ff,stroke:#8c7ae6,stroke-width:1px
    classDef external fill:#f3f3f3,stroke:#7f8c8d,stroke-width:1px,stroke-dasharray: 5 5
    classDef ml fill:#f9d1e3,stroke:#c71585,stroke-width:1px
    classDef infra fill:#d9d9d9,stroke:#2f3640,stroke-width:1px,stroke-dasharray: 2 2
```
