A FastAPI + Streamlit project for developer-market analytics (EDA) over the Stack Overflow Developer Survey. It exposes analytics endpoints for querying salary statistics and developer cohorts, plus a Streamlit dashboard frontend.
- FastAPI backend (
backend/main.py)GET /– dataset overview / system healthGET /analytics/salary– filter by country, programming language, and minimum years of experience to get salary statistics (mean, median, min, max)POST /analytics/cohort— build a custom developer cohort by countries, languages, and minimum salaryGET /analytics/salary-distribution— get cleaned salary values (1K–300K) for a country, used to build charts
- Streamlit dashboard (
frontend/app.py) — interactive UI for the salary and cohort endpoints - Visual analytics — the dashboard includes an interactive Plotly salary distribution histogram and a native Streamlit bar chart for the top experience levels
The project expects a cleaned_survey_data.csv file in data/. Place your own survey data there. If the file is missing, the API falls back to a small built-in sample dataset so the server still runs.
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtStart the API server:
uvicorn backend.main:app --reload- Interactive API docs: http://127.0.0.1:8000/docs
- Health check / overview: http://127.0.0.1:8000/
In a second terminal, launch the dashboard:
streamlit run frontend/app.pyThe dashboard points at http://127.0.0.1:8000 by default (see BASE_URL in frontend/app.py).
curl "http://127.0.0.1:8000/analytics/salary?country=Pakistan&language=Python&min_years_exp=2"curl -X POST "http://127.0.0.1:8000/analytics/cohort" \
-H "Content-Type: application/json" \
-d '{"countries": ["Pakistan", "India"], "languages": ["Python"], "min_salary": 50000, "limit": 10}'curl "http://127.0.0.1:8000/analytics/salary-distribution?country=Pakistan"Build and run the backend in a container:
docker build -f Dockerfile.fastapi -t devmetrix-api .
docker run -d -p 8000:8000 --name devmetrix-api devmetrix-apiThen access http://localhost:8000/docs.
.
├── backend/
│ └── main.py # FastAPI API — analytics endpoints
├── frontend/
│ └── app.py # Streamlit dashboard
├── data/
│ └── cleaned_survey_data.csv # Survey dataset
├── Dockerfile.fastapi # Docker image for the backend
├── requirements.txt # Python dependencies
└── README.md