AI-Powered Code Analysis Platform
CodeGuard is a comprehensive code analysis platform that leverages AI agents to provide detailed insights into your GitHub repositories. It performs multi-faceted analysis including security scanning, code quality assessment, architecture review, dependency management, and trend analysis.
- Security Agent - Identifies security vulnerabilities and potential threats
- Code Quality Agent - Analyzes code quality metrics and best practices
- Architecture Agent - Reviews architectural patterns and design decisions
- Dependency Agent - Manages and analyzes project dependencies
- Documentation Agent - Evaluates documentation quality and coverage
- Trend Agent - Tracks development trends and patterns over time
- Static Tool Agent - Integrates with static analysis tools
- Summary Agent - Provides consolidated analysis reports
- Supervisor Agent - Orchestrates and coordinates all analysis agents
- Security vulnerability detection
- Code quality metrics and recommendations
- Architecture and design pattern analysis
- Dependency management and updates
- Documentation quality assessment
- Development trend analysis
- Static code analysis integration
- Seamless GitHub OAuth authentication
- Repository access and analysis
- Real-time synchronization with GitHub repositories
- Support for both public and private repositories
CodeGuard follows a modern microservices architecture:
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ Frontend │ │ Backend │ │ Database │
│ (Next.js) │◄──►│ (FastAPI) │◄──►│ (PostgreSQL) │
│ │ │ │ │ │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
▼
┌─────────────────┐
│ AI Agents │
│ Multi-Agent │
│ Analysis │
└─────────────────┘
Frontend:
- Next.js 15.5.4 with React 19
- TypeScript for type safety
- Tailwind CSS for styling
- NextAuth.js for authentication
- React Icons for UI components
Backend:
- FastAPI for high-performance API
- SQLAlchemy for database ORM
- PostgreSQL for data persistence
- Python-JOSE for JWT handling
- PyGithub for GitHub API integration
- Pydantic for data validation
Infrastructure:
- Docker & Docker Compose for containerization
- CORS middleware for cross-origin requests
- Health check endpoints for monitoring
- Docker and Docker Compose
- GitHub OAuth App (for authentication)
- Node.js 18+ (for development)
- Python 3.11+ (for backend development)
git clone https://github.com/yourusername/CodeGaurd.git
cd CodeGaurd
Create a .env
file in the root directory:
# Database Configuration
POSTGRES_DB=codeguard
POSTGRES_USER=postgres
POSTGRES_PASSWORD=your_password_here
DATABASE_URL=postgresql://postgres:your_password_here@db:5432/codeguard
# GitHub OAuth Configuration
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
# Security
SECRET_KEY=your_secret_key_here
NEXTAUTH_SECRET=your_nextauth_secret_here
NEXTAUTH_URL=http://localhost:3000
# API Configuration
API_V1_STR=/api/v1
PROJECT_NAME=CodeGuard
- Go to GitHub Settings > Developer settings > OAuth Apps
- Create a new OAuth App with:
- Application name:
CodeGuard
- Homepage URL:
http://localhost:3000
- Authorization callback URL:
http://localhost:3000/api/auth/callback/github
- Application name:
- Copy the Client ID and Client Secret to your
.env
file
# Start all services
docker-compose up -d
# View logs
docker-compose logs -f
The application will be available at:
- Frontend: http://localhost:3000
- Backend API: http://localhost:8000
- API Documentation: http://localhost:8000/docs
Verify the services are running:
# Check backend health
curl http://localhost:8000/health
# Check database connection
docker-compose exec db pg_isready -U postgres -d codeguard
- Navigate to http://localhost:3000
- Click "Sign in with GitHub"
- Authorize the CodeGuard application
- You'll be redirected to the dashboard
- Add Repository: Connect your GitHub repositories
- Start Analysis: Trigger comprehensive analysis using AI agents
- View Reports: Review detailed analysis results and recommendations
- Track Trends: Monitor code quality and security trends over time
The backend provides a comprehensive REST API:
# Get user projects
GET /api/v1/projects/
# Start analysis
POST /api/v1/analysis/start
{
"repository_url": "https://github.com/user/repo",
"analysis_type": "comprehensive"
}
# Get analysis results
GET /api/v1/analysis/{analysis_id}/results
cd frontend
npm install
npm run dev
cd backend
pip install -r requirements.txt
uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
# Create new migration
docker-compose exec backend alembic revision --autogenerate -m "Description"
# Apply migrations
docker-compose exec backend alembic upgrade head
- Backend:
GET /health
- Database: Built-in PostgreSQL health checks
- Frontend: Next.js built-in health monitoring
# View all logs
docker-compose logs -f
# View specific service logs
docker-compose logs -f backend
docker-compose logs -f frontend
docker-compose logs -f db
CodeGuard - Protecting your code with intelligent analysis 🛡️
- API Response Time: API calls that trigger a full repository analysis can be time-consuming due to the comprehensive nature of the AI agents' analysis. We are actively working on optimizing this process, potentially through asynchronous background jobs.