Skip to main content
Madhukar
Case StudyπŸš€ Autonomous AI Product Delivery Cockpit

VelocityAI

Autonomous Product Delivery & PR Review Cockpit

Full screenshot of VelocityAI application interface

Project Overview

VelocityAI is an all-in-one autonomous product delivery cockpit and AI-powered code review SaaS engineered to compress the entire software development lifecycleβ€”from raw feature ideation to production-ready releases. Traditional engineering teams suffer from acute friction: messy Slack/Notion feature ideas lead to ambiguous requirements and scope creep; engineering leads lose 3–5 hours per sprint manually sizing and decomposing PRDs into tickets; and senior engineers waste 30–40% of their work week in code review queues that only evaluate syntax rather than verifying whether code actually satisfies original business requirements.

VelocityAI replaces this disjointed chain with a cohesive, spec-aware agentic pipeline. It pairs an interactive Product Manager AI clarification agent with instant PRD compilation, specialty-aware task decomposition with real-time Pusher Kanban boards, an autonomous GitHub App that evaluates multi-file Git diffs against PRD acceptance criteria to compute mathematical compliance scores (0–100%), and a 3-mode AI Copilot that drafts multi-file code patches and opens Draft Pull Requests via the GitHub Git Data API in a single click.

Turborepo Monorepo Architecture & End-to-End Type Safety

VelocityAI is architected as a high-performance Turborepo monorepo comprising 1 Next.js 16 (App Router) application and 7 shared internal packages:

  • apps/web: Next.js 16 with React 19 Server Components, edge middleware, and dynamic client islands.
  • packages/database: PostgreSQL 15 schema definitions and migrations managed through Drizzle ORM.
  • packages/trpc: 14 modular sub-routers exposing fully typed procedures with Zod contract validation.
  • packages/services: Pure, deterministic business logic, mathematical compliance score calculators, and unit tests.
  • packages/logger & typescript-config: Structured logging and strict TypeScript 5.9 configurations.

By uniting PostgreSQL, Drizzle ORM, tRPC v11, and TanStack Query, the entire stack achieves 100% compile-time type safetyβ€”completely eliminating runtime API schema drift between backend mutations and client state.

AI Clarification Agent & Living PRD Studio

Feature development often derails at the definition stage because founders and PMs overlook edge cases. VelocityAI solves this with a two-stage discovery engine:

  • Autonomous Discovery Dialogue: When a raw prompt is submitted, an interactive Product Manager AI agent analyzes the request, surfaces latent ambiguities, and conducts 2–4 sharp clarification rounds with the user before locking the scope.
  • Structured PRD Compilation: Once locked, an Inngest background worker compiles the feature into an industry-grade 7-section PRD (Executive Problem, Goals & Non-Goals, Personas, Numbered Acceptance Criteria, Technical Edge Cases, Security Risks, and Estimated Hours).
  • Living Studio & PDF/Email Export: Features a rich Markdown editor with live preview, diff tracking, on-the-fly branded PDF generation, and automated email dispatch via Resend.

Specialty-Aware Task Decomposition & Real-Time Kanban

Decomposing a 10-page PRD into actionable Jira or Linear tickets consumes hours of engineering lead bandwidth. VelocityAI fully automates this handoff:

  • Domain Segmentation: Once a PRD receives human approval, an Inngest durable job parses acceptance criteria and segments them into 5 technical domains (frontend, backend, database, devops, qa).
  • Expertise-Based Auto-Assignment: The engine inspects team member profiles and assigns tasks based on registered specialties (SPECIALTY_TASK_TYPES), dynamically computing complexity points and delivery hours.
  • Pusher Real-Time Kanban: Features an interactive drag-and-drop Kanban board (Backlog β†’ In Progress β†’ In Review β†’ Done) synchronized across all active team members with sub-100ms latency via Pusher WebSocket channels.

Autonomous PRD-Aware GitHub Code Reviewer

Conventional CI/CD linters only verify syntax and formatting; they have no concept of whether a feature implements what was requested. VelocityAI bridges this gap:

  • HMAC-Verified Webhooks: Listens to GitHub App pull_request events (opened, synchronize, reopened), authenticating payloads with HMAC-SHA256 (x-hub-signature-256).
  • Diff Parsing & Criteria Mapping: Pulls modified file patches and commit history via Octokit, stripping noisy lockfiles and binaries to optimize LLM token usage.
  • Mathematical Compliance Scoring: Evaluates code changes against every individual PRD criterion (met = 100%, partial = 50%, not_met = 0%), computing a deterministic 0–100% Compliance Score.
  • Inline GitHub Review Comments: Posts structured, line-by-line feedback directly on the PR with severity tags: πŸ”΄ Blocking (merge prevention), 🟑 Warning (architectural/performance risk), and 🟒 Positive (clean implementation praise).
  • Status Checks: Automatically sets commit status checks (VelocityAI/prd-compliance) to guard merges.

AI Copilot Studio: Repo Context Indexer & Git Data API Automation

When review findings identify bugs or omissions, VelocityAI eliminates manual remediation overhead through an integrated Copilot Studio:

  • Semantic Repo Indexer: Indexes repository AST and directory trees into a compact context snapshot, auto-refreshed upon each PR merge.
  • Three Operational Modes:
  • Build Mode: Transforms feature prompts or PRD tasks into clean, multi-file code plans.
  • Fix Review Mode: Ingests PR review findings and generates targeted multi-file code patches.
  • Improve Mode: Refactors code for performance, security hardening, and test coverage.
  • One-Click Draft PR Creation: Interacts with the GitHub Git Data API (createBlob β†’ createTree β†’ createCommit β†’ createRef), committing patches directly to a new velocity/{featureId} branch and opening a Draft Pull Request without requiring a local CLI.

