Production-grade event-driven fintech analytics platform for transactions, portfolios, market data, fraud, risk, observability, and AI-style anomaly detection.
Overview β’ Features β’ Screenshots β’ Architecture β’ Quick Start β’ API β’ Troubleshooting
Real-Time Financial Analytics Platform is a portfolio-grade fintech simulation system that ingests financial transactions, simulates market prices, calculates portfolio performance, classifies fraud and risk alerts, and exposes operational metrics through Prometheus and Grafana.
The project is designed to demonstrate senior-level engineering across backend systems, event-driven architecture, data engineering, observability, DevSecOps, cloud-ready deployment, and full-stack product delivery.
It simulates how a fintech organization could process market and transaction events across a streaming architecture while maintaining operational visibility through dashboards and metrics.
|
|
|
|
Python Backend |
FastAPI API |
Kafka Streaming |
PostgreSQL Database |
Redis Cache |
|
React Frontend |
Docker Runtime |
Kubernetes Orchestration |
GitHub Actions CI/CD |
AWS Cloud Design |
flowchart TD
A[React Analytics Dashboard] --> B[FastAPI Backend]
B --> C[(PostgreSQL)]
B --> D[(Redis Cache)]
B --> E[Kafka Broker]
E --> F[Transaction Events]
E --> G[Market Price Events]
B --> H[Fraud Rules Engine]
B --> I[Risk Analytics Engine]
B --> J[AI-Style Anomaly Scoring]
H --> K[Alerts]
I --> K
J --> K
B --> L[Prometheus Metrics]
L --> M[Grafana Dashboard]
N[Airflow DAGs] --> O[PySpark Batch Jobs]
User Opens React Dashboard
β
User Clicks Generate Live Events
β
FastAPI Creates Simulated Transactions and Market Events
β
Transaction Data Is Persisted in PostgreSQL
β
Kafka Event Publishing Simulates Streaming Architecture
β
Anomaly Scoring Calculates Transaction Risk Probability
β
Fraud Rules Engine Creates High-Severity Alerts
β
Portfolio Valuation and Performance Metrics Are Refreshed
β
React Dashboard Displays Portfolio, Market, Fraud, Risk, and Transaction Data
β
Prometheus Scrapes API Metrics
β
Grafana Visualizes API Request and Latency Metrics
| Step | What Happens |
|---|---|
| 1 | Dashboard checks backend health and displays online/offline status |
| 2 | Demo event generation creates realistic transaction and market records |
| 3 | Backend persists transactions, prices, alerts, and portfolio state |
| 4 | Fraud and anomaly logic classify suspicious transactions |
| 5 | Dashboard fetches summarized analytics from backend APIs |
| 6 | Prometheus scrapes /metrics from FastAPI |
| 7 | Grafana displays platform-level observability metrics |
erDiagram
USERS ||--o{ PORTFOLIOS : owns
USERS ||--o{ TRANSACTIONS : creates
PORTFOLIOS ||--o{ HOLDINGS : contains
PORTFOLIOS ||--o{ TRANSACTIONS : records
PORTFOLIOS ||--o{ RISK_METRICS : has
PORTFOLIOS ||--o{ ALERTS : triggers
ASSETS ||--o{ HOLDINGS : held_as
ASSETS ||--o{ TRANSACTIONS : traded_as
ASSETS ||--o{ MARKET_PRICES : priced_as
| Entity | Purpose |
|---|---|
users |
Demo users and authentication records |
assets |
Tradable instruments such as AAPL, MSFT, NVDA, JPM |
portfolios |
User-owned investment portfolios |
holdings |
Asset quantities and average cost basis |
transactions |
Buy/sell activity with anomaly scores |
market_prices |
Simulated market price snapshots |
alerts |
Fraud, risk, and anomaly alerts |
risk_metrics |
Portfolio-level risk calculations |
curl http://localhost:8000/health
curl http://localhost:8000/ready
curl http://localhost:8000/metricscurl -X POST "http://localhost:8000/api/v1/demo/generate-events?count=20"
curl -X POST "http://localhost:8000/api/v1/market/simulate?count=10"curl http://localhost:8000/api/v1/dashboard/summarycurl http://localhost:8000/api/v1/transactionscurl http://localhost:8000/api/v1/alerts| Method | Endpoint | Purpose |
|---|---|---|
| GET | /health |
Backend liveness check |
| GET | /ready |
Backend readiness check |
| GET | /metrics |
Prometheus metrics endpoint |
| POST | /api/v1/auth/register |
Register demo user |
| POST | /api/v1/auth/login |
Demo login |
| GET | /api/v1/assets |
List supported assets |
| POST | /api/v1/assets |
Create asset |
| GET | /api/v1/portfolios |
List portfolios |
| POST | /api/v1/portfolios |
Create portfolio |
| POST | /api/v1/portfolios/{portfolio_id}/holdings |
Add portfolio holding |
| GET | /api/v1/portfolios/{portfolio_id}/performance |
Portfolio performance |
| GET | /api/v1/transactions |
List transactions |
| POST | /api/v1/transactions |
Create transaction |
| GET | /api/v1/market/prices |
List latest market prices |
| POST | /api/v1/market/prices |
Create market price |
| POST | /api/v1/market/simulate |
Simulate market updates |
| GET | /api/v1/risk/portfolio/{portfolio_id} |
Portfolio risk summary |
| GET | /api/v1/alerts |
List risk/fraud alerts |
| GET | /api/v1/dashboard/summary |
Frontend analytics payload |
| POST | /api/v1/demo/generate-events |
Generate demo transaction events |
π Folder Structure
real-time-financial-analytics-platform/
βββ .github/
β βββ workflows/ # GitHub Actions CI/CD
βββ backend/
β βββ app/ # FastAPI application
β β βββ main.py # API startup and route registration
β β βββ models.py # SQLAlchemy models
β β βββ schemas.py # Pydantic schemas
β β βββ db.py # Database session/config
β β βββ security.py # Demo auth/password helpers
β β βββ metrics.py # Prometheus metrics
β βββ tests/ # Unit/integration tests
β βββ Dockerfile
β βββ requirements.txt
βββ frontend/
β βββ src/ # React dashboard
β βββ public/ # Static assets/favicon
β βββ Dockerfile
β βββ package.json
βββ data-engineering/
β βββ airflow/ # Airflow DAGs
β βββ spark/ # PySpark jobs
βββ infrastructure/
β βββ docker-compose.yml # Local full-stack runtime
β βββ k8s/ # Kubernetes manifests
βββ monitoring/
β βββ prometheus/ # Prometheus configuration
β βββ grafana/ # Grafana datasource/dashboard provisioning
βββ docs/
β βββ screenshots/ # README screenshots
βββ sample-data/ # Demo data samples
βββ Jenkinsfile
βββ .env.example
βββ .gitignore
βββ LICENSE
βββ README.md
| Requirement | Version |
|---|---|
| Docker Desktop | Latest |
| Docker Compose | v2+ |
| Git | Any recent version |
| Python | 3.11 optional |
| Node.js | 20+ optional |
cp .env.example .env
docker compose -p rtfa -f infrastructure/docker-compose.yml up --buildOpen:
API Docs: http://localhost:8000/docs
Frontend: http://localhost:5173
Grafana: http://localhost:3000
Prometheus: http://localhost:9090
Grafana local login:
username: admin
password: admin
Use the frontend button:
Generate Live Events
Or use curl:
curl -X POST "http://localhost:8000/api/v1/demo/generate-events?count=20"docker compose -p rtfa -f infrastructure/docker-compose.yml down -v --remove-orphans
docker compose -p rtfa -f infrastructure/docker-compose.yml build --no-cache
docker compose -p rtfa -f infrastructure/docker-compose.yml upPrometheus scrapes FastAPI metrics from:
http://backend:8000/metrics
Useful Prometheus queries:
up
finanalytics_api_requests_total
finanalytics_api_latency_seconds_count
Grafana includes a local dashboard for:
- API request volume
- API latency
- Backend availability
- Platform observability proof
flowchart LR
A[Route 53] --> B[CloudFront]
B --> C[S3 React Frontend]
B --> D[Application Load Balancer]
D --> E[EKS FastAPI Services]
E --> F[Amazon MSK Kafka]
E --> G[(RDS PostgreSQL)]
E --> H[(ElastiCache Redis)]
E --> I[S3 Data Lake]
I --> J[MWAA Airflow]
J --> K[EMR / Glue PySpark]
E --> L[CloudWatch]
E --> M[Prometheus + Grafana]
cd backend
python -m venv .venv
source .venv/bin/activate # Windows: .venv\\Scripts\\activate
pip install -r requirements.txt
pytest testsruff check app tests
bandit -r appcurl http://localhost:8000/health
curl http://localhost:8000/api/v1/dashboard/summary
|
|
| Skill Area | Demonstrated Through |
|---|---|
| Backend Engineering | FastAPI APIs, service logic, validation, health checks |
| System Design | Event-driven architecture, streaming topics, separate platform components |
| Data Engineering | Airflow/PySpark structure, market and transaction analytics flow |
| Full-Stack Development | React dashboard connected to backend APIs |
| Fintech Domain | Transactions, portfolios, market prices, risk, fraud, anomaly scoring |
| Database Design | PostgreSQL schema for users, portfolios, assets, transactions, alerts |
| Observability | Prometheus metrics and Grafana dashboard provisioning |
| DevOps | Docker Compose, Kubernetes manifests, GitHub Actions, Jenkinsfile |
| Cloud Architecture | AWS EKS/MSK/RDS/ElastiCache/MWAA/EMR deployment design |
| Portfolio Readiness | Screenshots, architecture diagrams, API docs, troubleshooting guidance |
Docker Desktop engine pipe error on Windows
Open Docker Desktop and wait until it says Docker is running.
Then run:
docker version
docker compose versionIf using WSL, enable Docker Desktop WSL integration and restart Docker Desktop.
Postgres role does not exist
This usually means an old Docker volume was reused.
Run:
docker compose -p rtfa -f infrastructure/docker-compose.yml down -v --remove-orphans
docker compose -p rtfa -f infrastructure/docker-compose.yml up --buildFrontend shows backend offline
Check backend health:
curl http://localhost:8000/healthThen reload:
http://localhost:5173
Grafana login failed
Use local Docker credentials:
admin / admin
GitHub login is not enabled in local Grafana unless a GitHub OAuth app is configured.
Prometheus page opens but shows no data
Run this query:
up
Then query:
finanalytics_api_requests_total
Open the frontend and generate events to increase metrics.
docker compose -p rtfa -f infrastructure/docker-compose.yml down -v --remove-orphans
docker compose -p rtfa -f infrastructure/docker-compose.yml build --no-cache
docker compose -p rtfa -f infrastructure/docker-compose.yml up| Priority | Improvement |
|---|---|
| High | Add WebSocket streaming instead of dashboard polling |
| High | Add dedicated Kafka consumer worker containers |
| High | Add Alembic migrations |
| High | Add JWT-protected dashboard routes |
| Medium | Add MLflow model registry for anomaly models |
| Medium | Add Terraform for AWS EKS/MSK/RDS/ElastiCache |
| Medium | Add Trivy image scanning to CI/CD |
| Medium | Add Helm chart for Kubernetes deployment |
| Low | Add synthetic load testing with Locust |
| Low | Add downloadable portfolio analytics reports |
This project is licensed under the MIT License.
This project uses simulated financial data and is intended for portfolio, engineering, and educational demonstration purposes only.
It is not financial advice and should not be used for real trading, investment decisions, or production financial operations.



