Automated performance quality gates, multi-bundler tracking, and AI-powered regression analysis for Pull Requests.
DeployGuard is a full-stack, enterprise-grade GitHub App that detects and blocks performance regressions (bundle size bloat, database N+1 query regressions, and API latency spikes) before they hit production. It automatically opens zero-configuration setup PRs for new repos, generates native GitHub Check Runs and rich PR comments, identifies recurring regression patterns, and provides visual chunk-level breakdowns with Groq-powered AI explanations.
- β‘ Zero-Friction Onboarding β Installing the GitHub App automatically detects your build tool (
Vite,Next.js,Webpack,Create React App) and creates a ready-to-merge setup PR (deployguard/setup) containing the exact GitHub Actions workflow needed. - π¦ Multi-Bundler Support β Unified parsing engine normalizes build manifests from Vite (
dist/assets), Next.js (.next/build-manifest.json), and Webpack (stats.json) into consistent chunk metrics. - π Real Database Query Regression Guard β Detects N+1 queries, unindexed lookups, and unbounded fetch loops by ingesting test-suite query counts via
@deployguard/query-counteror lightweight ORM middleware (Prisma, TypeORM, Drizzle). - π Webhook Idempotency & Resilient Pipeline β Database constraints (
uniq_repo_pr_sha) andx-github-deliverydeduplication prevent race conditions. Artifact downloads feature exponential retry backoff (250ms, 1s, 4s) to tolerate GitHub API availability delays. - π Visual Chunk Diff Breakdown β Pinpoints the top 5 chunks with the highest size deltas between PR head and base commits, rendered as horizontal visual bar charts directly inside the dashboard.
β οΈ Proactive Trend Warnings β Historical pattern analyzer flags recurring regression causes across recent failing checks (e.g. flagging repeated dependency additions or unpaginated queries).- π€ 3-Tier NLP & Dual-Path AI Diagnostics β Commits are classified by a local SentenceTransformer model (<50ms, Tier 1) with Groq LLaMA 3.1-8b fallback (Tier 2). Actionable markdown explanations and copy-pasteable fix commands are posted directly onto PRs.
- π» Developer-Grade UI β Built on a high-contrast near-black technical token system (
#0D0F12,#161A1F,#252B32), signal green/red pass/fail indicators, expandable check detail rows, and functional monospace typography.
DeployGuard uses a decentralized measurement pattern to guarantee security, scalability, and zero compute overhead:
[ Developer opens PR / pushes code ]
β
βΌ
[ GitHub Actions Runner ] ββ builds app + runs tests βββΆ uploads bundle-stats artifact
β (stats.json + query-stats.json)
β workflow_run.completed webhook
βΌ
[ Express.js Webhook Server ] ββ downloads artifact with backoff βββΆ normalizes metrics
β
ββββΆ [ PostgreSQL ] (stores repos, baselines, checks, causes, trends)
β
ββββΆ [ FastAPI NLP Service ]
β
βββ Local SentenceTransformer classifier (<50 ms, Tier 1)
βββ Groq LLaMA 3.1-8b fallback (~200 ms, Tier 2)
βββ Graceful degradation (Tier 3)
β
βΌ Structured Explanation & Summaries
β
βΌ
[ GitHub Check Run + PR Comment ] posted directly back to the Pull Request
β
βΌ
[ React 18 Technical Dashboard ] β visual chunk diffs, trend graphs, threshold gates
| Service | Stack | Port | Responsibility |
|---|---|---|---|
apps/server |
Node.js 20 Β· Express 4 Β· @octokit/app | 3000 |
Webhook ingestion, tool detection, auto-PRs, DB, OAuth |
apps/nlp |
Python 3.11 Β· FastAPI Β· SentenceTransformers | 8000 |
ML commit classification, Groq LLaMA 3.1 explanations |
apps/web |
React 18 Β· Vite Β· Recharts Β· Tailwind CSS | 5173 |
Developer dashboard, visual chunk diffs, threshold controls |
Deploy-Guard/
β
βββ .github/
β βββ workflows/
β βββ bundle-analysis.yml # DeployGuard's self-monitoring CI & test pipeline
β
βββ apps/
β β
β βββ server/ # Node.js Β· Express Β· @octokit/app
β β βββ index.js # Server bootstrap & CORS
β β βββ Dockerfile # Production container
β β βββ package.json
β β βββ test/
β β β βββ pipeline.test.js # End-to-end smoke test (PR open β workflow completed)
β β βββ src/
β β βββ webhook.js # Webhook event orchestrator (PR, workflow_run, installation)
β β βββ detect.js # Automatic build tool detector (Vite, Next.js, Webpack, CRA)
β β βββ workflowTemplates.js # Tool-specific GitHub Actions workflow generator
β β βββ metrics.js # Pass/fail threshold and delta computation
β β βββ comment.js # Markdown PR comment builder
β β βββ db.js # PostgreSQL pool, queries, trends, auto-migrations
β β βββ analysers/
β β β βββ bundle.js # Multi-format artifact parser & computeChunkDiff
β β β βββ packageDiff.js # package.json diffing between base and head SHA
β β βββ nlp/
β β β βββ client.js # Client for the FastAPI NLP service
β β βββ routes/
β β β βββ api.js # REST routes for repos, checks, thresholds, setup status
β β βββ utils/
β β β βββ groqExplain.js # Dual-path Groq AI client with local fallback
β β βββ __tests__/
β β βββ bundle.test.js # Unit tests for multi-format parser & chunk diffing
β β βββ onboarding.test.js # Unit tests for tool detection & workflow templates
β β βββ queryCount.test.js # Unit tests for query_count metric delta computation
β β βββ webhook.test.js # Webhook handling unit tests
β β
β βββ nlp/ # Python 3.11 Β· FastAPI Β· SentenceTransformers Β· Groq
β β βββ main.py # FastAPI routes (/classify, /explain, /summarize, /review)
β β βββ ai_features.py # Groq prompts for regressions, summaries, and reviews
β β βββ groq_client.py # Shared async Groq API client
β β βββ train_v2.py # Trains SentenceTransformer model (incl. query regressions)
β β βββ model_v2.pkl # Baked serialized model
β β βββ requirements.txt
β β βββ Dockerfile # Production container
β β
β βββ web/ # React 18 Β· Vite Β· Recharts Β· Tailwind CSS
β βββ index.html
β βββ vite.config.js
β βββ src/
β β βββ App.jsx # Application router
β β βββ api.js # API client
β β βββ index.css # Technical design token system & hairline panels
β β βββ components/
β β β βββ AIReviewCard.jsx # AI health review with visual chunk diff (Recharts BarChart)
β β β βββ Badge.jsx # Technical signal pass/fail badge
β β β βββ CheckRow.jsx # Expandable row with semantic status stripe
β β β βββ MetricChart.jsx # Technical dark Recharts trendline with baseline markers
β β β βββ Navbar.jsx # Monospace user nav & repository links
β β β βββ ParticleBackground.jsx # Minimalist technical coordinate grid background
β β β βββ RepoCard.jsx # Flat panel card with active focal point indicator
β β βββ pages/
β β βββ Dashboard.jsx # Repository list, setup banners, active repository focus
β β βββ RepoDetail.jsx # Hero trendline, check history table, chunk breakdown
β β βββ Settings.jsx # Threshold configuration UI
β β βββ Login.jsx # Landing page with GitHub OAuth
β β βββ Docs.jsx # In-app reference & setup documentation
β β βββ AuthCallback.jsx # OAuth redirect handler
β βββ dist/ # Production build bundle
β
βββ db/
β βββ migrations/
β βββ 001_initial.sql # Base schema (repos, baselines, checks, causes, users)
β βββ 002_idempotency.sql # Unique constraints and delivery ID indexing
β βββ 003_onboarding.sql # Build tool and setup PR tracking columns
β βββ 004_query_tracking.sql # Query tracking enabled threshold configuration
β
βββ docs/
β βββ onboarding.md # Manual setup workflow documentation
β βββ query-tracking.md # ORM integration guide for query count tracking
β
βββ package.json # npm workspaces root
βββ render.yaml # Render deployment configuration
The server self-migrates on boot (db.js auto-creates tables and idempotent constraints). The db/migrations/ SQL files serve as formal versioned references:
erDiagram
repos ||--o{ baselines : "has"
repos ||--o{ checks : "has"
checks ||--o{ regression_causes : "contains"
users ||--o{ repos : "administers"
repos {
uuid id PK
bigint github_repo_id UK
text owner
text name
bigint install_id
text build_tool
text setup_pr_url
text setup_status
jsonb threshold_config
timestamptz created_at
}
baselines {
uuid id PK
uuid repo_id FK
text branch
text metric
numeric value
text commit_sha
timestamptz recorded_at
}
checks {
uuid id PK
uuid repo_id FK
int pr_number
text head_sha
text base_sha
text status
text github_delivery_id
jsonb results
timestamptz created_at
}
regression_causes {
uuid id PK
uuid check_id FK
text cause_type
text detail
numeric confidence
timestamptz created_at
}
users {
uuid id PK
bigint github_user_id UK
text username
text avatar_url
text access_token
timestamptz created_at
}
| Table | Purpose |
|---|---|
repos |
Repository metadata, detected build_tool, automated setup_pr_url, setup_status (pending, pr_open, merged), and threshold configuration JSONB |
baselines |
Per-branch recorded snapshots of bundle_kb, query_count, and api_p95_ms β the ground-truth values all PRs are evaluated against |
checks |
Analysis runs per PR; enforces uniqueness on (repo_id, pr_number, head_sha) and tracks github_delivery_id for idempotency |
regression_causes |
NLP classification output β cause type (e.g. new_dependency, query_regression, asset_added) with confidence rating |
users |
Authenticated users via GitHub OAuth |
DeployGuard supports tracking database query frequencies during test suites to catch N+1 queries before merge:
Tenant test runners output dist/query-stats.json alongside dist/stats.json:
{
"queryCount": 42
}Add this to your Jest / Vitest test setup file (setupTests.ts):
import fs from 'fs';
import { prisma } from './prismaClient';
let queryCount = 0;
prisma.$use(async (params, next) => {
queryCount++;
return next(params);
});
afterAll(() => {
if (!fs.existsSync('dist')) fs.mkdirSync('dist', { recursive: true });
fs.writeFileSync('dist/query-stats.json', JSON.stringify({ queryCount }));
});Upload both files in the same bundle-stats artifact step:
- name: Upload bundle & query stats
uses: actions/upload-artifact@v4
with:
name: bundle-stats
path: dist/Enable query tracking per repository in the Settings view or via threshold configuration (query_tracking_enabled: true).
The commit classification pipeline categorizes commit messages into semantic root causes:
Commit messages βββΆ Tier 1: Local SentenceTransformer (all-MiniLM-L6-v2)
Latency: <50 ms | Cost: $0
β confidence < 0.55
Tier 2: Groq LLaMA 3.1-8b-instant
Latency: ~200 ms | Cost: minimal
β rate-limited / offline
Tier 3: Top local prediction (graceful degradation)
10 Semantic Commit Classes:
new_dependency: A new package was addeddependency_upgrade: An existing package was upgradedquery_regression: N+1 query patterns, missing database indexes, unpaginated fetcheslatency_spike: Blocking synchronous I/O or heavy computation in request pathsasset_added: Heavy static assets (images, fonts, PDFs, icons) bundledfeature: New component or product featurerefactor: Structural code cleanup with no functional changefix: Bug fix commitstest: Test harness additionschore/docs: Config or documentation changes
| Method | Endpoint | Auth | Description |
|---|---|---|---|
GET |
/auth/github |
β | Initiates GitHub OAuth authentication |
GET |
/auth/github/callback |
β | Exchanges code for access token, stores user, redirects to web |
GET |
/api/repos |
Bearer | Lists all connected repositories with latest check and setup state |
GET |
/api/repos/:owner/:name/checks |
Bearer | Retrieves check runs with regression causes for a repo |
GET |
/api/repos/:owner/:name/setup |
Bearer | Returns automated setup PR URL and onboarding status |
GET |
/api/repos/:owner/:name/thresholds |
Bearer | Returns repository threshold configuration gates |
PUT |
/api/repos/:owner/:name/thresholds |
Bearer | Updates threshold limits and query tracking toggles |
GET |
/api/repos/:owner/:name/ai-review |
Bearer | Returns Groq AI health report, recurring trend warnings, and chunk diffs |
POST |
/api/github/webhooks |
HMAC | Signed GitHub App webhook receiver |
| Method | Endpoint | Request Body | Description |
|---|---|---|---|
POST |
/classify |
{ message: string } |
Classifies a single commit message |
POST |
/classify/batch |
{ messages: string[] } |
Classifies multiple commit messages |
POST |
/explain |
{ bundle_delta_kb, added_packages, ... } |
Generates a 3-part regression explanation |
POST |
/summarize |
{ bundle_delta_kb, ... } |
Generates positive check summary for passing PRs |
POST |
/review |
{ repo_name, trend_warning, ... } |
Generates structured project health review |
GET |
/health |
β | Health check probe |
- Node.js 20+
- Python 3.11+
- PostgreSQL 15+ (local or Neon)
- GitHub App with
Checks: write,Pull requests: write,Contents: write,Actions: readpermissions.
git clone https://github.com/Saksham842/Deploy-Guard.git
cd Deploy-Guard
# Install root workspaces (server + web)
npm install
# Setup NLP service virtual environment
cd apps/nlp
python -m venv venv
# Activate virtualenv
source venv/bin/activate # macOS / Linux
# .\venv\Scripts\activate # Windows PowerShell
pip install -r requirements.txt
python train_v2.py # Generates local classification model
cd ../..Create .env in the root directory based on .env.example:
PORT=3000
DATABASE_URL=postgres://user:password@localhost:5432/deployguard
GITHUB_APP_ID=123456
GITHUB_CLIENT_ID=Iv1.your_client_id
GITHUB_CLIENT_SECRET=your_client_secret
GITHUB_WEBHOOK_SECRET=your_webhook_secret
GITHUB_PRIVATE_KEY=base64_encoded_private_key
NLP_SERVICE_URL=http://localhost:8000
GROQ_API_KEY=gsk_your_groq_api_key
FRONTEND_URL=http://localhost:5173
BACKEND_URL=http://localhost:3000Create apps/web/.env:
VITE_API_URL=http://localhost:3000
VITE_GITHUB_CLIENT_ID=Iv1.your_client_idTerminal 1 β Backend & Frontend:
npm run devTerminal 2 β NLP Microservice:
cd apps/nlp
source venv/bin/activate
uvicorn main:app --reload --port 8000- Dashboard:
http://localhost:5173 - Server API:
http://localhost:3000 - NLP Service:
http://localhost:8000 - NLP Swagger Docs:
http://localhost:8000/docs
# Run backend test suite (unit + pipeline smoke tests)
npm test --workspace=@deployguard/server
# Build production frontend bundle
npm run build --workspace=@deployguard/webDeployGuard includes automated tests covering all critical pipeline components:
bundle.test.js: Validates ZIP extraction, artifact retry backoff, multi-format normalization (Vite, Next.js, Webpack), and top-5 chunk delta calculations.pipeline.test.js: End-to-end smoke test validatingpull_request.openedβworkflow_run.completedexecution and webhook idempotency deduplication.queryCount.test.js: Validates active query delta computation and threshold evaluation.onboarding.test.js: Validates automatic build tool detection and YAML workflow generation.webhook.test.js: Validates webhook event handling and database integration.
| Component / Feature | Milestone | Status |
|---|---|---|
| Webhook Idempotency & Delivery Deduplication | Phase 0 | β Complete |
| Artifact Download Retry with Exponential Backoff | Phase 0 | β Complete |
| End-to-End Pipeline Smoke Test | Phase 0 | β Complete |
Automatic Build Tool Detection (detect.js) |
Phase 1 | β Complete |
Automated Setup PR Generation (deployguard/setup) |
Phase 1 | β Complete |
| Dashboard Setup Status & Action Banners | Phase 1 | β Complete |
| Multi-Bundler Support (Vite, Next.js, Webpack) | Phase 2 | β Complete |
Database query_count Metric Calculation |
Phase 3 | β Complete |
| Prisma / ORM Test Runner Contract | Phase 3 | β Complete |
| NLP Classifier Retraining for Query Regressions | Phase 3 | β Complete |
| Proactive Trend & Recurrence Warning Detection | Phase 4 | β Complete |
| Visual Chunk Diff Breakdown (Recharts Bar Chart) | Phase 4 | β Complete |
| Technical Dark Theme & Developer Token System | Phase 5 | β Complete |
| Semantic Pass/Fail Left Indicator Stripes | Phase 5 | β Complete |
| Expandable Check Rows with Cause Diagnostics | Phase 5 | β Complete |
| Differentiated Strengths / Risks / Recommendations AI Cards | Phase 5 | β Complete |
| Active Focal Point on Repository Directory | Phase 5 | β Complete |
Developed and maintained by Saksham Hans.