Skip to content

tirth-patel06/Axions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

88 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Axions - AI-Powered GitHub Automation Platform

Axions Logo Axions

Automate your GitHub workflow with AI-powered code reviews and issue management

Node.js React MongoDB License

Live Demo β€’ API Server β€’ Documentation β€’ Contributing


πŸ“‹ Table of Contents


🎯 Overview

Axions is a SaaS platform that integrates with GitHub to provide:

  1. πŸ” AI-Powered Code Reviews - Automatically reviews pull requests and provides inline comments with suggestions
  2. 🏷️ Smart Issue Labeling - Automatically categorizes and labels issues based on content
  3. πŸ“ Issue Summarization - Generates concise summaries for new issues
  4. πŸ“Š Analytics Dashboard - Track your team's productivity and code quality metrics

The Problem It Solves

  • Code Review Bottleneck: Senior developers spend hours reviewing PRs manually
  • Inconsistent Issue Triage: Issues sit unlabeled, making prioritization hard
  • Lack of Visibility: No insights into review patterns and team productivity

The Solution

Axions acts as an AI teammate that:

  • Reviews every PR instantly with consistent quality
  • Labels and summarizes issues automatically
  • Provides actionable analytics to improve your workflow

✨ Features

πŸ” AI Code Review

  • Inline Comments: Line-by-line feedback on code changes
  • PR Summary: Comprehensive review with overall assessment
  • Smart Detection: Identifies bugs, security issues, and code smells
  • Instant Feedback: Reviews posted within seconds of PR creation

🏷️ Issue Management

  • Auto-Labeling: Categorizes issues (bug, feature, priority, etc.)
  • Color-Coded Labels: Consistent label colors across repos
  • AI Summaries: Concise issue summaries posted as comments

πŸ“Š Analytics Dashboard

  • Review Metrics: PRs reviewed, comments posted, files analyzed
  • Issue Metrics: Issues triaged, labels applied
  • Time Series: Activity trends over time
  • Repo Comparison: Compare performance across repositories
  • Error Tracking: Monitor and debug failures

πŸ” Security

  • GitHub OAuth: Secure authentication via GitHub
  • Webhook Signatures: HMAC-SHA256 verification for all webhooks
  • Token Encryption: Secure storage of access tokens

πŸ› οΈ Tech Stack

Frontend

Technology Purpose
React 19 UI framework
Vite Build tool & dev server
Tailwind CSS Styling
React Router Navigation
Lucide Icons UI icons

Backend

Technology Purpose
Node.js Runtime
Express Web framework
MongoDB Database
Mongoose ODM
Passport.js GitHub OAuth
esbuild Server bundle

External Services

Service Purpose
GitHub API Repository operations
Gemini (Google Generative AI) LLM for code analysis
Vercel Deployment

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         AXIONS ARCHITECTURE                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   GitHub     │────▢│   Webhooks   │────▢│   Express Server     β”‚
β”‚  (PR/Issue)  β”‚     β”‚   Handler    β”‚     β”‚                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
                                          β”‚  β”‚ Review Service β”‚  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚   React      │◀────────────────────────▢│          β”‚           β”‚
β”‚   Frontend   β”‚        REST API          β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β”‚  β”‚  LLM Service   β”‚  β”‚
                                          β”‚  β”‚   (Gemini)    β”‚  β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                          β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚   MongoDB    │◀─────────────────────────│          β”‚           β”‚
β”‚   Database   β”‚                          β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                          β”‚  β”‚ GitHub Service β”‚  β”‚
                                          β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
                                          β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Data Flow

1. PR/Issue Created on GitHub
        β”‚
        β–Ό
2. GitHub sends Webhook to /api/webhooks/github
        β”‚
        β–Ό
3. Verify signature & find connected repo
        β”‚
        β–Ό
4. Route to appropriate handler:
   β”œβ”€β”€ PR β†’ orchestrateReview()
   └── Issue β†’ orchestrateIssueLabeling()
        β”‚
        β–Ό
5. Fetch diff/content from GitHub API
        β”‚
        β–Ό
