CodeGuardian is a software engineering analysis platform that automates codebase security audits, static SAST scanning, unit test synthesis, design pattern inspection, and architecture dependency mapping for GitHub repositories.
Simply provide a public or private GitHub repository URL. CodeGuardian fetches the source tree via the GitHub REST API, executes pattern-matching and AST parsing rules, and generates actionable findings with 1-click remediation diffs and downloadable executive audit reports.
- 🔍 Live GitHub Codebase Fetching: Connects directly to GitHub REST API to recursively inspect repository trees and source files.
- 🛡️ Static SAST Security Audit: Scans for OWASP Top 10 vulnerabilities, hardcoded secret tokens, unhandled
eval()invocations, and XSS rendering risks. - 🧪 Unit Test Generation: Inspects exported function signatures and synthesizes Vitest / Jest compatible test stubs.
- 📐 Code Quality & SOLID Review: Detects code smells, oversized files, nested loop complexity, and missing error handlers.
- 🕸️ Architecture Dependency Mapping: Parses import/require graphs to visualize module interaction topology.
- 📄 Executive Report Exporter: Downloads full audit packages in Markdown, HTML, PDF, JSON, and CSV formats.
- 🤖 Optional OpenAI GPT-4o Integration: Uses GPT-4o when an API key is provided, or seamlessly falls back to fast local static analysis.
CodeGuardian uses a multi-stage audit pipeline to process repositories concurrently:
flowchart TD
A[GitHub Repository URL] --> B[GitHub REST API Client]
B --> C[Source Tree & File Parser]
C --> D[Multi-Stage Analysis Pipeline]
subgraph Pipeline [Analysis Pipeline Engine]
D --> E[Security & SAST Module]
D --> F[Code Review & Quality Module]
D --> G[Testing & Synthesis Module]
D --> H[Architecture Topology Module]
D --> I[Documentation Module]
end
E --> J[Unified Finding & Issue Store]
F --> J
G --> J
H --> J
I --> J
J --> K[Executive Dashboard & Workbench]
J --> L[Report Exporter - Markdown/HTML/PDF/JSON/CSV]
- Framework: Next.js 14 (App Router, Server Actions, Route Handlers)
- Language: TypeScript
- Styling: Tailwind CSS + Dark Mode Theme
- UI Components: Lucide Icons, Monaco Editor (
@monaco-editor/react), Recharts - Database / ORM: Prisma + PostgreSQL (with fast in-memory fallback)
- Testing: Vitest
- AI Core: OpenAI GPT-4o API (optional)
git clone https://github.com/prajwal-mhase/CodeGuardian.git
cd CodeGuardian
npm installCopy .env.example to .env.local:
cp .env.example .env.localEdit .env.local:
# Optional: Increase GitHub API rate limit from 60 to 5,000 req/hr & scan private repos
GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_github_token
# Optional: Enable GPT-4o deep analysis (falls back to local AST parsing if empty)
OPENAI_API_KEY=sk-proj-your_openai_key
# Optional: PostgreSQL Database (defaults to in-memory store if omitted)
DATABASE_URL="postgresql://user:password@localhost:5432/codeguardian?sslmode=require"npm run devOpen http://localhost:3000 in your browser.
The fastest way to deploy CodeGuardian is with Vercel:
- Push your repository to GitHub.
- Import the repository into Vercel.
- Set your environment variables in Vercel settings.
- Click Deploy.
docker-compose up --build -dnpm run test| Endpoint | Method | Description |
|---|---|---|
/api/scan |
POST |
Triggers a scan pipeline for a target GitHub URL |
/api/repositories |
GET, POST |
Lists or connects analyzed repositories |
/api/reports/export |
GET |
Exports audit reports (?format=MARKDOWN|HTML|PDF|JSON|CSV) |
/api/health |
GET |
Health check endpoint |
Distributed under the MIT License. See LICENSE for details.