MENU

GET IN TOUCH

manishprakkash@gmail.com
Back

Cloud Meter

Year

2025

Tech & Technique

AST Parsing, npm CLI, GraphQL, TypeScript, Prisma

Description

Problem: Most backend performance issues in production stem from poorly implemented pagination — unbounded queries, deep offsets, missing limits, and unstable sorting — that go undetected until they cause real scaling failures.

Solution: Built Cloud Meter, a production-grade CLI tool published to npm that statically analyzes backend codebases (no runtime required) using AST parsing to detect pagination anti-patterns, score the codebase from 0–100, and deliver actionable fix recommendations.

Key Features:
  • ☁️ Static AST Analysis: Scans JS/TS files, SQL queries, and ORM patterns without executing any code
  • 📊 Scoring Engine: 0–100 score with severity-based deductions — Missing LIMIT (−30), Deep OFFSET (−20), No ORDER BY (−15), and more
  • 🔍 12 Detection Rules: Catches missing LIMIT, deep OFFSET, unstable cursors, unbounded endpoints, dynamic sort injection, infinite scroll risks, and concurrent write exposure
  • 🛠️ Self-Guiding CLI: Every command outputs what to run next — fully interactive or headless CI mode
  • ⚙️ Config System: Project-level cloud-meter.config.json with saved defaults for path, output mode, severity threshold, and ignored directories
  • 🚦 CI/CD Integration: --mode ci exits with code 1 when findings exceed configured severity threshold — drop into any pipeline

Technical Implementation:
  • Built CLI with Node.js and TypeScript, published as cloud-meter on npm with global install support
  • Implemented AST-based pattern matching for Prisma, Mongoose, Sequelize, TypeORM, raw SQL, and GraphQL Relay-style resolvers
  • Designed a modular rulebook with configurable severity weights and heuristic penalties for dynamic sorting and concurrency risk
  • Added framework detection for Express, NestJS, Fastify, and Koa route/controller/service layers
  • Supported monorepo structures with auto-detection of apps/api, services/api, and backend directories
  • Persisted analysis cache for recommend command to serve fix recipes from the last scan without re-running

Impact: Delivered a zero-runtime, production-grade CLI that catches pagination scaling risks before they hit production — installable in one command, CI-ready out of the box, and covering the full ORM, SQL, and GraphQL ecosystem.

My Role

CLI Tool Author & Publisher
Designed, built, and published the full tool end-to-end:
  • 🏗️ Architecture: Designed the modular command structure (analyze, init, recommend, doctor, config) with a shared config loader and analysis cache
  • 🔬 Detection Engine: Implemented 12 AST-based detection rules targeting pagination anti-patterns across ORMs, raw SQL, and GraphQL resolvers
  • 📈 Scoring Model: Built the severity-weighted deduction system with grade thresholds (Production Grade → Critical)
  • 🚦 CI/CD Mode: Wired up non-interactive --mode ci with exit codes and JSON output for pipeline integration
  • 📦 npm Publishing: Packaged and published to npm as cloud-meter with global CLI entrypoint and TypeScript type checking
  • 🧪 Testing & Tooling: Added test suite, build pipeline, and local link workflow for iterative development
Cloud Meter screenshot 1
Cloud Meter screenshot 2
Cloud Meter screenshot 3

M.A.N.I.S.H

manishprakkash@gmail.com