6. Send to LLM for analysis
        β”‚
        β–Ό
7. Post results back to GitHub
        β”‚
        β–Ό
8. Record stats (locked, immutable)
        β”‚
        β–Ό
9. Dashboard reads from rebuildRepoStats()

πŸ“ Project Structure

Axions/
β”œβ”€β”€ client/                    # React frontend
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ components/        # Reusable UI components
β”‚   β”‚   β”‚   β”œβ”€β”€ Logo.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ MetricCard.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Navbar.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ Sidebar.jsx
β”‚   β”‚   β”‚   └── StatCard.jsx
β”‚   β”‚   β”œβ”€β”€ hooks/             # Custom React hooks
β”‚   β”‚   β”‚   └── useAnalyticsData.js
β”‚   β”‚   β”œβ”€β”€ lib/               # Utilities
β”‚   β”‚   β”‚   └── api.js         # API client
β”‚   β”‚   β”œβ”€β”€ pages/             # Route pages
β”‚   β”‚   β”‚   β”œβ”€β”€ DashboardPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ RepositoriesPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ AnalyticsPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ DeepAnalysisPage.jsx
β”‚   β”‚   β”‚   β”œβ”€β”€ ErrorTrackingPage.jsx
β”‚   β”‚   β”‚   └── ...
β”‚   β”‚   β”œβ”€β”€ services/          # API service layer
β”‚   β”‚   β”‚   └── analyticsService.js
β”‚   β”‚   β”œβ”€β”€ App.jsx            # Root component
β”‚   β”‚   └── main.jsx           # Entry point
β”‚   β”œβ”€β”€ package.json
β”‚   └── vite.config.js
β”‚
β”œβ”€β”€ server/                    # Express backend
β”‚   β”œβ”€β”€ api/
β”‚   β”‚   └── index.js           # Vercel serverless entry
β”‚   β”œβ”€β”€ config/
β”‚   β”‚   └── passport.js        # GitHub OAuth config
β”‚   β”œβ”€β”€ controllers/
β”‚   β”‚   β”œβ”€β”€ analyticsController.js
β”‚   β”‚   β”œβ”€β”€ authController.js
β”‚   β”‚   β”œβ”€β”€ repoController.js
β”‚   β”‚   └── webhookController.js
β”‚   β”œβ”€β”€ lib/
β”‚   β”‚   └── mongoose.js        # DB connection helper
β”‚   β”œβ”€β”€ middleware/
β”‚   β”‚   └── auth.js            # JWT verification
β”‚   β”œβ”€β”€ models/                # MongoDB schemas
β”‚   β”‚   β”œβ”€β”€ ConnectedRepo.js
β”‚   β”‚   β”œβ”€β”€ ErrorLog.js
β”‚   β”‚   β”œβ”€β”€ IssueTriage.js
β”‚   β”‚   β”œβ”€β”€ PullRequestReview.js
β”‚   β”‚   β”œβ”€β”€ RepoStats.js
β”‚   β”‚   └── User.js
β”‚   β”œβ”€β”€ routes/
β”‚   β”‚   β”œβ”€β”€ analytics.js
β”‚   β”‚   β”œβ”€β”€ auth.js
β”‚   β”‚   β”œβ”€β”€ github.js
β”‚   β”‚   β”œβ”€β”€ repos.js
β”‚   β”‚   β”œβ”€β”€ test.js
β”‚   β”‚   └── webhooks.js
β”‚   β”œβ”€β”€ services/              # Business logic
β”‚   β”‚   β”œβ”€β”€ githubService.js   # GitHub API wrapper
β”‚   β”‚   β”œβ”€β”€ llmService.js      # AI analysis
β”‚   β”‚   β”œβ”€β”€ reviewService.js   # PR review orchestration
β”‚   β”‚   └── statsService.js    # Analytics & stats
β”‚   β”œβ”€β”€ app.js                 # Express app setup
β”‚   β”œβ”€β”€ server.js              # Server entry point
β”‚   └── package.json
β”‚
└── README.md                  # This file

πŸš€ Getting Started