Resilient Durable Workflows (Inngest) & Zero-Timeout Fallbacks

Serverless platforms (Vercel, Render) enforce strict 30–60 second execution limits. Long-running AI audits that timeout risk dropping reviews, losing user trust, and burning unnecessary LLM credits:

  • Step Checkpointing: Built on Inngest event-driven step-functions with granular step.run checkpoints. If a step fails, it retries from that exact point without repeating costly LLM calls.
  • Automatic Inline Fallbacks: If external Inngest workers face network drops or queue delays, the system seamlessly triggers an in-process fallback runner, ensuring reviews execute to completion.
  • Idempotency Ledger: Incoming events are recorded in a transactional processed_webhook_event ledger table, preventing duplicate executions from retry spikes.

Multi-Tenant Security, BetterAuth RBAC & Metered Razorpay Subscriptions

Designed for enterprise-ready team collaboration with robust multi-tenant boundaries:

  • Data Isolation: All database tables enforce strict organization_id foreign keys with database-level cascading.
  • BetterAuth RBAC: Role-based access control across 5 tiers (Owner, Admin, Manager, Developer, Viewer) backed by edge middleware optimistic cookie verification and no-store bfcache prevention.
  • Metered Razorpay Billing: Integrates Razorpay subscriptions with a credit ledger (Free: 100 credits, Pro: 1000 credits, Scale: 5000 credits). AI operations consume credits with server-side pre-flight checks, failing gracefully with typed ReviewCreditError when exhausted.

Strict Release Gate & Production Ship Cockpit

To prevent premature merges and verify shipping readiness, VelocityAI enforces a 4-point release gate:

  1. 1PRD signed off by an authorized Product Manager or Admin.
  2. 2All engineering tasks moved to Done status.
  3. 3Linked GitHub PR merged with zero remaining blocking review issues.
  4. 4Explicit human sign-off recorded with immutable audit timestamp.

Once certified, the feature is locked to shipped status, dispatching real-time WebSocket broadcasts and email digests to stakeholders.

Engineering Challenges & Solutions

P

Challenge

Multi-File Git Diff Context Window Overflow & High LLM Token Costs: Pull requests with 20+ changed files and thousands of diff lines exceeded standard LLM context limits and inflated inference expenses.

S

Solution

Built an AST-guided diff pre-processor that strips binary assets and lockfiles, clusters related files by domain, and maps acceptance criteria to specific modified modules, reducing token consumption by 68% while maintaining review precision.

P

Challenge

Serverless Execution Timeouts & Dropped GitHub Webhooks: Cloud hosts (Render/Vercel) impose strict 30–60s request timeouts; long AI analysis cycles caused dropped webhooks, orphaned reviews, and wasted credits.

S

Solution

Implemented Inngest event-driven durable workflows with step.run checkpointing. Added an automated inline fallback executor that handles reviews synchronously if external queues experience network interruptions.

P

Challenge

Subjective AI Hallucinations vs Verifiable PRD Compliance: Generative models frequently generated arbitrary stylistic complaints or false-positive blockers without verifying if the original business spec was satisfied.

S

Solution

Enforced structured Zod schema outputs where the LLM evaluates each PRD acceptance criterion explicitly with ternary states (met = 100%, partial = 50%, not_met = 0%), computing a mathematically deterministic 0–100% compliance score.

P

Challenge

Webhook Race Conditions & Duplicate Event Retries: GitHub and Razorpay fire rapid retry webhooks during network latency, leading to duplicate review cycles, double-spent credits, and repeated comments.

S

Solution

Enforced HMAC-SHA256 signature verification (x-hub-signature-256) at the route boundary paired with a transactional processed_webhook_event ledger enforcing database-level unique constraints.

P

Challenge

Programmatic Multi-File Git Commits Without Shell or CLI: Generating AI code patches required developers to manually copy-paste code across files, create branches, and push commits.

S

Solution

Engineered a direct Git Data API pipeline (createBlob β†’ createTree β†’ createCommit β†’ createRef β†’ pulls.create), committing multi-file patches and opening Draft PRs programmatically without requiring a local clone or shell environment.

Technologies Used

Next.js 16React 19TypeScript 5.9tRPC v11Drizzle ORMPostgreSQL 15InngestVercel AI SDK 6Octokit (GitHub App)TurborepoBetterAuthRazorpayPusher WebSocketsTailwind CSSZod

Key Metrics & Results

  • Slashed PR review turnaround time from 24–48 hours to under 3 minutes (94% reduction).
  • Reduced PRD specification writing time from 8–12 hours to under 60 seconds (95% time saved for PMs).
  • Accelerated sprint planning & task sizing from 3–5 hours to instant automated decomposition (100% planning automation).
  • 75% faster bug and review remediation loop via one-click AI Copilot Draft PRs (saving 4–6 hours per feature).
  • 99.9% durable execution reliability with zero dropped webhooks and zero duplicate LLM token costs on retries.
  • 100% compile-time type safety across a Turborepo monorepo with 14 tRPC sub-routers and Drizzle ORM.
  • Transparent metered credit billing with Razorpay HMAC verification and database-backed audit ledgers.