Skip to content

Harish1604/costpilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CostPilot

Cloud Cost Optimization Dashboard for Google Cloud Run

CostPilot is a full-stack cloud analytics dashboard built to monitor deployed workloads, estimate cost usage, identify waste, and provide optimization recommendations for services running on Google Cloud Platform.

This project was built from a real problem: while deploying backend services for another project (HeliiX) on Google Cloud Run, cloud credits were being consumed faster than expected. That created the need for a lightweight internal tool that could visualize usage patterns, detect underutilized resources, and help make smarter infrastructure decisions.


Why I Built This

While using Google Cloud Run for production workloads, I noticed a common startup/student problem:

  • Credits disappear without clear visibility n- Hard to understand where cost is coming from
  • No simple custom dashboard for small projects
  • Existing enterprise FinOps tools are overkill for solo developers
  • Need practical insights, not just raw metrics

Instead of manually checking multiple cloud consoles, I built CostPilot as a centralized optimization dashboard.


Core Idea

Convert cloud infrastructure metrics into understandable business decisions.

Examples:

  • Low traffic at night → scale to zero n- Idle service → review necessity
  • High usage → optimize concurrency
  • Repeated usage spikes → investigate traffic pattern

Features

Frontend (React)

  • Professional dark-theme dashboard UI
  • KPI cards (Monthly Cost, Potential Savings, Waste Score)
  • Resource inventory table
  • CPU utilization charts
  • Savings breakdown chart
  • Recommendation cards
  • Auto-refresh ready architecture

Backend (FastAPI)

  • REST API endpoints
  • /resources
  • /summary
  • /recommendations
  • Data transformation layer
  • Cloud API integration

Google Cloud Integration

  • Google Cloud Run service discovery
  • Service account authentication
  • Ready for Monitoring metrics integration
  • Real deployed service visibility

Tech Stack

Layer Technology
Frontend React + Vite
Styling Tailwind CSS
Charts Recharts
Backend FastAPI
Language Python
Cloud Google Cloud Platform
Infra Service Cloud Run
Auth Service Account JSON

Architecture Diagram

Architecture


Dashboard Screenshots

Main Dashboard

Dashboard

You can add additional screenshots below:

![Dashboard 2](web2.png)
![Dashboard 3](web3.png)

Project Structure

costpilot/
├── frontend/
│   ├── src/
│   └── package.json
│
├── backend/
│   ├── main.py
│   ├── gcp_client.py
│   └── gcp-key.json (ignored)
│
└── README.md

API Endpoints

GET /resources

Returns detected cloud services.

GET /summary

Returns aggregated dashboard metrics.

GET /recommendations

Returns optimization suggestions.


Real Difficulties Faced During Development

This project involved practical cloud engineering issues beyond coding.

1. Google Cloud Authentication Conflicts

The SDK was using old cached credentials instead of the intended service account key.

Fix: Explicit credential loading using Python service account auth.

2. Wrong Project Context / API Permissions

Cloud APIs returned permission denied errors due to wrong project selection and disabled APIs.

Fix: Verified active project, enabled Cloud Run Admin API, corrected IAM roles.

3. Frontend / Backend Contract Mismatch

After backend data changed, frontend cards displayed undefined values.

Fix: Recomputed metrics dynamically from /resources response.

4. Cloud Metrics Complexity

Real metrics require correct filters, time intervals, permissions, and service labels.

Fix: Built integration incrementally rather than replacing everything at once.

5. Product Scope Control

It was tempting to overbuild. Instead, focus stayed on a useful MVP.


Key Learnings

  • Real cloud engineering is often configuration-heavy
  • Authentication problems can consume more time than coding
  • Build stable integrations first, then scale features
  • Good dashboards require clear UX, not only raw data
  • Solving your own real problem creates stronger products

Future Improvements

  • Real-time Monitoring API metrics
  • Cost prediction using ML
  • Multi-project support
  • Slack / Email alerts
  • PDF monthly reports
  • Historical trend storage
  • Role-based login system
  • Kubernetes / AWS support

Resume Value

This project demonstrates:

  • Full-stack development
  • Cloud integration
  • API design
  • Dashboard engineering
  • Cost optimization thinking
  • Real-world debugging
  • Product mindset

How to Run

Frontend

cd frontend
npm install
npm run dev

Backend

cd backend
pip install -r requirements.txt
uvicorn main:app --reload

Final Note

CostPilot was not created as a tutorial clone. It was created to solve a real cloud cost pain point using practical engineering.

That makes it more valuable than many generic student projects.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors