Skip to content

SentinelEngine/server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

19 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

⚑ Code. Cost. Control.

CloudGauge β€” Real-time cost intelligence directly inside your code editor.


πŸ“Œ Overview

Modern developers write code without visibility into the cloud costs it generates. Costs are only realized after deployment β€” often leading to unexpected bills.

This project solves that by shifting cost awareness from billing time β†’ coding time.

We provide:

  • Real-time cost estimation
  • Optimization suggestions
  • PR-level cost impact tracking
  • Tamper-proof cost logs using Web3

❗ Problem

  • No cost visibility during development
  • Billing feedback delayed by weeks
  • Expensive APIs and cloud usage go unnoticed
  • No accountability for cost-heavy code changes

πŸ’‘ Solution

β€œCloudGauge - ESLint for Cloud Costs”

A system that:

  • Analyzes your code as you write
  • Estimates cloud cost in real time
  • Suggests optimizations
  • Tracks cost changes across PRs
  • Ensures integrity via cryptographic proofs

✨ Features

πŸ”Ή Real-Time Cost Estimation

  • Detects cloud/API usage from code
  • Estimates monthly cost instantly

πŸ”Ή Optimization Suggestions

  • Suggests cheaper alternatives:
    • GPT-4 β†’ GPT-3.5
    • Add caching
    • Batch requests

πŸ”Ή PR Cost Diff

  • Compares cost before vs after changes
  • Prevents expensive code merges

πŸ”Ή Tamper-Proof Cost Logs (Web3)

  • Generates SHA-256 hash of cost reports
  • Stores hash on blockchain (Sepolia)
  • Ensures reports cannot be modified

πŸ”Ή Developer-First Experience

  • Integrated into VS Code
  • Inline feedback + suggestions
  • ESLint-like workflow

πŸ—οΈ Architecture

VS Code Extension
        ↓
Backend (TypeScript)
        ↓
AST Analysis Engine
        ↓
Cost Estimation Engine
        ↓
Database (Prisma)
        ↓
Hash Generation (SHA-256)
        ↓
Blockchain (Sepolia)

βš™οΈ Tech Stack

πŸ”Ή Frontend

  • VS Code Extension API

πŸ”Ή Backend

  • TypeScript
  • Node.js
  • AST Parsing (Babel / TypeScript Compiler API)

πŸ”Ή Database

  • Prisma ORM
  • PostgreSQL / MongoDB

πŸ”Ή Web3 Layer

  • Solidity (Smart Contract)
  • Ethers.js
  • Sepolia Testnet

πŸ” How It Works

1. Code Analysis

  • Parses code using AST
  • Detects usage of:
    • LLM APIs
    • Cloud services
    • External APIs

2. Cost Estimation

  • Maps usage β†’ pricing models
  • Calculates monthly cost projection

3. Optimization Engine

  • Identifies expensive patterns
  • Suggests cost-saving alternatives

4. PR Cost Diff

  • Compares:
    • Base branch cost
    • New branch cost
  • Outputs cost difference

5. Tamper-Proof Logging

  • Converts report β†’ JSON
  • Generates SHA-256 hash
  • Stores:
    • Full report β†’ DB
    • Hash β†’ Blockchain

πŸ” Web3 Integration

We use Web3 only for verification, not computation.

Flow

Cost Report β†’ Hash β†’ Store on Sepolia

Benefits

  • Immutable records
  • Verifiable cost history
  • Audit-ready system

πŸ§ͺ Demo Flow

  1. Open code in VS Code
  2. Detect API usage
  3. Show cost estimate
  4. Display optimization suggestions
  5. Show PR cost difference
  6. Modify report β†’ verification fails (tampering detected)

πŸ› οΈ Setup

πŸ”Ή Backend

npm install
npm run dev

πŸ”Ή Environment Variables

DATABASE_URL=...
RPC_URL=...
PRIVATE_KEY=...
CONTRACT_ADDRESS=...

πŸ”Ή VS Code Extension

npm install
npm run compile
# Press F5 to run extension

πŸ”Ή Smart Contract

  • Deploy contract on Sepolia
  • Store contract address in .env

πŸ“Š Example

// Before
use GPT-4 β†’ $200/month

// After optimization
use GPT-3.5 β†’ $40/month

// Add caching
β†’ $15/month

πŸš€ Future Scope

  • CI/CD integration (PR gating)
  • Multi-cloud support (AWS, GCP, Azure)
  • Advanced AI-based optimization
  • Cost heatmaps in editor
  • Enterprise dashboards
  • On-chain audit dashboards

🀝 Contribution

Contributions are welcome!

  • Fork the repository
  • Create a feature branch
  • Submit a pull request

🧠 Key Insight

β€œWe don’t just show developers that their code is expensive β€” we tell them how to make it cheaper, instantly.”


πŸ“œ License

MIT License

Releases

No releases published

Packages

 
 
 

Contributors