Prerequisites

  • Node.js 18+
  • MongoDB (local or Atlas)
  • GitHub OAuth App (for authentication)
  • Gemini API Key (for AI analysis)

1. Clone the Repository

git clone https://github.com/yourusername/axions.git
cd axions

2. Install Dependencies

# Install server dependencies
cd server
npm install

# Install client dependencies
cd ../client
npm install

3. Set Up Environment Variables

Create .env files in both server/ and client/ directories.

Server .env:

# Database
MONGO_URI=mongodb://localhost:27017/axions

# GitHub OAuth
GITHUB_CLIENT_ID=your_github_client_id
GITHUB_CLIENT_SECRET=your_github_client_secret
GITHUB_CALLBACK_URL=http://localhost:5000/api/auth/github/callback

# GitHub Webhooks
GITHUB_WEBHOOK_URL=https://your-server-domain/api/webhooks/github

# JWT
JWT_SECRET=your_super_secret_jwt_key
JWT_EXPIRY=7d

# LLM Provider
GEMINI_API_KEY=your_gemini_api_key
GEMINI_MODEL=gemini-2.5-flash-lite

# Feature Flags
FEATURE_ISSUE_LABELING=true
FEATURE_ISSUE_SUMMARIZATION=true
ENABLE_AUTO_LABELS=true
ENABLE_AUTO_SUMMARY=true

# Frontend URL (for CORS)
FRONTEND_URL=http://localhost:5173
CORS_CREDENTIALS=true

Client .env:

VITE_API_BASE_URL=http://localhost:5000

4. Create GitHub OAuth App

  1. Go to GitHub Developer Settings
  2. Click "New OAuth App"
  3. Fill in:
    • Application name: Axions (Development)
    • Homepage URL: http://localhost:5173
    • Authorization callback URL: http://localhost:5000/api/auth/github/callback
  4. Copy Client ID and Client Secret to your .env

5. Start Development Servers

# Terminal 1: Start backend
cd server
npm run dev

# Terminal 2: Start frontend
cd client
npm run dev

6. Access the App

Open http://localhost:5173 in your browser.


πŸ” Environment Variables

Server Variables

Variable Required Description
MONGO_URI βœ… MongoDB connection string
GITHUB_CLIENT_ID βœ… GitHub OAuth App Client ID
GITHUB_CLIENT_SECRET βœ… GitHub OAuth App Client Secret
GITHUB_CALLBACK_URL βœ… OAuth callback URL
GITHUB_WEBHOOK_URL βœ… Webhook delivery URL
JWT_SECRET βœ… Secret for signing JWTs
JWT_EXPIRY ❌ JWT expiry (default 7d)
GEMINI_API_KEY βœ… Gemini API key
GEMINI_MODEL ❌ Gemini model name
FEATURE_ISSUE_LABELING ❌ Enable auto-labeling (true/false)
FEATURE_ISSUE_SUMMARIZATION ❌ Enable auto-summarization (true/false)
ENABLE_AUTO_LABELS ❌ Alternative flag for labeling
ENABLE_AUTO_SUMMARY ❌ Alternative flag for summarization
FRONTEND_URL βœ… Frontend URL for CORS
CORS_CREDENTIALS ❌ Enable credentials for CORS
SHOW_DETAILED_ERRORS ❌ Include stack traces in errors
PORT ❌ Server port

Client Variables

Variable Required Description
VITE_API_BASE_URL βœ… Backend API URL

πŸ—„οΈ Database Schema

User

{
  githubId: String,        // GitHub user ID
  username: String,        // GitHub username
  email: String,           // Email address
  avatar: String,          // Profile picture
  accessToken: String,     // GitHub OAuth token
  createdAt: Date,
  updatedAt: Date
}

ConnectedRepo

{
  userId: ObjectId,        // Reference to User
  githubRepoId: Number,    // GitHub repository ID
  name: String,            // Repository name
  fullName: String,        // owner/repo
  owner: String,           // Repository owner
  isPrivate: Boolean,
  isConnected: Boolean,    // Active connection status
  webhookId: Number,       // GitHub webhook ID
  webhookSecret: String,   // Webhook signature secret
  reviewCount: Number,     // Total reviews (legacy)
  lastReviewedAt: Date,
  createdAt: Date
}

PullRequestReview

{
  owner: String,
  repo: String,
  githubRepoId: Number,
  pull_number: Number,
  commit_id: String,       // SHA of reviewed commit
  userId: ObjectId,
  repoId: ObjectId,
  filesAnalyzed: Number,
  commentsPosted: Number,  // LOCKED on first insert
  confidence: String,
  analysis: Mixed,         // Full LLM response
  analyzedAt: Date
}
// Unique index: (githubRepoId, pull_number, commit_id)

IssueTriage

{
  owner: String,
  repo: String,
  githubRepoId: Number,
  issue_number: Number,
  userId: ObjectId,
  repoId: ObjectId,
  labelsApplied: [String], // LOCKED on first insert
  summary: String
}
// Unique index: (githubRepoId, issue_number)

RepoStats (Derived Cache)

{
  repoId: ObjectId,
  githubRepoId: Number,
  userId: ObjectId,
  totalPRsReviewed: Number,
  totalInlineComments: Number,  // Total comments (body + inline)
  totalIssuesTriaged: Number,
  totalLabelsApplied: Number,
  totalErrors: Number,
  lastActivityAt: Date
}
// Rebuilt from PullRequestReview + IssueTriage records

ErrorLog

{
  owner: String,
  repo: String,
  githubRepoId: Number,
  pull_number: Number,
  userId: ObjectId,
  error: String,
  errorStack: String,
  createdAt: Date
}

πŸ”Œ API Endpoints

Authentication

Method Endpoint Description
GET /api/auth/github Initiate GitHub OAuth
GET /api/auth/github/callback OAuth callback handler
GET /api/test/me Get current user (JWT)

GitHub

Method Endpoint Description
GET /api/github/repos List user's GitHub repos

Repositories

Method Endpoint Description
GET /api/repos/connected List connected repos
POST /api/repos/connect Connect a repository
DELETE /api/repos/:repoId/disconnect Disconnect a repository

Webhooks

Method Endpoint Description
POST /webhooks/github GitHub webhook receiver (local)
POST /api/webhooks/github GitHub webhook receiver (serverless)

Analytics

Method Endpoint Description
GET /api/analytics/summary User-wide stats summary
GET /api/analytics/activity/recent Recent activity feed
GET /api/analytics/timeseries Review activity over time
GET /api/analytics/repos/comparison Compare repo performance
GET /api/analytics/repo/:repoId/density Comment density analysis
GET /api/analytics/repo/:repoId/confidence Confidence distribution
GET /api/analytics/errors/trends Error rate trends (paged, 10 per page)
GET /api/analytics/repo/:repoId/issues Issue triage analysis

βš™οΈ How It Works

PR Review Flow

1. Developer creates/updates a PR
        β”‚
        β–Ό
2. GitHub sends webhook (pull_request.opened/synchronize)
        β”‚
        β–Ό
3. webhookController.js receives & verifies signature
        β”‚
        β–Ό
4. reviewService.orchestrateReview() is called
        β”‚
        β”œβ”€β”€ 4a. githubService.fetchDiff() - Get PR diff
        β”‚
        β”œβ”€β”€ 4b. llmService.analyzeDiff() - AI analysis
        β”‚        └── Returns: { inlineComments, filesAnalyzed, confidence }
        β”‚
        β”œβ”€β”€ 4c. llmService.generatePRTextSummary() - Create review body
        β”‚
        β”œβ”€β”€ 4d. githubService.postReview() - Post to GitHub
        β”‚
        └── 4e. statsService.recordReview() - Save to DB (locked)
                 └── commentsPosted = 1 (body) + N (inline)

Issue Labeling Flow

1. User creates a new issue
        β”‚
        β–Ό
2. GitHub sends webhook (issues.opened)
        β”‚
        β–Ό
3. webhookController.orchestrateIssueLabeling()
        β”‚
        β”œβ”€β”€ 3a. llmService.generateIssueLabels() - Get labels
        β”‚
        β”œβ”€β”€ 3b. githubService.applyColoredLabels() - Apply to issue
        β”‚
        β”œβ”€β”€ 3c. llmService.generateIssueSummary() - Create summary
        β”‚
        β”œβ”€β”€ 3d. githubService.postIssueSummaryComment() - Post comment
        β”‚
        └── 3e. statsService.recordIssueTriage() - Save to DB (locked)

πŸ“Š Analytics Dashboard

Dashboard Pages

Page Description
Dashboard Overview with key metrics and recent activity
Repositories Manage connected repositories
Analytics Detailed charts and time-series data
Deep Analysis Comment density, confidence distribution
Error Tracking Monitor failures and error rates
Profile User settings and account info

Metrics Tracked

  • PRs Reviewed: Total pull requests analyzed
  • Comments Posted: Review body + inline comments
  • Issues Triaged: Issues with labels/summaries applied
  • Labels Applied: Unique labels per issue
  • Error Rate: Failed reviews / total attempts
  • Avg Comments/PR: Code quality indicator

🚒 Deployment

Vercel Deployment

Both client and server are configured for Vercel deployment.

Server (server/vercel.json):

{
  "version": 2,
  "builds": [
    { "src": "api/index.js", "use": "@vercel/node" }
  ],
  "routes": [
    { "src": "/(.*)", "dest": "api/index.js" }
  ]
}

Client (client/vercel.json):

{
  "rewrites": [
    { "source": "/(.*)", "destination": "/index.html" }
  ]
}

Deploy Steps

  1. Push to GitHub
  2. Import to Vercel (both client and server as separate projects)
  3. Set Environment Variables in Vercel dashboard
  4. Update OAuth Callback URL to production server URL
  5. Update FRONTEND_URL to production client URL

Production Checklist

  • Set all environment variables in Vercel
  • Update GitHub OAuth App with production URLs
  • Test webhook delivery from GitHub
  • Verify CORS configuration

🀝 Contributing

We welcome contributions! Here's how to get started:

Development Workflow

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/your-feature-name
  3. Make your changes
  4. Run tests (if available)
  5. Commit with clear messages
    git commit -m "feat: add new analytics chart"
  6. Push and create a PR

Code Style

  • Use ESLint for JavaScript linting
  • Follow conventional commits for commit messages

Key Files to Understand

File What It Does
server/services/reviewService.js Orchestrates the entire PR review flow
server/services/llmService.js All AI/LLM interactions
server/services/statsService.js Analytics and stats aggregation
server/controllers/webhookController.js Handles GitHub webhooks
client/src/hooks/useAnalyticsData.js Frontend data fetching

πŸ”§ Troubleshooting

Common Issues

Webhooks Not Received

  • Check webhook secret matches in GitHub and .env
  • Verify webhook URL is publicly accessible
  • Check GitHub webhook delivery logs

Stats Showing Wrong Numbers

  • Run rebuildRepoStats() to recalculate from source records
  • Check for duplicate records in database
  • Verify unique indexes exist on collections

OAuth Errors

  • Verify callback URL matches exactly (including trailing slashes)
  • Check client ID and secret are correct
  • Ensure GitHub OAuth App is not suspended

LLM Errors

  • Verify API key is valid and has credits
  • Check rate limits on Gemini
  • Review error logs for specific failure messages

Debug Commands

# Check MongoDB connection
mongosh $MONGO_URI --eval "db.stats()"

# View webhook logs
curl -H "Authorization: token YOUR_TOKEN" \
  https://api.github.com/repos/OWNER/REPO/hooks/HOOK_ID/deliveries

πŸ“„ License

This project is licensed under the ISC License - see the LICENSE file for details.


πŸ™ Acknowledgments


Built with ❀️ by the Axions Team

⬆ Back to Top

About

AI-powered GitHub automation platform for automated code reviews, smart issue labeling, and analytics dashboard

Resources

Stars

Watchers

Forks

Contributors

Languages